Hello,

I would model the relations between a car model and a conductor or passenger using table constraints. For instance for Car1, you might have two tables:

car1 - COND1
0 - 0
0 - 1
0 - 5
1 - 0
1 - 5

and

car1 - OTHER1
0 - 0
0 - 1
1 - -1

where "-1" models the absence of another person. A table constraint states that the values of the variables must be equal to one of the lines of the table. In Gecode, the table constraint is called "extensional" (the version with a TupleSet argument).

Finally for the all distinct, you can use the "distinct" constraint on { COND1, OTHER1, COND2, OTHER2 }. Note that giving the value "-1" for the absence of person is fine with the distinct constraint as it is now. If you have several cars where the other person might be absent, you should give them other numbers (-2, -3, ...) to make sure the distinct constraint does not remove solutions.

Best,

JN


On 04/11/2013 10:44 AM, christine bouzant wrote:
Dear all,

I am wondering if you could you help me to make my model ?
I put in attachment a small document to explain what i would like to model.
Here are some explanations:

I would like to find 2 cars : Car1 and Car2.
The domain for Car1 is [0,1].
The car number 0 must have a conductor COND1 (people domain is [0,1,5]) and an other person OTHER1 (people domain is [0,1]). The car number 1 is not the same car model. It must have only the conductor COND1 (for this car number, the people domain is [0, 5]).


The domain for Car2 is [2,3].
The car number 2 must have a conductor COND2 (people domain is [7, 8]) and an other person OTHER2 (people domain is [6, 9]). The car number 3 is not exactly the same car model. It must have the conductor COND2 (for this car, the people domain is [7, 8, 12]) and the person OTHER2 (domain is [6, 15]).

Moreother, i would like to have the constraint that each people chosen in cars are distinct.

I have no idea how to model this since the car configuration (COND or/and OTHER) and the people domain depends of the car number selection...

Many thanks for your help !

Cheers,
Christine









_______________________________________________
Gecode users mailing list
users@gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users



_______________________________________________
Gecode users mailing list
users@gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to