This predicate finds start times for a set of tasks, which minimise the value of a given cost function.
The cost function is the only information the search algorithm can use to focus on the optimum. It cannot guide the search if the cost is a variable, only linked to the tasks start times by constraints. For this reason the cost function admits the special functions abs and maxlist.
The syntax for cost functions is:
CostFunction ::- PosExpr | PosExpr + PosExpr | Integer * PosExpr PosExpr ::- abs(LinearExpr) | maxlist([LinearExpr]) | LinearExpr.
The algorithm is described in more detail in the documentation of probe_cstr_sched/7.
probe_schedule(Starts,CostFun) :-
	Starts=[X,Y,Z],
        ic:(Starts::1..10),
        Durations=[10,5,5],
        Resources=[R1,R2,R3],
        ic:(R1::1..2), R2=2, R3=1,
        MaxResource=2,
        [OldX,OldY,OldZ]=[1,5,5],
        CostFun= abs(X-OldX)+abs(Y-OldY)+abs(Z-OldZ),
	probe_sched(Starts,Durations,Resources,MaxResource,CostFun).