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
3
votes
2 answers

Why is this mixed integer program so inefficient to solve?

I'm trying to solve a MIP using GLPK and CBC, and neither solver can efficiently find the solution. The GLPK solver log shows that it quickly finds a solution that is within 0.1% of the true optimum, but then takes forever trying to find that true…
thomaskeefe
  • 1,900
  • 18
  • 19
3
votes
1 answer

Suggesting a lower bound for an ILP solver

I have an integer linear programming problem that takes very long to solve by the solvers I've tried (CPLEX, CBC), even though they find the optimal solution early on. They just take forever to fully prove it. It's easy to calculate a trivial lower…
3
votes
5 answers

Minimizing the sum of 3 variables subject to equality and integrality constraints

I am working on a programming (using Python) problem where I have to solve the following type of linear equation in 3 variables: x, y, z are all integers. Equation example: 2x + 5y + 8z = 14 Condition: Minimize x + y + z I have been trying to…
n.nasa
  • 551
  • 2
  • 5
  • 21
3
votes
0 answers

finding least-squares integer solutions to a linear system with numpy/sympy

I need to solve a system of linear diophantine equations with either numpy or sympy. Is there any way to constrain numpy's linalg.solve/linalg.lstsq method to return only integer solutions? (probably not but thought I should ask) I looked into…
Anthony Chung
  • 1,467
  • 2
  • 22
  • 44
3
votes
1 answer

How many decision variables can be solved for Mixed Integer Programming?

I have a Mixed Integer Programming problem(binary integer variables), how many variables can I solve, i.e, upper limit and what would be time taken? The problem would have a utmost 5 constraints and a minimisation cost function, but variables are…
3
votes
2 answers

Gurobi Optimizer: determining feasibility without optimizing the model

In Gurobi, is it possible to see if a group of constraints and variables are feasible without actually optimizing the problem? It seems if the objective is a constant, Gurobi still does a lot of heavy computation to find an optimal solution, which I…
mnmp
  • 380
  • 2
  • 15
3
votes
2 answers

Python - The integer linear programming (ILP) function in CVXOPT is not generating correct results

I'm trying to solve the simple example found in https://en.wikipedia.org/wiki/Integer_programming#Example using the CVXOPT library on Python 2.7 ; The optimal answers are either (1,2) or (2,2). I'm getting (0.0 , 0.0). What am I doing wrong in the…
John
  • 33
  • 1
  • 4
3
votes
1 answer

Python Pulp Integer Linear Program with dynamic constraint

I want to solve a mixed integer linear program with the following objective function: J = maximize (f1(x) + f2(x)) subject to constraint: cost(x) <= threshold where x is the set of selected variables, f1 and f2 are two scoring functions and cost is…
CentAu
  • 10,660
  • 15
  • 59
  • 85
3
votes
1 answer

keep cutting without branching in MIP solver (Gurobi)

I have a MIP which I know the solution almost for certain. I want to use gurobi to prove that the true solution (even if it is not the one I provide) shall not lie more than 0.5% deviated from the solution I gave. I believe that simply keeping the…
3
votes
1 answer

How to restrict the number of zeros in constraint programming

For a given n and m I iterate over all n by m partial circulant matrices with entries that are either 0 or 1. I want to find if there is a matrix such that there are no two subsets of the columns that have the same sum. Here when we add columns we…
Simd
  • 19,447
  • 42
  • 136
  • 271
3
votes
1 answer

How to schedule different types of planks to form bridges

Suppose we want to walk from place $A$ to place $B$, but there are several rivers between them. In order to walk from place $A$ to place $B$, we need to build a bridge for each river. We have several types of planks. Different types of planks have…
wzb5210
  • 735
  • 2
  • 9
  • 16
3
votes
2 answers

cplex boolVarArray giving double values

I have been trying to implement an ILP using CPLEX Java and have been stuck at a problem for a long time. Here are few variables of the ILP: IloIntVar above = new IloIntVar[numRect][]; IloIntVar below = new IloIntVar[numRect][]; IloIntVar left = new…
2
votes
2 answers

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 minimizes the following function: abs(sum(x2 - x1 >…
Edward
  • 10,360
  • 2
  • 11
  • 26
2
votes
1 answer

How to set Gurobi to stop after the objective value reaches a certain threshold in Julia?

I am trying to run a minimization problem for an MIP using Gurobi in Julia. I would like it to stop after it has found a solution that is below a certain threshold that I have set. I have found ways online to do this in other programming languages,…
2
votes
2 answers

How to use CP-SAT solver or other tools to find 3D arrays with constraints on rows, columns and tubes (representing school classes, terms and days)?

I will be grateful to anyone who can help me write some Python code to enumerate the 21×2×3 arrays, indexed with i, j and k, which are two-thirds filled with 0's and one-third filled with the values 'Ava', 'Bob', 'Joe', 'Mia', 'Sam', 'Tom', 'Zoe' in…
1 2
3
20 21