The statement
Explorer.exploreOne(conference)will explore the search tree until the first solution is found. The first solution minimizes the number of slots and looks as follows:
{x1 = intvar{|This plan says that the conference requires 4 slots, where the sessions 1, 4 and 9 take place in slot 1, the sessions 2, 5 and 6 take place in slot 2, the sessions 3, 7 and 10 take place in slot 3, and the sessions 8 and 11 take place in slot 4.mathend000#1 | mathend000#},
x10 = intvar{|mathend000#3 | mathend000#},
x11 = intvar{|mathend000#4 | mathend000#},
x2 = intvar{|mathend000#2 | mathend000#},
x3 = intvar{|mathend000#3 | mathend000#},
x4 = intvar{|mathend000#1 | mathend000#},
x5 = intvar{|mathend000#2 | mathend000#},
x6 = intvar{|mathend000#2 | mathend000#},
x7 = intvar{|mathend000#3 | mathend000#},
x8 = intvar{|mathend000#4 | mathend000#},
x9 = intvar{|mathend000#1 | mathend000#}}
fun conference space = let val nbSlots = FD.range(space,(4,11)) val plan as #[x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11] = FD.rangeVec(space,11,(1,11)) fun precedes(a,b)= post(space,FD(a)`< FD(b),FD.DOM) fun notparallel(s,vec)= Vector.app(fn x => post(space,FD(s)`<> FD(x),FD.DOM))vec in FD.branch(space,#[nbSlots],FD.B_NONE,FD.B_MIN); Vector.app(fn x => FD.rel(space,x,FD.LQ,nbSlots))plan; precedes(x4,x11); precedes(x5,x10); precedes(x6,x11); notparallel(x1,#[x2,x3,x5,x7,x8,x10]); notparallel(x2,#[x3,x4,x7,x8,x9,x11]); notparallel(x3,#[x5,x6,x8]); notparallel(x4,#[x6,x8,x10]); notparallel(x6,#[x7,x10]); notparallel(x7,#[x8,x9]); notparallel(x8,#[x10]); (* the next line ensures that every slot has at most three sessions *) Vector.app(fn x =>FD.countVI(space,plan,x,FD.LE,4))plan; FD.branch(space,plan,FD.B_SIZE_MIN,FD.B_MIN); {x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11} end
Guido Tack 2007-04-26