Questions tagged [lpsolve]

lp_solve is a free linear (integer) programming solver. The solver is a callable library written in ANSI C.

lp_solve is a free (see LGPL for the GNU lesser general public license) linear (integer) programming solver based on the revised simplex method and the Branch-and-bound method for the integers.

lp_solve solves pure linear, (mixed) integer/binary, semi-continuous and special ordered sets (SOS) models.

It can also be called as a library from different languages like C, VB, .NET, Delphi, Excel, Java, ... It can also be called from AMPL, MATLAB, O-Matrix, Scilab, Octave, R via a driver program. lp_solve is written in ANSI C and can be compiled on many different platforms like linux and WINDOWS.

More details, including an FAQ, and an intro to lp_solve can be found here.

271 questions
4
votes
1 answer

Represent geographical distribution as constraint in linear prob?

I'm learning Solver Foundation right now. I'm actually plugging in lpsolve for my project, but I think my problem is a generic issue of how to best represent my constraints. I have, what I think is, a fairly typical knapsack or packing problem. I…
TheNextman
  • 12,428
  • 2
  • 36
  • 75
3
votes
1 answer

How to turn a binary matrix into a data.frame in R? lpSolveAPI

library(lpSolveAPI) lprec1 <- make.lp(0,nrow(df) add.constraint(lprec1, c(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), "<=", as.numeric(ads1)) add.constraint(lprec1,…
3
votes
1 answer

lpsolve - unfeasible solution, but I have example of 1

I'm trying to solve this in LPSolve IDE: /* Objective function */ min: x + y; /* Variable bounds */ r_1: 2x = 2y; r_2: x + y = 1.11 x y; r_3: x >= 1; r_4: y >= 1; but the response I get is: Model name: 'LPSolver' - run #1 Objective: …
Bojan Vukasovic
  • 2,054
  • 22
  • 43
3
votes
2 answers

Linear programming in R using lpsolve

I'm trying to solve a linear programming problem in R using lpsolve package. Here is the problem: Here is the sample in R for reproducible example: library("lpSolve") a <- matrix(c(1,2,5, 1/2,1,3, …
forecaster
  • 1,084
  • 1
  • 14
  • 35
3
votes
1 answer

lpSolve - optimize objective function to specific value

I m curious if it is possible to define an objective function to be optimized to a specific value instead of just 'min' or 'max'. E.g., I have a function which I want to optimize to 100 having some constraints (omitted here). Objective function (to…
Alex
  • 533
  • 4
  • 12
3
votes
1 answer

Get multiple solutions for 0/1-Knapsack MILP with lpSolveAPI

Reproducable Example: I described a simple 0/1-Knapsack problem with lpSolveAPI in R, which should return 2 solutions: library(lpSolveAPI) lp_model= make.lp(0, 3) set.objfn(lp_model, c(100, 100, 200)) add.constraint(lp_model, c(100,100,200), "<=",…
user2030503
  • 3,064
  • 2
  • 36
  • 53
3
votes
1 answer

How to say a variable is one of three values in linear programming

I'm using LPSolve to solve a linear problem, however I'm having problems expressing myself on the constraints. I want to write on my constraints that a variable t3 is one of three values. so I did something like this: min t3; t3 >= 2+t1; t3 >=…
3
votes
1 answer

Graph longest path using linear programming

I have a weighted directed graph where there are no cycles, and I wish to define the constraints so that I can solve a maximization of the weights of a path with linear programming. However, I can't wrap my head around how to do that. For this I…
3
votes
3 answers

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lpsolve55j in java.library.path

in .bashrc is written: PYTHONPATH="${PYTHONPATH}:$Home/local/lib/python2.7/site-packages/" export PYTHONPATH LD_LIBRARY_PATH="$Home/local/lib/" export LD_LIBRARY_PATH CLASSPATH="/home/stud/qe09kyvu/local/lib/liblpsolve55j.so" export…
peter
  • 315
  • 1
  • 3
  • 11
3
votes
1 answer

R Team Roster Optimization w/ lpSolve

I am new to R and have a particular fantasy sports team optimization problem I would like to solve. I have seen other posts use lpSolve for similar problems but I can not seem to wrap my head around the code. Example data table below. Every player…
3
votes
1 answer

binary LP vs. integer LP

I wonder why there is a difference between the following linear programs. They are written in the LP file format. I would assume that x=1 would be the optimal solution in both cases. Program A: min: x; x >= 1; bin x; Output: Value of objective…
someonr
  • 555
  • 4
  • 12
3
votes
2 answers

If-Then-Else with multiple assignment in Integer Linear Programming (ILP)

I have an ILP problem in which I expressed some constraint to implement A OR B, where A and B are results of logical AND (let's say that A = A1 AND A2, B = B1 AND B2 AND B3). At this point of my problem, one between A and B is said to be equal to 1.…
dash991
  • 31
  • 1
  • 2
3
votes
1 answer

R Ipsolve how to see all solutions

I am looking at the 8 queens puzzle. I used the below R code, which is directly from the R lpsolve documentation. The parameter num.bin.solution is set equal to 3. In R documentation it says that num.bin.solns stands for a numeric indicator of…
user2543622
  • 5,760
  • 25
  • 91
  • 159
3
votes
2 answers

R lpsolve how to define constraints travelling salesman

I want to code travelling salesman problem in R. I am going to begin with 3 cities at first then I will expand to more cities. distance matrix below gives distance between 3 cities. Objective (if someone doesn't know) is that a salesman will start…
user2543622
  • 5,760
  • 25
  • 91
  • 159
3
votes
1 answer

Degeneracy when using lpSolve

I am using lpSolve in R. My models (data envelopment analysis) run fine on my MAC, but when I try to run it on a UNIX cluster many of the models are found to be degenerate. The lp.control options are the same on both systems. I have been able to…
1
2
3
18 19