Skip to main content

How to set the priority of certain types of decision variables in Gurobi

Awaiting user input

Comments

3 comments

  • Ronald van der Velden
    Gurobi Staff Gurobi Staff

    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
  • Ariel W
    Curious
    Conversationalist

    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
  • Ronald van der Velden
    Gurobi Staff Gurobi Staff

    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,
    Ronald

    0

Please sign in to leave a comment.