Coder Social home page Coder Social logo

lpsolveapi's Introduction

lpsolveapi's People

Contributors

florianschwendinger avatar

Stargazers

Amy Tzu-Yu Chen avatar

Watchers

James Cloos avatar  avatar

lpsolveapi's Issues

r-devel-linux-x86_64-debian-clang check (2022-07-31 r82648)

using R Under development (unstable) (2022-07-31 r82648)
using platform: x86_64-pc-linux-gnu (64-bit)
using session charset: ISO8859-15
checking for file 'lpSolve/DESCRIPTION' ... OK
this is package 'lpSolve' version '5.6.15'
package encoding: UTF-8
checking package namespace information ... OK
checking package dependencies ... OK
checking if this is a source package ... OK
checking if there is a namespace ... OK
checking for executable files ... OK
checking for hidden files and directories ... OK
checking for portable file names ... OK
checking for sufficient/correct file permissions ... OK
checking serialization versions ... OK
checking whether package 'lpSolve' can be installed ... OK
checking package directory ... OK
checking for future file timestamps ... OK
checking DESCRIPTION meta-information ... OK
checking top-level files ... OK
checking for left-over files ... OK
checking index information ... OK
checking package subdirectories ... OK
checking R files for non-ASCII characters ... OK
checking R files for syntax errors ... OK
checking whether the package can be loaded ... OK
checking whether the package can be loaded with stated dependencies ... OK
checking whether the package can be unloaded cleanly ... OK
checking whether the namespace can be loaded with stated dependencies ... OK
checking whether the namespace can be unloaded cleanly ... OK
checking loading without being on the library search path ... OK
checking use of S3 registration ... OK
checking dependencies in R code ... OK
checking S3 generic/method consistency ... OK
checking replacement functions ... OK
checking foreign function calls ... OK
checking R code for possible problems ... [5s/7s] OK
checking Rd files ... [0s/1s] NOTE
checkRd: (-1) lp.Rd:4: Escaped LaTeX specials: \_
checkRd: (-1) lp.Rd:53: Escaped LaTeX specials: \_
checkRd: (-1) lp.assign.Rd:4: Escaped LaTeX specials: \_
checkRd: (-1) lp.transport.Rd:4: Escaped LaTeX specials: \_
checking Rd metadata ... OK
checking Rd line widths ... OK
checking Rd cross-references ... OK
checking for missing documentation entries ... OK
checking for code/documentation mismatches ... OK
checking Rd \usage sections ... OK
checking Rd contents ... OK
checking for unstated dependencies in examples ... OK
checking line endings in C/C++/Fortran sources/headers ... OK
checking line endings in Makefiles ... OK
checking compilation flags in Makevars ... OK
checking for GNU extensions in Makefiles ... OK
checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
checking use of PKG_*FLAGS in Makefiles ... OK
checking use of SHLIB_OPENMP_*FLAGS in Makefiles ... OK
checking pragmas in C/C++ headers and code ... OK
checking compilation flags used ... OK
checking compiled code ... OK
checking examples ... [1s/1s] OK
checking PDF version of manual ... OK
checking HTML version of manual ... OK
checking for non-standard things in the check directory ... OK
DONE
Status: 1 NOTE

clang-UBSAN 2022-07-31 23:45

00check.log

* using log directory ‘/data/gannet/ripley/R/packages/tests-clang-SAN/lpSolve.Rcheck’
* using R Under development (unstable) (2022-07-31 r82648)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* using option ‘--no-stop-on-test-error’
* checking for file ‘lpSolve/DESCRIPTION’ ... OK
* this is package ‘lpSolve’ version ‘5.6.15’
* package encoding: UTF-8
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking whether package ‘lpSolve’ can be installed ... [153s/112s] OK
* checking package directory ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking compiled code ... OK
* checking examples ... OK
* DONE
Status: OK

lpSolve-Ex.Rout


R Under development (unstable) (2022-07-31 r82648) -- "Unsuffered Consequences"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> pkgname <- "lpSolve"
> source(file.path(R.home("share"), "R", "examples-header.R"))
> options(warn = 1)
> library('lpSolve')
> 
> base::assign(".oldSearch", base::search(), pos = 'CheckExEnv')
> base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv')
> cleanEx()
> nameEx("lp")
> ### * lp
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: lp
> ### Title: Linear and Integer Programming
> ### Aliases: lp
> ### Keywords: optimize
> 
> ### ** Examples
> 
> #
> # Set up problem: maximize
> #   x1 + 9 x2 +   x3 subject to
> #   x1 + 2 x2 + 3 x3  <= 9
> # 3 x1 + 2 x2 + 2 x3 <= 15
> #
> f.obj <- c(1, 9, 1)
> f.con <- matrix (c(1, 2, 3, 3, 2, 2), nrow=2, byrow=TRUE)
> f.dir <- c("<=", "<=")
> f.rhs <- c(9, 15)
> #
> # Now run.
> #
> lp ("max", f.obj, f.con, f.dir, f.rhs)
lp_presolve.c:193:34: runtime error: applying non-zero offset 16 to null pointer
    #0 0x7f9ffc9213db in presolve_rebuildUndo /data/gannet/ripley/R/packages/tests-clang-SAN/lpSolve/src/lp_presolve.c:193:34
    #1 0x7f9ffc988821 in postsolve /data/gannet/ripley/R/packages/tests-clang-SAN/lpSolve/src/lp_presolve.c:5620:5
    #2 0x7f9ffc9fcbff in spx_solve /data/gannet/ripley/R/packages/tests-clang-SAN/lpSolve/src/lp_simplex.c:2062:9
    #3 0x7f9ffc9fe260 in lin_solve /data/gannet/ripley/R/packages/tests-clang-SAN/lpSolve/src/lp_simplex.c:2154:12
    #4 0x7f9ffca13511 in lpslink /data/gannet/ripley/R/packages/tests-clang-SAN/lpSolve/src/lpslink56.c:377:25
    #5 0x74ef88 in do_dotCode /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c
    #6 0x83f0a5 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7126:14
    #7 0x829ade in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:748:8
    #8 0x891fd3 in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #9 0x88dc7f in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1844:16
    #10 0x82a518 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:871:12
    #11 0x95ade6 in Rf_ReplIteration /data/gannet/ripley/R/svn/R-devel/src/main/main.c:264:2
    #12 0x95e340 in R_ReplConsole /data/gannet/ripley/R/svn/R-devel/src/main/main.c:316:11
    #13 0x95e149 in run_Rmainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1194:5
    #14 0x95e482 in Rf_mainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1201:5
    #15 0x4f30ba in main /data/gannet/ripley/R/svn/R-devel/src/main/Rmain.c:29:5
    #16 0x7fa00c1cab74 in __libc_start_main (/lib64/libc.so.6+0x27b74) (BuildId: 08df60634339b221bb854d4e10b7278cafde70c4)
    #17 0x43231d in _start (/data/gannet/ripley/R/R-clang-SAN/bin/exec/R+0x43231d)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior lp_presolve.c:193:34 in 
Success: the objective function is 40.5 
> ## Not run: Success: the objective function is 40.5
> lp ("max", f.obj, f.con, f.dir, f.rhs)$solution
[1] 0.0 4.5 0.0
> ## Not run: [1] 0.0 4.5 0.0
> #
> # The same problem using the dense constraint approach:
> #
> f.con.d <- matrix (c(rep (1:2,each=3), rep (1:3, 2), t(f.con)), ncol=3)
> lp ("max", f.obj, , f.dir, f.rhs, dense.const=f.con.d)
Success: the objective function is 40.5 
> ## Not run: Success: the objective function is 40.5
> #
> # Get sensitivities
> #
> lp ("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$sens.coef.from
[1] -1e+30  2e+00 -1e+30
> ## Not run: [1] -1e+30  2e+00 -1e+30
> lp ("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$sens.coef.to  
[1] 4.50e+00 1.00e+30 1.35e+01
> ## Not run: [1] 4.50e+00 1.00e+30 1.35e+01
> #
> # Right now the dual values for the constraints and the variables are
> # combined, constraints coming first. So in this example...
> #
> lp ("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$duals     
[1]   4.5   0.0  -3.5   0.0 -12.5
> ## Not run: [1]   4.5   0.0  -3.5   0.0 -10.5
> #
> # ...the duals of the constraints are 4.5 and 0, and of the variables,
> # -3.5, 0.0, -10.5. Here are the lower and upper limits on these:
> #
> lp ("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$duals.from
[1] -1.776357e-15 -1.000000e+30 -1.000000e+30 -1.000000e+30 -6.000000e+00
> ## Not run: [1]  0e+00 -1e+30 -1e+30 -1e+30 -6e+00
> lp ("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$duals.to  
[1] 1.5e+01 1.0e+30 3.0e+00 1.0e+30 3.0e+00
> ## Not run: [1] 1.5e+01 1.0e+30 3.0e+00 1.0e+30 3.0e+00
> #
> # Run again, this time requiring that all three variables be integer
> #
> lp ("max", f.obj, f.con, f.dir, f.rhs, int.vec=1:3)
Success: the objective function is 37 
> ## Not run: Success: the objective function is 37
> lp ("max", f.obj, f.con, f.dir, f.rhs, int.vec=1:3)$solution
[1] 1 4 0
> ## Not run: [1] 1 4 0
> #
> # You can get sensitivities in the integer case, but they're harder to
> # interpret.
> #
> lp ("max", f.obj, f.con, f.dir, f.rhs, int.vec=1:3, compute.sens=TRUE)$duals
[1]  1  0  0  7 -2
> ## Not run: [1] 1 0 0 7 0
> #
> # Here's an example in which we want more than one solution to a problem
> # in which all variables are binary: the 8-queens problem, 
> # with dense constraints.
> #
> chess.obj <- rep (1, 64)
> q8 <- make.q8 ()
> chess.dir <- rep (c("=", "<"), c(16, 26))
> chess.rhs <- rep (1, 42)
> lp ('max', chess.obj, , chess.dir, chess.rhs, dense.const = q8, 
+     all.bin=TRUE, num.bin.solns=3)
Success: the objective function is 8 
	 3 solutions returned
> 
> 
> 
> cleanEx()
> nameEx("lp.assign")
> ### * lp.assign
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: lp.assign
> ### Title: Integer Programming for the Assignment Problem
> ### Aliases: lp.assign
> ### Keywords: optimize
> 
> ### ** Examples
> 
> assign.costs <- matrix (c(2, 7, 7, 2, 7, 7, 3, 2, 7, 2, 8, 10, 1, 9, 8, 2), 4, 4)
> ## Not run: 
> ##D > assign.costs
> ##D      [,1] [,2] [,3] [,4]
> ##D [1,]    2    7    7    1
> ##D [2,]    7    7    2    9
> ##D [3,]    7    3    8    8
> ##D [4,]    2    2   10    2
> ## End(Not run)
> lp.assign (assign.costs)
Success: the objective function is 8 
> ## Not run: Success: the objective function is 8
> lp.assign (assign.costs)$solution
     [,1] [,2] [,3] [,4]
[1,]    0    0    0    1
[2,]    0    0    1    0
[3,]    0    1    0    0
[4,]    1    0    0    0
> ## Not run: 
> ##D      [,1] [,2] [,3] [,4]
> ##D [1,]    0    0    0    1
> ##D [2,]    0    0    1    0
> ##D [3,]    0    1    0    0
> ##D [4,]    1    0    0    0
> ## End(Not run)
> 
> 
> 
> cleanEx()
> nameEx("lp.transport")
> ### * lp.transport
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: lp.transport
> ### Title: Integer Programming for the Transportation Problem
> ### Aliases: lp.transport
> ### Keywords: optimize
> 
> ### ** Examples
> 
> #
> # Transportation problem, Bronson, problem 9.1, p. 86
> #
> # Set up cost matrix
> #
> costs <- matrix (10000, 8, 5); costs[4,1] <- costs[-4,5] <- 0
> costs[1,2] <- costs[2,3] <- costs[3,4] <- 7; costs[1,3] <- costs[2,4] <- 7.7
> costs[5,1] <- costs[7,3] <- 8; costs[1,4] <- 8.4; costs[6,2] <- 9
> costs[8,4] <- 10; costs[4,2:4] <- c(.7, 1.4, 2.1)
> #
> # Set up constraint signs and right-hand sides.
> #
> row.signs <- rep ("<", 8)
> row.rhs <- c(200, 300, 350, 200, 100, 50, 100, 150)
> col.signs <- rep (">", 5)
> col.rhs <- c(250, 100, 400, 500, 200)
> #
> # Run
> #
> lp.transport (costs, "min", row.signs, row.rhs, col.signs, col.rhs)
Success: the objective function is 7790 
> ## Not run: Success: the objective function is 7790
> lp.transport (costs, "min", row.signs, row.rhs, col.signs, col.rhs)$solution
     [,1] [,2] [,3] [,4] [,5]
[1,]    0  100  100    0    0
[2,]    0    0  200  100    0
[3,]    0    0    0  350    0
[4,]  200    0    0    0    0
[5,]   50    0    0    0   50
[6,]    0    0    0    0   50
[7,]    0    0  100    0    0
[8,]    0    0    0   50  100
> ## Not run: 
> ##D      [,1] [,2] [,3] [,4] [,5]
> ##D [1,]    0  100    0  100    0
> ##D [2,]    0    0  300    0    0
> ##D [3,]    0    0    0  350    0
> ##D [4,]  200    0    0    0    0
> ##D [5,]   50    0    0    0   50
> ##D [6,]    0    0    0    0   50
> ##D [7,]    0    0  100    0    0
> ##D [8,]    0    0    0   50  100
> ## End(Not run)
> 
> 
> 
> ### * <FOOTER>
> ###
> cleanEx()
> options(digits = 7L)
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
Time elapsed:  0.807 0.073 0.999 0 0 
> grDevices::dev.off()
null device 
          1 
> ###
> ### Local variables: ***
> ### mode: outline-minor ***
> ### outline-regexp: "\\(> \\)?### [*]+" ***
> ### End: ***
> quit('no')

Elaborate on README's remark about lpSolveAPI and ROI

Hi, I am new to linear programming (LP), but I started to look into the R package Benchmarking, which uses lpSolveAPI for LP, and I thought it could be nice to refactor some of the code there for my own purposes.

So you could elaborate on this comment of yours:

The lpSolveAPI package was created by Kjell Konis, I currently maintain the package. lpSolveAPI provides an interface to lp_solve which was last updated 2016. Therefore if you don't need callbacks it is recommended to use ROI (https://cran.r-project.org/package=ROI, http://roi.r-forge.r-project.org/) instead.

In exactly what circumstances should I prefer ROI over lpSolveAPI? Given that Benchmarking already uses lpSolveAPI I would like to know if it is really worthwhile changing the code to ROI.

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.