Dimension with Global Span Cost Coefficient vs Disjunction on Node

322 views
Skip to first unread message

Alexandre Domingues

unread,
Sep 19, 2018, 12:14:20 PM9/19/18
to or-tools-discuss
Hello

I'm solving the following (common) routing problem: 
I have several nodes that I need to visit but I can't visit them all due to a capacity/time constraint. 
Each node also has a profit associated, I want to maximize this profit (while minimizing the route distance).

I have found two distinct ways to model this:

1) Add a new dimension to the problem where each node i contributes with (max_profit - profit_i), and then set a positive global span cost coefficient to this dimension (SetGlobalSpanCostCoefficient() in Python).
This way the solver will try to minimize the difference between maximum possible profit and actual profit.

2) Add a disjunction to each node i (AddDisjunction([i], value_i) in Python) where value_i is the profit associated to each node. This way, the cost associated to not visiting the node is added to the global cost.

Let me know if posting the actual code for both examples would help.

Both options 1) and 2) seem to work on a dummy example but I would like to know which is better for this type of problem.

Thank you

Alexandre Domingues

unread,
Sep 19, 2018, 12:19:02 PM9/19/18
to or-tools-discuss
I realize now that maybe I wasn't clear enough on my question. 

I have no problems on the implementation of the actual routing problem and capacity/time constraints. 
My question concerns only the third constraint, the profit that needs to me maximized.
Reply all
Reply to author
Forward
0 new messages