Reputation: 11
I have an integer programming problem with a decision variable X_i_j_k_t
that is 1 if job i
was assigned to worker j
for day k
and shift t
. I am maximizing the benefit of assigning orders to my workers. I have an additional binary variable Y_i_k_t
that is 1 if the job was executed and a given day and shift (jobs might require more than one worker). How can I add this variable in CPLEX? So as to form, for example, sum(i, k, t)(Y_i_k_t) <= 1
(the order can´t be done more than once).
Thank you in advance
Upvotes: 1
Views: 2095
Reputation: 5940
You did not say whether you use the CPLEX Python API or docplex. But in either case, you can call the functions that create variables multiple times.
So in the CPLEX Python API call Cplex.variables.add()
again to add another set of variables.
In docplex just call Model.binary_var_dict()
(or whatever method you used to create X
) again for the Y variables.
Upvotes: 1