0

I am trying to solve the following optimization problem:

Objective function is : min 11+22

Constraints: 1+4∗2>=50 and 1>=0,2>=0

This is a linear example. So we use linprog() function. The answer needs to be an integer, how do I set up constraints so the answer is not a decimal?

import numpy as np
from scipy import optimize
c = [1, 2]
A = [[-1,-4]]
b = -50
x_bounds = (0, None)
y_bounds = (0, None)

result = optimize.linprog(c, A_ub = A, b_ub = b, bounds=[x_bounds, y_bounds] )
print(result)

1 Answers1

1

It is not possible to make integer programming with scipy. This problem has already discussed. Please check this post :post