FAQ Database Discussion Community


PuLP producing LP files that are solvable by command line CBC, but PuLP reports a undefined solution

python,linear-programming,pulp
I have the following LP file which is produced by PuLP: \* copynumber *\ Minimize OBJ: PenaltyTree_48 Subject To _C1: - A_0 + A_3 - over_0 <= 0 _C10: - B_3 + B_7 + under_9 >= 0 _C11: - D_0 + D_3 - over_10 <= 0 _C12: - D_0 +...

Assignment element of matrix without for-loop

matlab,for-loop,matrix,vectorization,linear-programming
I'm trying to build a constraint matrix that I'm going to use with linprog, and I'm struggling to build it efficiently without using for loops. Here is an example of what I'm trying to achieve: A = zeros(3, 3); % Constraint matrix i = [1 3]; % row indexes j...

How to convert quadratic to linear program?

mathematical-optimization,linear-programming,integer-programming,quadratic-programming
I have an optimization problem that has in the objective function 2 multiplied variables, making the model quadratic. I am currently using zimpl, to parse the model, and glpk to solve it. As they don't support quadratic programming, I would need to convert this to an MILP. . The first...

Can a modulo operation be expressed as a constraint in CPLEX?

linear-programming,cplex
I have a situation where I want to associate a fixed cost in my optimization function if a summation is even. That is, if (x1 + x2 + x3)%2 = 0 Is there a way this can be modeled in CPLEX? All the variables are binary, so really, I just...

Long Vector Linear Programming in R?

python,r,large-data,linear-programming
Hello and thanks in advance. Fresh off the heels of this question I acquired some more RAM and now have enough memory to fit all the matrices I need to run a linear programming solver. Now the problem is none of the Linear Programming packages in R seem to support...

Difference between simplex method and revised simplex method in GLPK solver

matlab,octave,linear-programming,glpk
I am trying to solve an LP minimization problem with glpk solver in octave for large data. my constraint matrix is having 1000 or more rows. I am confused about using that lpsolver=1 option of glpk. I do not the difference of using that or not. Will I get the...

Add Initial basic feasible solution for simplex using GLPK

linear-programming,glpk
I'd like to know if it is possible to introduce an initial basic feasible solution to the simplex in glpk, this in order to avoid de initialization phase of the algorithm and save computation time. I also want to know if glpk library uses the standard simplex or the revised...

Specifying greater than inequality in scipy

python,scipy,linear-programming
I've solved a simple LP problem where all constraints are "less than or equal to". I used scipy.optimize.linprog for those. The problem is when one or more of the constraints equation is "greater than or equal to". How do I specify that? I need to use the two-phase approach provided...

Representing Travelling Salesman as Linear Expression

algorithm,linear-algebra,linear-programming,cplex,traveling-salesman
I've seen online that one can write the travelling salesman problem as a linear expression and compute it using software such as CPLEX for java. I have a 1000 towns and need to find a short distance. I plan on partitioning these 1000 towns into clusters of ~100 towns and...

“Too many indices” big matrix vector length issue in R

r,memory,64bit,linear-programming
Hello and thanks in advance. I'm using Rx64 version 3.1.2 on a Windows Server and have a file-backed big matrix generated from the package bigmemory that I'm trying to use in a linear programming problem. The matrix is 7062 rows by 364520 columns for a total of 2574240240 entries (of...

Gurobi, How to change a continuous variable to a binary variable

python,linear-programming,gurobi,integer-programming
I am using gurobi-python interface. Is there anyway to convert a continuous variable to a binary variable. I just do not want to convert m.addVar(lb=0, ub=1, vtype=GRB.CONTINUOUS) to m.addVar(lb=0, ub=1, vtype=GRB.BINARY). I have to do it in another way, not using m.addVar() I appreciate your possible feedback. Thank you....

Variable indexes outside of defined range in AMPL

variables,indexing,set,linear-programming,ampl
Not too familiar with AMPL, but running into some issues with indexes... Basically, I have some variables defined as such: var array{i in set}; And I need to do some amount of checking the elements around a given i in some of the constraints: subject to Constraint{i in set}: array[i]...

Openshift Installing an environment such as Gurobi

openshift,linear-programming,gurobi
I am currently working on a project which involves linear programming to optimise a solution to a problem (The linear programming model involves binary variables). As such i have been refered to used Gurobi to tackle this issue. Gurobi works fine on my computer, however i require to deploy the...

least-squares method with a constraint

matlab,math,curve-fitting,linear-programming,least-squares
I have 37 linear equations with 36 variables in the form of matrix: A x = b. (A has 37 rows and 36 columns.) The equations don't have an exact solution so I have used Matlab to find the closest answer using x = A \ b. The problem is...

Absolute Value constraints in lpSolve in R

r,linear-programming,lpsolve,absolute-value,lpsolveapi
I would like to further constrain the system below with the following additional constraint, which makes use of the absolute value operator: abs(x1)+abs(x2)+abs(x3) <= 10. Is there a feasible way to implement these additional absolute value constraints in R? System of equations: maximize: x1 + 9x2 + x3; subject to:...

Heuristic to find the maximum weight independent set in an arbritary graph

algorithm,graph,graph-algorithm,linear-programming,np-complete
The MWIS (Maximum weight independent set) is a NP-complete problem, so if P!=NP we cannot find a solution in a good enough time complexity. I am looking for an algorithm that can find an approximation of the MWIS in an arbitrary graph within a good time complexity. I am currently...

AMPL constraint syntax

constraints,linear-programming,ampl
I am working on a project for a computational optimization class and am having a problem writing a particular constraint for my mixed integer program. The project is essentially a loan portfolio optimization problem where I am trying to maximize an impact on poverty while satisfying constraints on risk, return...

R: Isotonic regression Minimisation

r,regression,mathematical-optimization,linear-programming,minimization
I want minimize the following equation: F=SUM{u 1:20}sum{w 1:10} Quw(ruw-yuw) with the following constraints: yuw >= yu,w+1 yuw >= yu-1,w y20,0 >= 100 y0,10 >= 0 I have a 20*10 ruw and 20*10 quw matrix, I now need to generate a yuw matrix which adheres to the constraints. I am...

How to solve such a ratio function?

matlab,math,linear-programming
Assume W is a known vector, here I want to find the unique solution a, such that: Sum(min(1,W(i)/a))=M (M is known) Is there any specific name for such kind of function? It would be great if you guys can give me a link for some instructions. Thanks....

Linear Programming with Big Matrix - Still having memory problems

r,memory-management,matrix,linear-programming
Hello everyone and thanks in advance! I've had a bit of an interesting journey with this problem. Here I figured out how to create a file-backed big matrix using the bigmemory package. This 7062 row by 364520 column matrix is the constraint matrix in a linear programming problem I'm trying...

Integer programming: assignment of absolute value (depending on variable value)

optimization,mathematical-optimization,linear-programming,scientific-computing,integer-programming
I am relatively new to integer programming and (again) got stuck with the formulation of a constraint. In my simplified model I have a (continous) variable with a lower bound LB below zero and an upper bound UB above zero. Now I want to assign the variable value to other...

'No primal feasible solution' error in GLPK

matlab,octave,linear-programming,glpk
I am solving a minimization problem to cover 3d points with axis parallel lines with GLPK. initially I set lb as 0 and ub as 1. then after getting the GLPK result, I make the first fractional variable value 0 and then change the lb and ub values as: i)...

Mixed integer programming: variable assignment per condition (if then else)

optimization,mathematical-optimization,linear-programming,scientific-computing,integer-programming
I am relatively new to (mixed) integer programming and got stuck with the formulation of a constraint. In my simplified model I have one Parameter and two Variables that are positive Reals having the value 321 as upper bound. The logic I want to express is here: if Parameter >...