constraint satisfaction problem: creating a duty schedule

Kambiz Darabi <[email protected]> Thu, 19 Apr 2007 13:54:12 +0200
Newsgroups gmane.comp.ai.powerloom
Message-ID <[email protected]>
Hello,

I have a problem which I would like to solve with PL.

A group of crossing guards have to secure 3 different locations near a
school. They have to do this 5 days a week in the morning and at noon.

Some of them can only work on specific days and some would 'prefer'
some days, but would be able to work also on 'non-preferred' days.
Some can only work in the morning, others only at noon. Some will work
only on one, others on two or three different (but not specific) days.

I only got this far to define the location, day, and time concepts.

;; ----------------------------

(in-module "CROSSING-GUARD-SCHEDULE")
(clear-module "CROSSING-GUARD-SCHEDULE")

(reset-features)

(in-dialect :KIF)

(propagate-constraints)

(defconcept day (?d) 
  :<=> (member-of ?d (setof monday
			    tuesday
			    wednesday
			    thursday
			    friday)))
(defconcept location (?l)
  :<=> (member-of ?l (setof crossing1
			    crossing2
			    crossing3)))

(defconcept time (?t)
  :<=> (member-of ?t (setof morning
			    noon)))

;; ----------------------------

As every combination of day, location, and time defines one 'duty' for
which a guard can be scheduled, I tried to somehow combine them. I
have tried numerous variations of relations playing with forall (and
exists) like:

(defrelation duty ((?l location) (?d day) (?t time))
  :<<= (forall ?l ?d ?t (location ?l) 
	    (day ?d) 
	    (time ?t)))

but to no avail.

1) is the problem solvable at all? 

2) how can I create the combination of the instances of the three concepts?

3) do you have any hint on which direction to take for solving the
problem?


Many many thanks


Kambiz