Questions tagged [integer-programming]

Solving systems of linear equations where variables are integers.

An integer program is a problem where, in addition to the linear inequalities constraints, the variables are also constraint to be integers only.

While can be solved in polynomail time, integer-programming is NP-hard.

A good solver for such optimization problems is lp_solve. See also GLPK (http://www.gnu.org/software/glpk/) and CBC (https://projects.coin-or.org/Cbc)

However, for large or hard instances you may need a commercial solver such as CPLEX or Gurobi.

For more information see wikipedia.

307 questions
1
vote
1 answer

Discrete optimization - selecting exactly N items from each row and column of a score matrix

Given a matrix of scores, I'd like to select exactly n elements from each column and each row such that the total score of the selected elements across the entire matrix will be as high as possible. Example: given the cost matrix…
1
vote
1 answer

Traversing the elements of set in a set of tuples using OPL

I am trying to model a problem using OPL, cplex. I got stuck at a constraint. I have a set of tuples in the format: N_set = { <1, {180}> <8, {546, 154}> <11, {193, 532, 43, 363}> ... }; So I basically try to use a map structure. Given an…
begumgenc
  • 393
  • 1
  • 2
  • 12
1
vote
1 answer

Build MILP constraint from if-else statements

I need to build a MILP (Mixed integer linear programming) constraint form this if-else statement: with beta is a constant. if (a > b) then c = beta else c = 0 How can I build the statement to MILP constraint. Are there any techniques for solving…
1
vote
1 answer

In an ILP problem, is it possible to constrain/penalize the number of decision variables used?

I'm trying to setup minimization problems with restrictions on the number of decision variables used. Is it possible to do this within a linear programming framework? Or am I forced to use a more sophisticated optimization framework? Suppose all…
1
vote
1 answer

How to avoid scheduling conflicts for a timetable problem

I'm trying to create a schedule for shifts for each employee given employee shift availability. I have a tuple defined to include shift start time, shift end time, max people on shift. The input also includes a list of arrays for employee shift…
John Lee
  • 35
  • 4
1
vote
1 answer

Adding binary variable in Gurobi

So I want to add a binary variable z where z[i, j] = 1 when the distance between i and j are less than or equal to 150 and z[i, j] = 0 otherwise. I have a list c where each c[i][j] represents the distance between i and j. I certainly can't set up z…
1
vote
1 answer

Ortools setting constraints while solving

I am using CP-SAT solver from ortools https://developers.google.com/optimization/cp/cp_solver I am executing the solver with a callback object solver = cp_model.CpSolver() solution_agg = SolutionCollector(data, self.variables, self.products,…
Trion
  • 500
  • 5
  • 11
1
vote
1 answer

Pulp & coin-or-cbc: What are the meaning of SOS weights?

When defining a mixed integer linear programming problem using pulp, one may define sos like so: x1 = LpVariable('x1', cat = LpInteger) x2 = LpVariable('x2', cat = LpInteger) prob.sos1['sos'] = x1 + 2*x2 (an "sos", or specially ordered set, is a…
1
vote
1 answer

GAMS Error: Endogenous function arguments not allowed in linear models

I am trying to solve in GAMS for the binary variables using MIP but am constantly getting an error. I am unable to understand the reason. Anyone got a solution? Set i cities /1*7/; Binary variables z1,z2,z3,z4,z5,z6,z7 1 if selected and 0…
Shraddha Avasthy
  • 161
  • 3
  • 13
1
vote
0 answers

Lindo syntax error for division

I have tried adding parenthesis to the code but lindo gives an error stating that its a variable. According to lindo documentation "(" should be accepted as a parenthesis but this does not occur. Removing the parenthesis causes the code to terminate…
1
vote
1 answer

Coverage matrix to covering constraints in Python Gurobi

Let C be a binary covering matrix for a set covering problem, and I want to convert this into the appropriate covering constraints in Gurobi. I've managed to get it to work using scipy.csr_matrix, but the process seems slow. I'm wondering if there's…
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
1 answer

Solving integer programs in Python with PuLP

I am working on a Python package for computing several NP-Hard graph invariants. The current version of the package uses brute force for nearly all of the algorithms, but I am very interested in using integer programming to help speed up the…
damos
  • 81
  • 7
1
vote
0 answers

Should solvers be used for optimizations cases requiring data creation?

I am working on solving an optimization problem that has grounds in employee rostering. The problem is: I have Staffing levels(number of employees needed in a particular hour and this is for whole day ie 24 columns). I have Working time rules…
Sachin Verma
  • 3,712
  • 10
  • 41
  • 74
1
vote
0 answers

How do I get the minimum positive value over a set of integer expressions?

I have a model with the following condition: z[i] = min{t*x[i][t] | x[i][t] = 1}, x[i][t] - boolean, z[i] - integer Which means I am trying to find a minimum positive value over a set of integer expressions. The "min" condition can be easily…