|
Vars
.
The variable being optimised is Opt
.
rc_prune_all(Vars,min,Opt) :- % get the current minimum value eplex_get(cost,Curr), ( foreach(Var,Vars), param(Curr,Opt) do % apply reduced cost pruning to each variable rc_prune(Var,min,Curr,Opt) ). |
Curr
, and then we apply
reduced cost pruning to each variable in the list. This is achieved
as follows:
rc_prune(Num,_,_,_) :- nonvar(Num), !. rc_prune(Var,min,Curr,Opt) :- eplex_var_get(Var,reduced_cost,RC), ( RC =:=0.0 -> true ; % if the variable is still uninstantiated and has a % non-zero reduced cost restrict its domain eplex_var_get(Var,solution,Val), ic: ((Var-Val)*RC+Curr $=< Opt) % cons5 ). |
cons5
, which prevents
it from changing so far that the optimum Opt
exceeds its upper bound.
For maximisation problems a different constraint would be imposed.post
goal.
This is a goal that is executed immediately after each waking of the
linear solver.
test(X,Y,Z,Opt) :- % set up variable bounds ic: ([X,Y,Z]::1..10), ic: (Opt:: -1.0Inf..1.0Inf), % setup constraints eplex: (5*X+2*Y+ Z $>= 10), eplex: (3*X+4*Y+5*Z $>= 12), % setup the linear solver with reduced cost recording enabled % and a post goal to perform reduced cost pruning eplex:eplex_solver_setup( min(X+Y+Z), Opt, [sync_bounds(yes),reduced_cost(yes)], [new_constraint,inst, post(rc_prune_all([X,Y,Z],min,Opt))] ), % label the variables labeling([X,Y,Z]). |
reduced_cost_pruning/2
available in the eplex library.)overlap
constraints used in the first example above. All the constraints can
therefore be handled by eplex alone.
However the probing algorithm does not send the resource constraints
to eplex.
Instead it takes the start times returned from the optimal eplex
solution, and computes the associated resource profile.
The resource bottleneck is the set of tasks running at the time the
profile is at its highest.before
constraint
(defined in the example above) between one task and the start time of
another.before
constraints, and so the
algorithm is complete and terminating.post
goal as follows:
eplex_to_tent(Expr,Opt) :- eplex_solver_setup( Expr, Opt, [sync_bounds(yes),solution(yes)], [ new_constraint,post(set_ans_to_tent) ] ). set_ans_to_tent :- eplex_get(vars,Vars), eplex_get(typed_solution,Solution), Vars tent_set Solution. |
Three kinds of information can be used Reduced costs allow values to be pruned from variable domains. The solution can be checked for feasibility against the remaining constraints, and even if infeasible can be used to support search heuristics. Dual values are used in other hybridisation forms, devised by the mathematical programming community.
- Reduced Costs
- The solution (the value for each variable at the linear optimum)
- Dual values
Figure 17.4: Using information returned from the linear optimum