| IBM ILOG Dispatcher User's Manual > Developing Dispatcher Applications > Developing Your Own First Solution Heuristics > Using the Dispatcher First Solution Framework > Creating the decision class |
Creating the decision class |
INDEX
PREVIOUS
NEXT
|
First, you create your decision class PDPDecision. This is a subclass of IloPairDecisionI, an abstract class that is a subclass of IloSingleVehicleFSDecisionI, involving one vehicle, and a pair of pickup and delivery visits. This class is dedicated to PDP heuristics.
The abstract class IloSingleVehicleFSDecisionI handles decisions concerning one vehicle. To simplify the decision comparison process, a cost is associated to decisions, computed by a new virtual member function called evaluate. Subclassing from this class requires you to define an evaluate member function. In addition, you will also define the following member functions: make, calcFeasibility, and display.
The constructor for PDPDecision takes three parameters: a vehicle, a pickup visit, and a delivery visit.
PDPDecision ::PDPDecision(IloVehicle vehicle, IloVisit pickup, IloVisit delivery) : IloPairDecisionI(vehicle, pickup, delivery) {} |
The function make performs the decision. It is called after a decision has been selected and checked for feasibility.
The evaluate member function computes a cost that is used to select a best decision to execute. Decisions with the lowest cost are preferred.
The calcFeasibility member function is used to filter infeasible decisions before calling solver.solve to save CPU time.
The display member function displays the decision object.
void PDPDecision::display(ostream& os) const { os << "[<-" << getPickup().getName() << ".(" << getVehicle().getName() << ")." << getDelivery().getName() << "->]" ; } |
| © Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |