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
0
votes
0 answers

Error performing sensitivity analysis on binary integer programming model using LpSolveAPI package in R

I have a basic binary linear programming model with twenty-five constraints and 416 variables. I create the model and solve for an optimal solution, using the LpSolveAPI package, with no problem. However, when I try to run the package's sensitivity…
0
votes
0 answers

Invest in any weight in R LP

I would like to find the optimal weighting for the 10 stocks, but he always only invests in the ones with the highest return. I want every share to be included. Thank you in advance for the help. # Load LP require(lpSolve) #No short sales!!!! #100%…
0
votes
0 answers

Cannot allocate a vector of 2.8Gb error in R studio

I get this error "Error: cannot allocate vector of size 2.8 GB" when i execute a code in Server based R studio. I am trying to allocate matrix of size 2.8GB for using it in lpsolve package. Server has 16GB RAM, but it is not able to allocate 2.8 GB.…
Damini S
  • 1
  • 1
0
votes
0 answers

Is lp_solve changing constraints to find a feasible solution?

I use lp_solve Java API to solve a constrained problem, and I have two constraints that would limit the number of selected items in a specified range, such as the following one: +36 S_1 +31 S_2 +20 S_3 +34 S_4 +19 S_5 +17 S_6 +15 S_7 +39 S_8 +33 S_9…
0
votes
1 answer

finding an initial solution with lpSolve in R

I would like to use the lpSolve package or the lpSolveAPI to generate an integer solution quickly. The lpSolve program in R runs until it finds an optimal solution, but this could take a while with the size of the problems I am dealing with. I am…
Daniel
  • 1
0
votes
1 answer

Problem when linking c++ program with lpsolve api

I'm facing some issues when linking my c++ program, here is what I do : g++ tp.cpp -llpsolve55 -lcolamd -ldl -o MyExe and the command-line return me this : /usr/bin/ld: cannot find -llpsolve collect2: error: ld returned 1 exit status But I've…
user12317677
0
votes
1 answer

Translate from lpSolve to lpSolveAPI Package

The goal: Use current lpSolve code to create a new code using the lpSolveAPI package. The background: I have been using lpSolve to find an optimal solution, for purposes of creating fantasy sports contest lineups, which maximizes the projected…
0
votes
0 answers

Setting variables to be above a certain number in linear programming (lpSolve)

I have quite a simple linear programming problem. Where I want to maximise z with various constraints. However, I'm not sure how to write constraint number 4. I need both x and y to be above 2. Any solutions? max z = 5x + 4y constraints: 1) 4x + 2y…
Zara Liew
  • 1
  • 3
0
votes
1 answer

R lpsolve get 2nd,3rd,Nth best solution

I am trying to solve an optimization problem using lpsolveapi in R. I am trying to get not only the best solution, but also get the next best (through nth) solutions. The application is for fantasy football where you have a set number of players…
CooperBuckeye05
  • 149
  • 2
  • 14
0
votes
1 answer

Getting different solution to linear programming problem when slack variables are added

I am trying to solve a basic linear programming problem using lpSolve in R. The original problem is: In augmented form (i.e. with slack variables added) it is: When I solve the original problem like so: M = matrix(c(1, 2, 3, 1), nrow = 2, byrow =…
Data
  • 689
  • 7
  • 23
0
votes
0 answers

Optimization with inequality constraints using R

I am trying to minimize the function: f(x) = -x[1]*x[2]*x[3] subject to the constraints: 0 <= x[1] + 2*x[2] + 2*x[3] <= 72. What I did so far is that I wrote the constraint as two separate constraints: constraint_1: -x[1] - 2*x[2] - 2*x[3]…
user10321
  • 11
  • 3
0
votes
0 answers

R: using lpSolve to solve a system of equations with constraints

I'm trying to solve the following system of equations: 0.5 * x1 + 0.75 * x2 + 0.25 * x3 = 0.25 x1 + x2 + x3 = 1 I first randomly select $x3$ from a uniform distribution. Then I update my system of equations to solve for the remaining x1 and x2. I…
Adrian
  • 9,229
  • 24
  • 74
  • 132
0
votes
1 answer

How to implement != (not equal) in lpSolve r

Since lpSolve does not allow to use != for the constraint directions, what is an alternative way to get the same result? I would like to maximize x1 + x2 with constraints: x1 <= 5 and x2 != 5 and keep using lpSolve R package. I've tried using a…
DrDominio
  • 113
  • 1
  • 10
0
votes
1 answer

Thrifty boundaries in Mixed Integer Linear Programming

I'm currently using lp_solve and its R API to set and solve a linear programming problem. For the purpose of this question, setting up a much simpler linear programming problem is useful, so let we have this toy example which you're encouraged to…
Lisa Ann
  • 3,345
  • 6
  • 31
  • 42
0
votes
1 answer

Python equivalent to R's lpSolve for Linear Programming

I'm converting code from R to Python and am looking for some help with the easiest way to solve a linear programming problem. I've been searching for a long time, and there doesn't seem to be a consensus on the best module to use. In this example I…
CoolGuyHasChillDay
  • 659
  • 1
  • 6
  • 21