maybe:
for veh in range(0, num_vehicles):
for node in range(num_nodes):
index = routing.NodeToIndex(node)
dimension_name.SetCumulVarSoftupperBound(index, 10000, 100)
Note the penalty is multiplied by the miss. So if the value is 10001,
the miss is 1 and the penalty is 100. If the value is 11000, the miss
is 1000 and the penalty is 100000. So don't set the penalty too crazy
high or the solver might end up treating this as a hard constraint.
Or worse, hit an overflow error.
Regards,
James
On Fri, Aug 06, 2021 at 09:47:35PM +0530, dhiraj shanbhag wrote:
> Let's assume my vehicle drops and pickups items during the route.
> So, I have a dimension that keeps track of the current load in the vehicle.
> The cumulVar goes up and down.
>
> So, If the vehicle's max capacity is 1000kg, I can assign that value while
> creating the dimension. But this makes the solution infeasible in some
> cases.
> So, I want to put 2000 kg as the max load but assign a soft upper bound
> with a high penalty. like :
> *dimension_name.SetCumulVarSoftUpperBound(index, 1000, 10000000000)*
> so, beyond 1000 kg load at any point during the route a penalty will be
> assigned.
>
> *I have used this at the start and end node using routing.End(veh)/
> routing.Start(veh), how can I implement this over all the nodes of the
> route.*
>
> for veh in range(0, num_vehicles):
> index_end = routing.End(veh)
> dimension_name.SetCumulVarSoftLowerBound(index_end, 10, 10000000000)
>
> --
> Regards,
> dhiraj d shanbhag
>
> --
> 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.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/or-tools-discuss/CA%2BMtg5isageQf7oKnAtAoZGULDr0NHT-O1VSJnSb2%2BgJ2ABhZg%40mail.gmail.com.
--
James E. Marca
Activimetrics LLC