Wolfgang
Yes, that would help!
Should read: Douggie's birthday is as many days before Alf's as it is after
Fred's. Charlie's is as many days before Fred's as Bert's is after
Fred's.

Robert

-----Original Message----- From: Wolfgang Meyer
Sent: Wednesday, February 23, 2011 12:09 AM
To: Robert Onslow ; [email protected]
Subject: Re: Model and constraints problem

Dear Robert,

On Feb 22, 2011 9:55pm, Robert Onslow <[email protected]> wrote:
Alf Bert Charlie Douggie Ernie and Fred have their birthdays on consecutive
days, but not necessarily in that order.

Douggie’s birthday is as many days before Fred’s as Bert’s is after Fred’s.
Charlie’s birthday is as many days before Fred’s as Bert’s is after Fred’s. This
year, Ernie’s birthday is on a Saturday.

I think there is a problem with this description (identical
constraints for Douggie and Charlie?).


I am thinking of a domain of 0#6 for each of A B C D E and F.


I have
got the constraints {FD.distinct Solution} and E :: 5 (even I can work that one
out!)

How would
I combine propagators to model the other constraints? I can see that I will be working with {FD.modI .. 7} to wrap around the days of the week. I guess there may be some constrained variables M and N representing the number of days before
and days after, but I am not sure how to combine the constraints in this
problem.


I think I would split this problem into two problems.
(1) Find out the order of the birthdays.
(2) Calculate the weekdays from the relative order. (should be easy)

To solve (1), I would choose the domain 0#5 for the variables (to
represent 6 consecutive days, not the concrete weekdays)
and call FD.distinct as you proposed.
Then the first constraint can simply be written like this:

% D's birthday is before F's birthday:
D <: F
% D is as many days before F as B after F:
F - D =: B - F

The last constraint ("Ernie’s birthday is on a Saturday.") is not
encoded in the program, but you use it for subproblem (2).

Hope this helps,
Wolfgang
_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to