| Overview | Group | Tree | Graph | Index | Concepts |
This macro defines a function that returns an instance of the class
IlcTransitionCostObject. Such an object can
be passed to the function IlcUnaryResource::addNextTransitionCost or
IlcUnaryResource::addPrevTransitionCost. In that case, the
object defines a transition cost function to be used by the sequence
constraint on the invoking unary resource.
Notice that this transition cost is constant, that is, only the function
IlcTransitionCostObject::getTransitionCost is
defined and any call to IlcTransitionCostObject::getTransitionCostMin or
IlcTransitionCostObject::getTransitionCostMax
raises an error. Also note that the setup and teardown costs are zero.
Example
The call IlcTransitionCost(functionName) defines the
following function:
IlcTransitionCostObject functionNameObject(IloSolver s);
The argument functionName should be a pointer to a function
that takes two instances of the class IlcResourceConstraint as its arguments and returns an
integer. Here is an example of such a function:
IlcInt myTransCostFct(const IlcResourceConstraint rct1,
const IlcResourceConstraint rct2)
{
return IlcAbs(rct1.getActivity().getTransitionType() -
rct2.getActivity().getTransitionType());
}Now using that function and the call
IlcTransitionCost(myTransCostFct), we can define the following
function:
IlcTransitionCostObject myTransCostFctObject(IloSolver s);
This function can be used to define a transition cost for a unary
resource resource:
IlcUnaryResource resource(schedule); s.add(resource.makeSequenceConstraint()); resource.addNextTransitionCost(IlcTransitionCost(myTransCostFct);
See Also: