I am still very new to Python, after years and years of Matlab. I am trying to use Pulp to set up an integer linear program.
Given an array of numbers:
{
You can set the lowBound and upBound on variables after the initialization. You can create an array of variables with
LB[i] <= x[i] <= UB[i]
with the following code.
x = pulp.LpVariable.dicts("x", RANGE, cat="Integer")
for i in x.viewkeys():
x[i].lowBound = LB_ind[i]
x[i].upBound = UB_ind[i]
The second parameter to LpVariable.dict is the index set of the decision variables, not their lower bounds.
For the first question, you can do it like this in some other problem.
students = range(96)
group = range(24)
var = lp.LpVariable.dicts("if_i_in_group_j", ((i, j) for i in students for j in group),cat='binary')