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
1
vote
1 answer

How to encode .. pick the best X of Y choices (min or max) .. in mixed integer linear program using R and lpSolve?

I am trying to solve an exercise related to optimization using binary constraint. Below is a description of the problem. For this problem I am using R and lpSolveAPI - so far I managed to translate the problem into a list of constraints and build…
Michael
  • 2,436
  • 1
  • 36
  • 57
1
vote
1 answer

Solving the assignment problem with specific constraints

Imagine the following data (the code to reproduce all the outputs is at the end): df cars horsepower year safety 1 Toyota 140 2008 4 2 Chrysler 120 2009 4 3 Ford 140 2010 5 4 …
1
vote
1 answer

How to configure lpsolve in anaconda3 and python 3.7 also in pycharm-2018.2.4 in ubuntu-14.04?

I want to use lpsolve package in pycharm-2018.2.4. Also I installed anaconda3 and python3.7. Using this link install lpsolve I downloaded and I got lpsolve55.so file. But I couldn't understand the steps in that link and I can't configure the path…
user1999109
  • 421
  • 7
  • 19
1
vote
0 answers

RStudio not responding with large Linear Optimization

I have a large two-step optimization problem that I've tried to simplify for this question. The first step is to choose 10 elements to maximize utility with certain constraints. I need 200 of these sets, but due to the nature of what I'm trying to…
CoolGuyHasChillDay
  • 659
  • 1
  • 6
  • 21
1
vote
2 answers

Expressions for LPsolve

I'm working on a problem that involves constraints containing certain kind of expressions, which are to be solved using LPsolve. I can't seem to figure out how to formulate the constraints though. e.g:- I'd like to reformulate the following…
1
vote
0 answers

Creating interaction dummy variables for lpSolve constraint

I have a linear programming model I'm trying to optimize, and need some help setting up the constraints to get what I want. High-level: I want to choose items only if their "type" doesn't "conflict" with another item's specific "type". Explaining in…
1
vote
1 answer

lp_solve ignoring trivial restrictions

I made a really simple linear problem for lp_solve. $ cat test.txt max: 100X ; X <= 0 ; bin X ; The right answer shall be that X has to be 0, as it is a binary variable and cannot be 1 due the restriction. However the result is: $ lp_solve…
Autopawn
  • 33
  • 4
1
vote
1 answer

r how to use lpSolve and limit rows selected

I'm trying to replicate an Excel solver model in R. It's a simple problem to start looking to maximize points with the only constraint being limited the number events than can be played. So I have a two column data frame with a tournament number…
G Casey
  • 13
  • 5
1
vote
0 answers

Setting up a linear optimizer with an "or" constraint

I have a big linear optimizer I'm running and need some help setting up the constraints to get what I want. It's hard for me to express it in words exactly (hence the vague post-title), so I've written an example, details: Select a total of 5…
CoolGuyHasChillDay
  • 659
  • 1
  • 6
  • 21
1
vote
1 answer

Product of Two Variable in Integer Programming Objective

I'm trying to create an optimization problem in the following form using lpSolveAPI. max 10(x1 + x2) * S1 + 20(x1 + x2) * S2 sub.to. S1 + S2 <= 1 # These are binary variables. 2 * x1 + 3 * x2 <= 30 1 * x1 + 2 * x2 <= 10 x1 & x2 are integers. My…
1
vote
0 answers

lpsolve how solution changes if exclude some contraints

I have a code with lpsolve package which quite standard way calculates minimal price for given constrains. That works ok. My next task is to see if i exclude or change one constraint, how does prices change? It could be ok to have little bit higher…
Anna K
  • 81
  • 1
  • 2
  • 5
1
vote
1 answer

R LpSolve How to optimize picks with Budget Restriction

I have a question about LpSolve in R. I have a panel with the following data: Football player ID (around 500 player), how many games each of them has already played, number of goals scored and cost of the player. I want to create a matrix from this…
R_Lemur
  • 13
  • 2
1
vote
1 answer

Set up linear programming optimization in R using LpSolve?

I have this optimization problem where I am trying to maximize column z based on a unique value from column X, but also within a constraint that each of the unique values picked of X added up column of Y most be less than (in this example) 23. For…
CooperBuckeye05
  • 149
  • 2
  • 14
1
vote
0 answers

Linear programming (lpsolve) gives a different solution when constant is added to function

I'm obviously doing something wrong here but I can't understand what. I have a matrix of the function to maximise called here rank (if interested the expected progeny performance from the mating of a male and female) with some constraints -…
D Berry
  • 33
  • 3
1
vote
0 answers

R: Converting from Excel Solver to lpSolve

Until recently, my R usage was limited to plotting with ggplot etc. At the moment, I'm trying to solve linear problems with R using lpSolve, which proves to be quite the challenge. I'm trying to achieve similar results as I got with the Solver in MS…