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

How do I identify incorrect coding to get the correct result from my R linear programming optimisation model?

I have a linear programming task that I am struggling with. I have formulated the LP problem and have generated some code that appears to function; however, I am suspicious of the outputs and do not believe it to be the correct answer to the…
0
votes
3 answers

Trying to add a constraint to a Integer Linear Programming problem

Problem set: I have 3 different groups that need to be assigned to 6 different locations. Objective: I need to minimize the unused space in each location. Constraints: For each location j, the sum of individuals assigned to that location from all…
0
votes
0 answers

Optimise resource allocation given constraints in R

i have three input matrices: profits: 5x4 matrix. column names plane types 1:4 and for route names rows routes 1:5, profit per route per plane type block hour per plane available: 1x4 matrix. column names plane types 1:4, available block hour per…
Sarah
  • 1
  • 2
0
votes
1 answer

LPSolveAPI - how to find all solutions?

I am using LpSolveAPI package to solve a linear programming problem in R. This gives me one solution, but I would like to know if there are other solutions. Here is an example. Suppose I want to solve the following: library(lpSolveAPI) MyMatrix <-…
0
votes
0 answers

lpSolve generating solutions that don't meet constraints

I'm attempting to create a set of lineups for fictional fantasy teams using the reproducible data and code below. The constraint I'm attempting to implement is one that limits the number of players facing an opposing pitcher to exactly 0 in a given…
On_an_island
  • 387
  • 3
  • 16
0
votes
0 answers

find maximum value/output by optimizing lpsolve or mixed interger program in r

I have a dataframe that consist of ids and an output column. Based on a given constraint I would like to find the optimum solution that maximizes output values. I believe this could be found using…
jsimpsno
  • 448
  • 4
  • 19
0
votes
0 answers

Install Lp package in r

It gives this error, how do I solve it install.packages("lpSolve") Installing package into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is unspecified) trying URL…
0
votes
0 answers

How do I add a dependency between two variables in lpSolveAPI?

I want to add the dependency that x2 has the double value of x3 at all times. I have no idea how to include it in my code :) install.packages("lpSolveAPI") library(lpSolveAPI) lpModel <- make.lp(ncol=4) add.constraint(lpModel, c(6,1,3,5), "<=",…
NovaX
  • 23
  • 2
0
votes
0 answers

Finding multiple binary solutions in R with lpSolve

Using R version 3.6.3 and library(lpSolve) I am unable to solve a linear programming problem. I would like to find the 7 best solutions that maximize: f.obj <- sampleDB$ob1 given the constraints: f.con <- with(sampleDB, matrix(c(con1, con2, con3,…
DataProphets
  • 156
  • 3
  • 17
0
votes
1 answer

Error when running LP Solve formula, Unsure how to add fraction

Formula, Objective and Constraints library(lpSolve) obj.fun<-c(420,360,300,420,360,300,420,360,300) constr<- matrix(c(1,1,1,1,1,1,1,1,1,20,15,12,20,15,12,20,15, 12,1,1,1,1,1,1,1,1,1,.0013,-.001, .0013,-.002, …
JFabian
  • 1
  • 1
0
votes
1 answer

LPSolve with R - Constraint : weighted average by the amount of substrates < a value

This is the first time I ask a question on the site. I am working in R and am looking to optimise the total biomethane production as the sum of that allowed by each substrate I mobilise. However, I have to respect some process constraints. My final…
0
votes
1 answer

LPSOLVE - The model is INFEASIBLE - Why?

I'm having some trouble getting my head around why LPSOLVE can't find a solution to this. min:; x = 1000 ; 5000 - 1 x + 500 y = 0; From inspection, we can see that x = 1000, and y = -8. LPSOLVE states that the model is infeasible. However, when…
Pete
  • 1
  • 1
0
votes
1 answer

I can't propperly use lpsolve - lp.transport. Maybe issue with cost matrix or constraints

In cell costs[1,3] I need to use NULL or NA. Because in the problem there is a constraint that says that row 1 should not give supplies to column 3. I tried to use 0 but i'm not getting the corrrect answer. (Is not possible to use NA, NULL ON…
0
votes
1 answer

lpSolve constraint for choices of start and length of shifts

I have a finite number of staff N, and I need to find an optimal schedule (using the least number of staff) meeting the demand Hour of Day Demand 0 d0 1 d1 ... ... 23 d23 where the d0, d1, ..., d23 are real numbers denoting the…
0
votes
0 answers

lpSolve in R Crashing Linear Programming Problem

I have prepared the following reproducible example showing that lpSolve in R crashes with example 2 and I'm needing some help to identify why so it doesn't crash R. The data and constraints were a bit large so I placed those on github and they can…
dhc
  • 625
  • 1
  • 6
  • 14