FRAMES NO FRAMES

Class IlcTransitionTimeObjectI

Definition file: ilsched/schedule.h
Include file: <ilsched/ilsched.h>

The class IlcTransitionTimeObjectI defines a set of functions that calculate the transition time between resource constraints.

To define an IlcTransitionTimeObjectI class adapted to your needs, you have to encode the virtual functions declared in the IlcTransitionTimeObjectI class.

See Also:

Method Summary
public virtual IlcIntgetTransitionTime(const IlcResourceConstraint srct1, const IlcResourceConstraint srct2) const
Method Detail

getTransitionTime

public virtual IlcInt getTransitionTime(const IlcResourceConstraint srct1, const IlcResourceConstraint srct2) const

This virtual member function returns the transition time if the activity of resource constraint rct1 immediately precedes the activity of resource constraint rct2 in the sequence. By default, it raises an error.

Example

To define an IlcTransitionTimeObjectI subclass adapted to your needs, you have to encode the virtual functions declared in the IlcTransitionTimeObjectI class. To do so, you must define a subclass of the implementation class IlcTransitionTimeObjectI. In the subclass, you must then redefine the virtual member function getTransitionTime.


 class TransTimeObject: public IlcTransitionTimeObjectI {
 private:
   IlcInt _distance;
 public:
   TransTimeObject(IlcInt distance);
   IlcInt getTransitionTime(const IlcResourceConstraint rct1,
 			  const IlcResourceConstraint rct2)const;
 };

 TransTimeObject::TransTimeObject(IlcInt distance)
 :_distance(distance)
 {}

 IlcInt
 TransTimeObject::getTransitionTime
  (const IlcResourceConstraint,
   const IlcResourceConstraint) const
 {
   return _distance;
 }

 IlcTransitionTimeObject myTransTimeObject(IloSolver s, *
 					  IlcInt distance) {
   return new (s.getImpl()) TransTimeObject(distance);
 }

Now you can use this last function to define the transition time of a resource, like this:


 IlcUnaryResource resource(schedule,
 			  myTransitionTimeObject(solver, 2));