Task optimize

This task is not compulsory. If there is no rule to optimize the solution, the task is empty. The only rule which is applicable in this case transfers the activity to the task success. If knowledge how to replace a particular allowed combination of parameter values by another allowable combination of values of these parameters is available, it can be expressed by the rule:
(defrule opti-<order number>
(job optimize)
...
=>
...
)
which modifies the values of one or several parameters (by the actions contained in its action part).

If more rules are applicable, in general it is possible to use an arbitrary rule from the set of applicable rules. On the other hand, these rules can differ from one another by their priority. Another possibility is to define an additional parameter which guarantees that only one rule from a group of rules can be fired (the used rule sets this parameter in such a way that the condition parts of the other rules from the group are not satisfied any more).

The rules of this task try to maximize or minimize some variable which can be (but it is not a rule) represented by a parameter. Since the value of this parameter does not make sense in the previous tasks, the parameter has not been active until now. Thus, it is time to activate it:

(defrule opti-aktiv
(declare (salience 30))
(job optimize)
=>
(send [optim] put-active yes)
)
This rule has to be fired as the first rule within the task (it is given by its high priority). To compute the value of the param optim there should be a rule which is fired if this parameter is activated or if the solution is changed. Thus this rule has the form:
(defrule opti-value
(declare (salience 40))
(job optimize)
(object (is-a parameter) (param-name optim) (active yes))
...
=>
(send [optim] put-param-value (optim-value ?b ... ))
)
which first computes the values of those parameters on which the parameter optim depends and then computes the value of the parameter optim and assigns this value to the slot param-value of the parameter optim.