How to set the priority of certain types of decision variables in Gurobi
Awaiting user inputIn my model, s[v,i,j] and w[d,i,j] represent whether vehicle v operates trip j after trip i, and driver d operate trip j after trip i, respectively, they are all binary variables. I want to give priority to assigning trips with smaller serial numbers to vehicles and drivers, if they satisfy corrosponding constraints. but how can i achive this purpose as I am not clear how gurobi searches and determines these decison values?
-
In general the approach would be to include your preference in the objective function. However, I'm wondering if trips can be left unassigned in your model or not? If they can, then you could include the s or w variables in the objective with higher weights on the trips with smaller serial numbers.
0 -
Dear Sir, Thanks for your reply. I still have some questions below, which hope for your gentle advises.
Q1: In my model, trips need to be all assigened. How this situation will be solved?
Q2: And how to set weights to s or w variables in the objectives?
Q3: what if some decision variables are not in the objective?
0 -
Hi Ariel,
Q2: You can do this when calling addVars() in Gurobi, or by setting the Obj attribute on the individual variables
Q3: Then the value of that variable does not influence the optimal solution
Q1: You will need additional constraints, but not just for this - you'll also want to avoid subtours and solve other issues. I would suggest searching for "vehicle routing problem" on this forum, and have a look at this notebook. Then if you have specific questions, please share your model formulation and code here so we can build on that.
Kind regards,
Ronald0
Please sign in to leave a comment.
Comments
3 comments