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

Squaring A Decision Variable in Mosel

in my problem, I want to minimize the sum of the square of a decision variable * LARGE_CONSTANT. The reason for square is to incentivize the solver to spread the decision variable around equally; if I have to use the panic variables, I want to use…
1
vote
1 answer

Run callback only at the root node

I'm solving an integer linear programming problem with CPLEX 12.7 using a branch-and-cut framework. I'm using the CPLEX callable library in C++. Therefore, I implemented an UserCutCallback callback. However, it takes a very long time to separate my…
1
vote
1 answer

Understand price optimization using PuLP and formulate problem

I am trying to write a small price optimization engine that optimizes revenues given a list of articles. I have a list of articles and for each of them, I have its price elasticity of demand. My constraints are currently not defined, however, there…
1
vote
2 answers

Algorithm to find some rows from a matrix, whose sum is equal to a given row

For example, here is a matrix: [1, 0, 0, 0], [1, 1, 0, 0], [1, 0, 1, 0], [1, 1, 1, 0], [1, 1, 1, 1], I want to find some rows, whose sum is equal to [4, 3, 2, 1]. The expected answer is rows: {0,1,3,4}. Because: [1, 0, 0, 0] + [1, 1, 0, 0] + [1, 1,…
1
vote
0 answers

What does "TypeError: G must be a 'd' matrix" mean in "cvxpy"?

I am trying to get the solution for the Sudoku binary integer programming (BIP) problem. I am modelling it as: Grid: 2D 9x9 list, each with 9 binary variables. Constraints: standard sudoku rules Objective: Maximize(1) Initial values: none, i just…
wolfram77
  • 2,841
  • 3
  • 23
  • 33
1
vote
1 answer

Is there a way to make cvxpy timeout

I'm using cvxpy to solve an integer programming problem. For feasible solutions, the .solve() method for cvxpy returns in a few tenths of a second. For infeasible solutions, it can take 30+ seconds for cvxpy to return "infeasible". …
user2558918
  • 103
  • 1
  • 2
  • 4
1
vote
0 answers

Select the best team (11 players out of 200 players) optimization with pandas

I am trying to develop a code to select the best 11 possible players out of 200 players. I have developed a spreadsheet with the players prices and points so far and imported it to a DF using Pandas as below, import pandas as pd import numpy as…
1
vote
1 answer

Linear programming : how to turn a decision variable (binary) as 1 if values in an array exceeds a certain threshold

I have an array which holds a linear expression in terms of decision variable. Let's say decision variables take values such that the array = [1.7 , 0.3, 0]. Now what I want is the following : 1) If any of the values from the above array is > 0.5,…
1
vote
0 answers

Solving a Pure Integer Linear Programming (PILP) in Lingo

I am trying to solve a PILP model in Lingo. There are total of 138 integer variables, 211 integer constraints in the model. I have a maximization objective. However, this model is taking a very long time (Its already 9hours 5minutes since I gave the…
1
vote
2 answers

Error during integer programming with pulp: 'LpVariable' has no len()

Trying to solve the Blending and Mixing problem to exercise optimization with python (using gurobi and pulp). Sadly I ran into the following error message: python Blending_problem.py Traceback (most recent call last): File "Blending_problem.py",…
cheesus
  • 1,111
  • 1
  • 16
  • 44
1
vote
1 answer

is there a maximum variable size in GLPK?

I'm looking into using GLPK to solve a ILP. Some of my constraints have the following form I * W <= A Where I is the variable and W and A are constants. W though, could be very, very large. An example value might be 2251799813685248, and may be…
HXSP1947
  • 1,311
  • 1
  • 16
  • 39
1
vote
1 answer

cplex sos type 1 add

So just one quick question - I'm trying to implement a SOS type 1 probelm in CPLEX. When I look at the documentation I see the add function add(self, type='1', SOS=SparsePair(ind = [0], val = [0.0]), name='') Adds a special ordered set constraint to…
Eigenvalue
  • 1,093
  • 1
  • 14
  • 35
1
vote
1 answer

Automate shift times whilst accounting for constraints

I have a script that produces automated shift times based on availability and various constraints. These being: At any given time period, you must meet the minimum staffing requirements A person has a minimum and maximum amount of hours they can…
jonboy
  • 415
  • 4
  • 14
  • 45
1
vote
3 answers

Matlab optimproblem: Possible to use 3rd party ILP solver?

I've been browsing the Matlab's [mixed] integer linear program ([M]ILP) commands/classes documentation to see if there is a way to define an "optimization problem" (optimproblem) and call out to an external [M]ILP solver using an API rather than…
1
vote
1 answer

TSP / CPP variant - subtour constraint

I'm developing an optimization problem that is a variant on Traveling Salesman. In this case, you don't have to visit all the cities, there's a required start and end point, there's a min and max bound on the tour length, you can traverse each arc…
Ralph
  • 255
  • 2
  • 18