[rules-users] Planner: Vehicle Routing, but with return to home after last delivery
Geoffrey De Smet
ge0ffrey.spam at gmail.com
Thu Sep 27 04:09:23 EDT 2012
The vehicle routing example has this, which should be easy to modify to
what you need:
rule "distanceFromLastCustomerToDepot"
when
$customer : VrpCustomer(previousAppearance != null)
not VrpCustomer(previousAppearance == $customer)
then
VrpVehicle vehicle = $customer.getVehicle();
insertLogical(new
IntConstraintOccurrence("distanceFromLastCustomerToDepot",
ConstraintType.NEGATIVE_SOFT,
$customer.getDistanceTo(vehicle),
$customer));
end
Op 27-09-12 10:03, jimirn schreef:
> Hi all,
>
> I have changed the Vehicle Routing example to suit my domain model.
>
> My domain is:
> - Consultant (the person that will drive to a DeliveryPlace and spent some
> time there, each Consultant has a max total time available, implements
> Appearance)
> - DeliveryPlace (the place where a Consultant will drive to and spent some
> time making a delivery, implements Appearance)
> - Location (a Consultant has a home and a DeliveryPlace has a location)
>
> I need the soft constraints to take into account returning from last
> DeliveryPlace to the home location of the Consultant.
>
> But how do I know if a DeliveryPlace is the last one so I can add that to
> the rule ?
>
> Right now I have a rule that just takes each DeliveryPlace and calculates
> minutes to previousAppearance:
>
> rule "minutesToPreviousAppearance"
> when
> $deliveryPlace : DeliveryPlace(previousAppearance != null,
> $minutesToPreviousAppearance : minutesToPreviousAppearance)
> then
> insertLogical(new
> IntConstraintOccurrence("minutesToPreviousAppearance",
> ConstraintType.NEGATIVE_SOFT,
> $minutesToPreviousAppearance,
> $deliveryPlace));
> end
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Planner-Vehicle-Routing-but-with-return-to-home-after-last-delivery-tp4019990.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
More information about the rules-users
mailing list