CSOLVER
Arguments: n-obj p-pts n-pts i-dst cnstr x-dst &optional data x-sol n-sols &[[rest]] merge [generic-function]
Searches solutions for the Music Constraint-Satisfaction Problem.
1. 'n-obj' is the number of objects.
2. 'n-pts' defines the number of points in each object.
1. 'n-obj' is the number of objects.
2. 'n-pts' defines the number of points in each object.
It can be
-A list of lists: The i-th sublist contains the options for the number of points in the i-th object. e.g. (3 4 7), admits objects having 3 4 or 7 points.
-A number: Gives the number of points for every object
-A flat list: Gives the options for every object.
If the [[length]] of 'n-pts' is less than n-obj, it is completed with default values according to the values in 'i-dst'.
3. 'i-dst' defines the possibles distances inside each object.
It can be a ([[flat]] or 2-level) [[list]] that defines the possible intervals for an object. For instance the list ( 3 4 7 11 ) defines objects having
(possibly repeated) consecutive distances from that list.
The list ((4 7 11) (10 12)) defines objects with distances EITHER from the [[first]] or [[second]] sublist.
When a sublist begins with the symbol 'f' distances are EXACTLY those given.
For instance, (f (4 7 11) (10 12)) defines either
(4 7 11) or (10 12) as the only possible distances inside the object, in that order.
If the length of 'i-dst' is less than n-obj, it is completed with its last value if any.
If 'i-dst' is NIL and no 'data' are given, 'i-dst' is set to (1 2 3 4 5 6 7) by default.
4. 'p-pts' defines the possible points contained by objects. It can be a list of lists, where the i-th sublist gives the possible points for the i-th object. It can also be composed of a sequence of object numbers followed by the possible points, as in (0_5 (57 61 62 63 67 69 71 73 74) 6_9 (27_127)).
If the length of 'p-pts' is less than n-obj, it is completed with its last value if any, else it is completed with '(0_120).
5. 'cnstrs' is the list of constraints for the problem.
6. 'x-dst' gives possible external distances between consecutive objects.
6. 'x-dst' gives possible external distances between consecutive objects.
The expression is as for i-dst, except that certain points of the object can be specified as those where the [[distance]] is to be measured.
For instance, (0_5 (l (7 11) u (1 2 3) 2 (4 5)) 6_9 (>5)) says that the first 6 points in the sequence should be so that
the distance between consecutive 'lower' points is equal to either 7 or 11,
the distance between consecutive 'upper' points should be either 1, 2 or 3,
the distance between consecutive '[[third]] lowest' points should be either 4 or 5 and, finally,
for the objects numbered 6 to 9, the distance between consecutive 'upper' (the default if nothing given) points
should be greater than 5 or less than -5.
6. 'n-sols' gives the number of solution required. Default is 1. -1 means all.
7. 'data' is a list of elements ( <index-list> <list of objects> )
7. 'data' is a list of elements ( <index-list> <list of objects> )
where <index-list> is the list of indexes of variables representing objects and <list of objects>
is the list of possible values (objects) for these variables. <index-list> can also be a single index.
8. 'x-sol' is an index representing a object number. Starting from this object,
(i.e. finding a new value for it, but keeping the values of previous objects, if possible) another solution is searched for.
'x-sol' can also be one of the following lists:
a. (index t) : Starting from the object represented by 'index', but IGNORING
ITS constraint, another solution is searched for.
b. ('b index) : Starting from the base of the object represented by 'index'
another solution is searched for.
c. ('i index) : Starting from the intervals of the object represented by 'index'
another solution is searched for.
d. ('b index t) or ('i index t) : Similar to b or c.,
except that the corresponding constraint (i.e. base constraint or interval constraint) are
ignored.
NOTE: 'x-sol' should be NIL unless at least one solution has already been found.
9,10,...Each of these entries represent a sub-problem ( given by the adjoint-problem box, see UserLib/Situation1.b menu )
to be adjoint to the current solved problem.
Every time only the last entry is considered, because we assume that the previous ones has been adjointed already.