274 questions
3
votes
2
answers
117
views
lpSolve issue with no feasible solution
I'm trying to select 5 values in the first row, 1 value in rows 2-9, and maximize the objective function. The only thing I can't figure out how to embed in the problem is that I can only choose a ...
1
vote
0
answers
55
views
LPSolve Package Bond Optimization
So I'm a big fan of the LPSolve Package in R, but one of its weaknesses is trying to find a way to achieve multi-objective optimization (with the already existing set of constraints).
I've got my code ...
0
votes
1
answer
85
views
Why does lp() linear solver in R find a better solution when given a smaller subset of options?
Given a set of 140 options, my goal is to select the set of options that minimize the objective function and acheive a constraint that weight must be > 5584 units.
Criteria 1 is the objective ...
0
votes
1
answer
107
views
Linear Programming Problem using lpSolveAPI
I am trying to create a linear programming model that will find the optimal mix of bonds to sell that maximizes book yield, exceed a certain market value, do not fall below a certain gain/loss amount, ...
0
votes
1
answer
111
views
Integer Linear Programming in R (minimize the sum of differences between target variable and modeling results)
I am modelling the logarithm of wages for 154 employees. The predictors are a binary matrix, where the rows are employees, the columns are work competencies, and the intersection is either 1 or 0 (i.e....
4
votes
1
answer
357
views
Is there a way to use Linear and Mixed Integer Programming to create groups while Minimizing the Average within the group in R?
I have a list of animals with their parents, that is used to calculate the relationship between them.
I am using the Rsymphony R package to generate matings where each female is crosses only once and ...
1
vote
1
answer
123
views
Different answer for LpSolve and OR-Tools GLOP solver
I wrote this code in C# using Or-tools for solve LP problem (LPSolve script down below)
public static void test(ConvolutionData data)
{
Solver solver = Solver.CreateSolver("GLOP"...
4
votes
2
answers
223
views
Applying lpSolveAPI
I have a number of variables denoting equipment I can replace. When replaced, they improve an impact metric, [I]. Each also has an associated annual cost savings [S] and replacement cost [C].
n <- ...
1
vote
0
answers
71
views
Assigning judges to entries using linear programming in R
I want to assign 4 judges to mark 15 entries, such that:
Each entry is marked by exactly 2 judges;
Each judge marks an equal number of entries (or close to equal given that the number of entries is ...
0
votes
0
answers
190
views
Issue with "lpSolve" on R (maybe an installation issue)
I am trying to run the following R code, about the calculation of the total variation distance
library(lpSolve)
f.obj <- c(0, 1, 1, 1, 0, 1, 1, 1, 0)
f.con <- matrix (c(1, 0, 0, 1, 0, 0, 1, 0, ...
1
vote
1
answer
336
views
How to solve a Supply Chain Linear Programing model using lp_solve with nodeJS (JavaScript)
I am trying to solve the Capacitated Plant Location Model from this YouTube Video using lp_solve:
In Excel the objective function is done using SUMPRODUCT() and I developed this function in JavaScript ...
0
votes
1
answer
78
views
optimize function to maximimize value given a list of unique numbers
I have a function that calculates the total value given a vector of unique integer numbers. For example, in the problem below i would like to find the maximum value by changing the vector numbers.
...
1
vote
1
answer
168
views
How to solve linear programming problem with nxn matrix such that rows and columns sum to given values
I am trying to contract a program on R that solves for the optimal organisation of trade between 243 countries to minimise carbon emissions. I am investigating 4 types of transport - air, water, road ...
2
votes
2
answers
123
views
Linear integer programming in R?
I have a vector of 100 integers, x1, where each element of the vector is in [1, 7]. I want to find, using R, another vector of 100 elements, x2, also containing integers ranging from 1 to 7, that ...
0
votes
0
answers
299
views
LPSolve R MILP optimization Min and max constraints
I am trying to use lpsolve in R to solve the following lp program. I want to maximize the obj function. The constraints are that the variable weights sum up to 1, and the individual weights have to be ...
0
votes
1
answer
128
views
Linear Programming Problem R using lpSolveAPI
Here is the data I'm working with:
structure(list(Name = c("Jokic", "Butler", "Murray", "Adebayo",
"Porter", "Gordon", "Martin", &...
1
vote
1
answer
461
views
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 ...
0
votes
3
answers
468
views
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 ...
0
votes
0
answers
60
views
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 ...
0
votes
1
answer
315
views
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 ...
2
votes
2
answers
2k
views
Large mixed integer programming in R - possible to solve?
I would like to solve a large mixed integer programming problem, and I have tried with R, package lpSolveAPI. The problem is large - 410 variables each of which can be either 0 or 1, and about 49422 ...
1
vote
1
answer
1k
views
Solve a linear programming (LP) problem in R
The function takes in the coefficients of the objective function, the constraints matrix, the right-hand side values for the constraints, the direction of the constraints, and the type of the LP ...
2
votes
1
answer
267
views
Linear Optimization / Max Calories in R (lpSolve)
given a price and calorie matrix, I am trying to solve for the maximum amount of calories possible to buy with $15. I've read the docs for lpSolve + some older answers on here, but I am still having ...
0
votes
1
answer
115
views
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,...
1
vote
2
answers
810
views
Linear programming/MIP setting up sum of conditional constraints?
I'm trying to set up MIP problem using LpSolve and I'm at a loss on how to set it up.
We are trying to allocate resources to various investments, to maximize revenue, subject to a budget constraint. ...
0
votes
1
answer
169
views
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 ...
0
votes
2
answers
177
views
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 ...
0
votes
1
answer
115
views
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 ...
1
vote
1
answer
95
views
optimize network for three connections each in r
I have a list of locations and their weights (calculated distances apart) in a matrix.
I would like the optimal solution for each location having 3 connections, minimizing total distance.
costs6 <- ...
0
votes
1
answer
143
views
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 ...
0
votes
0
answers
187
views
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 ...
1
vote
1
answer
186
views
Integer optimization with binary choice variable in R
I am working on an optimization problem in which my choice variable (to build or not) is a binary variable. The photo attached shows the optimal build choices (solved using Solver in Excel).
I am ...
0
votes
1
answer
109
views
lpSolve - find maximum value - formula with multiplications
I'm looking for a way to use lpSolve in a similar way to how I use it succesfully in Excel. I've calculated elasticity for various product. Based on whether a product is elasticity or not elastic I ...
1
vote
1
answer
717
views
How should i set up linear model in R using lpSolve() library
How should i set up the linear model using lpSolve library in R?
I have the following code but realized I dont know how to add the constraint
library(lpSolveAPI)
library(lpSolve)
### create a new ...
1
vote
2
answers
2k
views
How to speed up linear programming problem solution?
I have the following problem. I have n (typically n = 1000) data points (integers from {1,2,3}, so there are a lot of repeting numbers) and a real number d. I have to choose k<n points (k is given) ...
0
votes
1
answer
64
views
Adding priority to rows in LpsolveAPI in R
I have an optimised time allocation lp code in R using LpSolverAPI. The code works fine with the given constraints which are :
The time allotted per job must be met
The time a worker works cannot ...
1
vote
1
answer
173
views
R lpSolve setting constraints (fantasy football related)
I am trying to solve linear optimization problem.
I have 100 players with score and price for each player. My goal is to select 11 players and to maximize possible score while staying within budget (...
1
vote
2
answers
190
views
lp_solve return uniform solution
Can lp_solve return a unifrom solution? (Is there a flag or something that will force this kinf of behavior?)
Say that I have this:
max: x + y + z + w;
x + y + z + w <= 100;
Results in:
Actual ...
1
vote
1
answer
682
views
lpSolve to solving an integer programming problem
Solving an integer programming problem with R, the model is:
# variables: x1, x2, x3
max z = 25000x1 + 18000x2 + 31000x3
s.t.:
x1 + x2 + x3 = 100
5000x1 + 11000x2 + 7000x3 <= 700000
x1 >= 10
...
0
votes
0
answers
250
views
How to set up a Linear Programming Problem with lpSolveAPI in R
I'm running into a problem setting up a linear programming problem in R using lpSolveAPI.
I have up to seven decision variables and would like to select the variables that maximize a linear reward ...
0
votes
1
answer
330
views
Unable to load dynamic library 'phplpsolve55.so' undefined symbol: zif_drivername
I am on Debian Buster running in a LXC container.
I use a self-compilied version for php of lpsolve.
I install it using this commands from makao/lpsolve.md
The sources I use come from this repo: ...
0
votes
1
answer
301
views
lpsolve with constraints in r
I would like to use R to solve an optimization problem using the lpSolve which can perform processes similar to the solver add-in in excel. Below is a simple case where I would like to maximize npv ...
2
votes
1
answer
308
views
How do I solve this constrained linear programing (LP) problem with one free variable?
I was researching methods to rank forecasts and found this paper, A novel ranking procedure for forecasting approaches using Data Envelopment Analysis, I've been working through the article and ...
0
votes
1
answer
480
views
lpSolve running for extended period of time without finishing
I am trying to optimize a transportation problem in R using lpSolve::lp.transport. My code is as follows:
library(lpSolve)
cost <- matrix(rep(100, 34968), nrow = 372)
row.signs <- rep("<...
1
vote
0
answers
121
views
How to form an LP based clustering problem in R?
Trying to form an LP-based clustering problem in R with binary variables.
sample dataset:
set.seed(123)
id<- seq(1:50)
lon <- rnorm(50, 88.5, 0.125)
lat <- rnorm(50, 22.4, 0.15)
demand <- ...
1
vote
1
answer
250
views
How do I add a dependency constraint in LPsolve with binary variables
I am using the Java wrapper for LPsolve and I have a cost function with the traditional initial fixed cost + operating costs in the cost function
How can I add this constraint that if y_i = 0, p_i ...
0
votes
0
answers
104
views
Digit Accuracy in lpsolve55
I am using the lpsolve55 library in python to find some linear programming solutions. The input data that is loaded needs to have up to 14 digits accuracy, but when the lp solver writes the problem to ...
0
votes
2
answers
697
views
Use sum of binary values as constraint coefficient in integer programming constraint
I am trying to formulate a shelf-optimization integer programming algorithm in lpsolveAPI and wish to add a constraint whereby the same number of each product is on each selected shelf (S):
f
My ...
1
vote
1
answer
450
views
Linear optimization in R, Stigler diet problem
Has anyone tried to replicate The Stigler Diet problen in R?
So far this is what I have:
library(lpSolve)
library(linprog)
# where d is the nutrients data frame found in the above link
f.obj_ <- ...
0
votes
0
answers
91
views
R LPSolve optimization
I am trying to solve a linear programming problem. My goal is to minimize the interest rate risk of a given bond at various parts of the interest rate curve, using Tsy futures.
fut_dur = the total ...