547 questions
5
votes
1
answer
2k
views
cvxopt.glpk.ilp documentation on Integer & Binary set keys
I have a mixed integer programming problem, (cutting stock with column generation), that I've solved in AMPL and I'm ported to Python using cvxopt. CVXOPT "op" doesn't provide the binary variable ...
2
votes
2
answers
748
views
Binary variables for minimization by scipy differential evolution
I have a non-linear minimization problem that takes a combination of continuous and binary variables as input. Think of it as a network flow problem with valves, for which the throughput can be ...
2
votes
4
answers
315
views
How to force function to return int32 integers?
I have a command in Matlab, that I defined, which should return integer values:
x = intlinprog(f,intcon,A,b,Aeq,beq,lb,ub)
I don't want to round the result. I want the values to be int from the start....
0
votes
1
answer
1k
views
Mixed integer program python
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 ...
0
votes
0
answers
858
views
Different results for identical optimization models, except for cost coefficients in objective function: Neos, Bonmin, Ipopt
I'm using the neos bonmin solver to find a global minimum solution to a highly constrained mixed integer non-linear problem. Below are results for models that are identical, except the coefficients in ...
0
votes
1
answer
554
views
GurobiPy; Change continuous [0,1] variable to binary in callback routine
I'm using the Gurobi Python interface gurobipy. I have a model formulation with a lot of variables. I would like to initialize less important variables that are supposed to be binary as continuous ...
0
votes
1
answer
323
views
linear combination of curves to match a single curve with integer constraints
I have a set of vectors (curves) which I would like to match to a single curve. The issue isnt only finding a linear combination of the set of curves which will most closely match the single curve (...
0
votes
0
answers
551
views
If-then constraints in integer linear programming
I have a 30*40 matrix. Lets say the components in the matrix are specified with "P" and the related number of the row and column of each "P" is specified by "X" and "Y" accordingly. I have a model ...
1
vote
1
answer
1k
views
Use mod function in a constraint using Python Pulp
I am writing a LpProblem and I need to create a constraint where the sum of some variables is multiples of 100... 100, 200, 300...
I am trying the next expressions using mod(), round() and int() but ...
0
votes
1
answer
658
views
Python external constraint function in MINLP
Is it possible to add as a dynamic constraint an external custom function in Mixed Integer Nonlinear Programming libraries in Python? I am working with boolean variables and Numpy matrices (size m x n)...
0
votes
0
answers
389
views
Using Scipy.optimize.linprog for the first time in Python
Hello,
I'm using Scipy.optimize.linprog for the first time.
My problem is this:
I don't know how to use the code, but these are the variables I am trying to optimize:
Date Salary Name ...
1
vote
2
answers
2k
views
Mixed Integer Linear Programming to And/Or Constraints
I'm looking to satisfy a set of constraints using PuLP and I'm not exactly sure how to set up the variables to do so.
For example, how would I set up variables for the following constraint:
((x_1 &...
0
votes
0
answers
3k
views
Cutting plane method: using python
I want to implement cutting plane method in python using an built in improve lementation of simplex method and then applying cutting plane method on top of it (using scipy.linprog or pulp to implement ...
3
votes
1
answer
2k
views
LinearProgramming : Non-overlapping constraint?
I want to write a non overlapping constraint (that is, 2 rectangles don't overlap) in a linear program (or a MIP if necessary). I know how to do it in Constraint programming:
For object i and j:
x[i]...
0
votes
1
answer
2k
views
MIP/LP - Modelling "if b=1 then x=y" constraint
I have a Mixed Integer Programming (MIP) problem, currently modelled in Python's PuLP library. My issue is however very generic, syntax doesn't play a role here.
I want to add a constraint to my ...
0
votes
0
answers
932
views
If then else constraints - Integer Linear programming - Gurobi
I would like to express if then else statement in a set of constraints using Gurobi via Python API where B and A are binary decision variables.
Here is the statement I am stuck on :
If (B[r,u,v,x,y]...
2
votes
0
answers
877
views
Creating a conditional objective function for optimization
fij = xi - xj if xi > xj
fij = xi - xj + 1440 if xi < xj
min sum(fij*Lij)
cons by:
0 =< xi <= 1439 #Minutes in a day
Context: xi and xj correspond to departure and ...
3
votes
1
answer
496
views
ompr objective: minimize variance of rowsums
I am using the ompr package with r, and I cannot figure out how to change the objective function to my needs. The first model is running, but the objective is not really what I need.
library(ompr)
...
2
votes
1
answer
319
views
Piecewise linear constraint in CPLEX API for MATLAB
I am a (almost) beginner with CPLEX and optimization. I am trying to set up an optimization problem in Matlab using the newly added feature of CPLEX (12.7.1), which enables the definition of piecewise ...
2
votes
1
answer
2k
views
Pyomo and conditional objective function
Is it possible (and if so how) to use an objective function that has a conditional expression?
Changing the example from the docs, I would like an expression like:
def objective_function(model):
...
4
votes
2
answers
2k
views
Determining whether an integer program is infeasible
Suppose we have an integer or mixed-integer program with a couple of thousand of constraints.
How can we determine whether this IP / MIP is feasible?
1
vote
0
answers
432
views
Get variable results from failed run in neos using bonmin for a MINLP
I'm using the neos-server to solve a highly constrained MINLP, using the bonmin algorithm. Solving using either a Branch and Bound or the hybrid method. The input code is AMPL
I want to know if it's ...
2
votes
0
answers
384
views
R: GA package Discrete input parameters
What changes are to be made so that the input parameters are considered to be discrete/integer values?
Making high penalties in the fitness function is not the right option as it becomes a part of the ...
22
votes
3
answers
15k
views
Difference LP/MIP and CP
what is the difference between Constraint Programming (CP) and Linear Programming (LP) or Mixed Integer Programming (MIP) ? I know what LP and MIP is but dont understand the difference to CP - or is ...
1
vote
2
answers
4k
views
cardinality constraint in portfolio optimisation
I am using cvxpy to work on some simple portfolio optimisation problem. The only constraint I can't get my head around is the cardinality constraint for the number non-zero portfolio holdings. I tried ...
0
votes
0
answers
124
views
How to modify variable attributes in JuMP?
I'm using Julia+JuMP and Gurobi to solve a MIP. Is it possible to modify variable attributes like BranchingPriority?
So far, I only found methods in the documentation to modify model parameters. The ...
0
votes
1
answer
614
views
Extracting an hour by hour shadow price in an MIP using Gurobi
I am trying to extract the shadow price for a particular constraint within my MIP model - and am using Gurobi as the solver.
When I am establishing the constraint, I use the following code -
# ...
6
votes
1
answer
7k
views
PuLP - How to specify the solver's accuracy
I will try to keep my question short and simple. If you need any further information, please let me know.
I have an MIP, implemented in Python with the package PuLP. (Roughly 100 variables and ...
0
votes
1
answer
1k
views
Use of max command inside quicksum - gurobi with python
I am trying to include a python "max" command inside a quicksum command using gurobi with python. There is obviously an error with doing so, under LinExpr limitations as it is not accepted.
...
8
votes
1
answer
843
views
Mixed-Integer Nearest Optimal Solution in Matlab
Is it possible to find the nearest solution to optimal for a mixed-integer problem? For example I would want the simplified problem below:
f = [1;1;1];
intcon = 1:3;
Aeq = [0.99,0.97,0.15];
beq = 0....
0
votes
2
answers
2k
views
CPLEX dvar as condition
I have this problem while trying to find a solution for a resource constraint scheduling problem. Whenever I put dvar as a condition in a forall loop or if condition I have the error that states "...
0
votes
1
answer
1k
views
Optimizing A Loan Portfolio On Weighted Average Criteria
EDIT: I realised that my previous attempt at a way to describe the problem wasn't very helpful and indeed didnt actually model what I'm currently doing at the moment very well, so I've rewritten the ...
2
votes
1
answer
2k
views
Gurobi Optimization Result Writing into Csv file
I am using Gurobi 7 to solve my MIP. I have several different variables. However, I am specifically interested in two of those, "x" and "y" namely. For the reference, I am giving my code that shows ...
0
votes
1
answer
1k
views
Start the CPLEX with given Initial Solution on C# (Concert technology)
I want to solve the MILP problem with CPLEX-C#. The size of my problem is large and in order to improve the CPU time I want to use initial solution. I want to add this solution into cplex and start to ...
1
vote
2
answers
4k
views
Are there any reliable open source non-linear mixed integer optimization solvers?
I've been struggling to find some open source non-linear integer optimization solvers! I am trying to solve a 16 variable problem where 8 values are integers, subjected to two nonlinear objective ...
2
votes
1
answer
1k
views
Pyomo ValueError: PositiveReals is not a valid domain
I'm trying to solve a constraint mixed integer non linear optimization problem using PyOMO. Specifically, I'm trying to find gear diameters and tooth numbers such that two given gear ratios are met. I'...
1
vote
1
answer
579
views
Mixed linear integer optimization - Optimize Profit based on different treatments to all the stores in R [closed]
I have 4 stores (1,2,3,4) and I can apply 3 treatments (A,B,C) to each of the 4 stores.
Each treatment has its own cost and profit.
The matrix is as follows:
Store Treatment Cost Profit
1 A ...
1
vote
2
answers
871
views
Linear programming with minimum and maximum fixed cost
I need your help in the following optimisation problem.
I have a maximisation Mixed Integer linear programming problem.
I would like to consider the minimum & maximum fixed fee.
I've done it in ...
0
votes
1
answer
651
views
How to read parentheses or brackets using CPLEX
I am trying to read a .lp file using CPLEX, and it is giving me an error 1615, which is not being able to read "(" or even "[". I am not happy with it because what I have needs to be read must have ...
1
vote
0
answers
510
views
CPLEX: lowest possible gap isn't necessarily 0.00%?
this is a follow-up question to this question: Interpretation of GAP in CPLEX
I used the following Expression at the beginning of my optimization (min) problem:
execute gapTermination {
cplex....
0
votes
1
answer
735
views
How to write the following objective function in Gurobi?
The following is the objective function:
I have the following Java code:
// Create list of variables
List<GRBVar> varList = new ArrayList<>();
// Set objective: maximize log(p) * x
...
0
votes
3
answers
120
views
Mixed Integer Program in Python
I have a MIP Problem that I need to output in Python. See the following attempt so far. I just need few suggestions that would point me in the right direction.
digits = [("00"+str(x))[-3:] for x in ...
9
votes
1
answer
2k
views
How to ask for second best solution to a MIP using JuMP
I have a Mixed Integer Programming problem.
I can use JuMP to find the optimal solution.
But how can I find the second best solution?
Or the third-best etc.
This potentially might be another equally ...
0
votes
1
answer
225
views
Mixed integer programming looping
I have a mixed integer program with 25 constraints with three subscript variables. There are two types of variables one are integer and one are binary.
Integer variables are called Axyz and binary are ...
0
votes
1
answer
229
views
Linprog Python - Implementing binary numbers
I have multiple constraints and they are straight forward to enter in linprog, but I have two constraints that has a binary component in them. Following is the one:
1 or 0 is Nabc
Mabc - 11(1) <= ...
1
vote
1
answer
333
views
How to write a simple MPS file to submit to NEOS servers
I'm trying to find an open source lp solver that is fast enough to my problem. I'm trying to build a MPS file so I can submit it to NEOS servers and compare the performance of different solvers.
My ...
1
vote
2
answers
4k
views
Mixed Integer Programming IF-THEN with Logical AND operation
I have the following constraint I'm trying to model in Mixed Integer Programming with Python's PuLP module:
Given linear programming variables: x1,x2,y1,y2 where x1, x2, y1, y2 eventually solve to ...