Specific order

264 views
Skip to first unread message

emreer...@gmail.com

unread,
Jan 22, 2018, 5:06:11 AM1/22/18
to or-tools-discuss
Hi all,

I want to optimize some of vehicles, so a few orders must be moved with certain vehicles. How can i add this as constraint to solver? Is it possible?

Vincent Furnon

unread,
Jan 22, 2018, 12:45:52 PM1/22/18
to or-tools...@googlegroups.com
Do you mean you want to constrain some orders to be delivered by a subset of the vehicles ? If yes just limit the domain of the VehicleVar of the order to the indices of the vehicles which can perform it.

On Mon, Jan 22, 2018 at 11:06 AM, <emreer...@gmail.com> wrote:
Hi all,

I want to optimize some of vehicles, so a few orders must be moved with certain vehicles. How can i add this as constraint to solver? Is it possible?

--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

emreer...@gmail.com

unread,
Jan 23, 2018, 2:00:29 AM1/23/18
to or-tools-discuss
Hello Vincent,

Yes, that's exactly what I want to do. How can i limit the domain of the VehicleVar of the order to the indices of the vehicles? Can you explain with a few lines of code?

Thanks for quick response.


On Monday, January 22, 2018 at 8:45:52 PM UTC+3, Vincent Furnon wrote:
Do you mean you want to constrain some orders to be delivered by a subset of the vehicles ? If yes just limit the domain of the VehicleVar of the order to the indices of the vehicles which can perform it.
On Mon, Jan 22, 2018 at 11:06 AM, <emreer...@gmail.com> wrote:
Hi all,

I want to optimize some of vehicles, so a few orders must be moved with certain vehicles. How can i add this as constraint to solver? Is it possible?

--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.

emreer...@gmail.com

unread,
Jan 23, 2018, 3:38:51 AM1/23/18
to or-tools-discuss
Hi Vincent,

I handled my problem as you said. It's very simple(model.VehicleVar(order).SetValue(vehicle)).

Thanks a lot buddy.

Gwénaël Rault

unread,
Jan 23, 2018, 9:46:51 AM1/23/18
to or-tools-discuss
Hello,

Juste a simple advice, for more a scalable solution, you should not remove the value -1 (no vehicle) from the VehicleVar. In the case where one of your node can't be inserted because of constraints, you should allow to unassign it.

emreer...@gmail.com

unread,
Jan 24, 2018, 1:41:22 AM1/24/18
to or-tools-discuss
Hello Gwénaël,

My goal is double or more optimize our data, in first optimization i wont remove the value -1 from the VehicleVar. But in second optimization with same data with extra few orders I need to re-optimize while maintaining my first optimized state. Would that be a problem though? Thanks for your advice.

Gwénaël Rault

unread,
Jan 24, 2018, 5:16:07 AM1/24/18
to or-tools-discuss
If your solution is feasible, you probably won't encounter any problem ;)

Conner Westover

unread,
Jan 24, 2018, 5:11:00 PM1/24/18
to or-tools-discuss
Just for some clarification. You are doing model.VehicleVar(order).SetValue(vehicle) where you pass in every vehicle that can take this order? I am working in C# Or-Tools if that makes any difference.

Thanks,
Conner

Vincent Furnon

unread,
Jan 25, 2018, 4:43:15 AM1/25/18
to or-tools...@googlegroups.com
SetValue binds the variable to a single value. To bind it to multiple values, use SetValues passing an array of values. 

To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discuss+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages