Python, MIP optimization

I am using MIP package in python to solve an optimization problem and I am trying to get continuous values between 0 and 1. However, the returned values of x are binary {0,1}. Here is the code:

m = Model(sense=MAXIMIZE, solver_name=GRB) x = [m.addVars('x',lb = 0, ub =1, var_type=CONTINUOUS) for i in I] m.objective = maximize(xsum(w[i]*x[i] for i in I)) m += xsum(t[i] * x[i] for i in I) <= 10000    for i in I:     m += Tc[i] + t[i] <= T  m.optimize(relax=True) selected = [i for i in I if x[i].x >= 0.5] 
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.