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
votes
1 answer

Optimize a function in R with integer input vector which adds to a certain value

I have a function in R fun that returns the cost of decision vector x. The input to the function is an integer vector of length 40. Given input vectors a, b, and c (also of length 40), the function is defined as: fun <- function(x) sum(pmax(a, b,…
-1
votes
1 answer

IF THEN CONSTRAINTS

I have the next two if-then constraints 1.- IF x1+y2-n >= 0 THEN m2=0, ELSE m2=1 Where x1, x2 are discrete, n is a constant and m2 is a binary variable. IF 2x1 - y1 >= 0 THEN m1=0, ELSE m1=1 Where m1 is a binary variable. How transform this…
-2
votes
1 answer

How to specify constraint for columns with not all-zero values to equal each other in cvxpy

How would I specify a constraint so that the boolean 2-dimensional decision variable matrix has the following criteria: all the non-zero columns have to be identical If the matrix was a numpy array, we would be able to use np.all, but I don't see…
matsuo_basho
  • 2,833
  • 8
  • 26
  • 47
-2
votes
1 answer

Find common multiple of prime powers (2, 3, 5, 7...) > N and minimize the exponents

The reason I am doing this is to find a closest number higher than N, which is a common multiple of prime powers --- to be able to use FFTW. As I understand this is an optimization/linear programming problem. And I managed to formulate the …
-2
votes
2 answers

Write the code necessary to count the number of perfect squares whose value is less than h , starting with 1 .

Assume there is a variable , h already associated with a positive integer value. Write the code necessary to count the number of perfect squares whose value is less than h , starting with 1 . (A perfect square is an integer like 9 , 16 , 25 , 36…
user140739
-3
votes
1 answer

Find Disjoint Graph with Smallest Overall Cost

This is an optimization / minimum flow problem. For this directed graph, I would like all vertices to be visited exactly once, but this graph can exist multiple disjoint paths, and each path has constraints on its total cost. The goal of this…
1 2 3
20
21