// // Note: this is a model answer // other answers are possible // [ex2a() : Problem -> let pb := makeProblem("home truths",20), // workmen AndyMann := makeIntVar(pb,"Andy Mann",1,5), BrettSaw := makeIntVar(pb,"Brett Saw",1,5), DrewScriver := makeIntVar(pb,"Drew Scriver",1,5), GeorgeClamp := makeIntVar(pb,"George Clamp",1,5), SteveDawe := makeIntVar(pb,"Steve Dawe",1,5), // problems BurstPipe := makeIntVar(pb,"Burst Pipe",1,5), Fused := makeIntVar(pb,"Fused Electrics",1,5), Injured := makeIntVar(pb,"Injured Himself",1,5), OverSpent := makeIntVar(pb,"Over spent",1,5), Ruined := makeIntVar(pb,"Ruined Carpet",1,5), // rooms Bathroom := makeIntVar(pb,"Bathroom",1,5), Bedroom := makeIntVar(pb,"Bedroom",1,5), Kitchen := makeIntVar(pb,"Kitchen",1,5), Roof := makeIntVar(pb,"Roof",1,5), Windows := makeIntVar(pb,"Windows",1,5), // months Feb := makeIntVar(pb,"February",1,5), Mar := makeIntVar(pb,"March",1,5), Jun := makeIntVar(pb,"June",1,5), Sep := makeIntVar(pb,"September",1,5), Nov := makeIntVar(pb,"November",1,5) in (post(pb,allDifferent(list(AndyMann,BrettSaw,DrewScriver,GeorgeClamp,SteveDawe))), post(pb,allDifferent(list(BurstPipe,Fused,Injured,OverSpent,Ruined))), post(pb,allDifferent(list(Feb,Mar,Jun,Sep,Nov))), post(pb,allDifferent(list(Bathroom,Bedroom,Kitchen,Roof,Windows))), post(pb,GeorgeClamp !== Nov), post(pb,GeorgeClamp == OverSpent), post(pb,GeorgeClamp == Roof), post(pb,Nov !== BurstPipe), post(pb,BurstPipe == Kitchen), post(pb,SteveDawe == Jun), post(pb,BrettSaw == Injured), post(pb,DrewScriver !== Windows), post(pb,DrewScriver !== Fused), post(pb,Fused == Sep), post(pb,Bathroom == Mar), post(pb,Ruined == Bedroom), pb)] // // Page 48, Issue 32 // // q1: answer the basic question // give performance statistics // q2: there are 120 solutions // q3: we can permute the 5 values, therefore 5! solutions // q4: use smallest domain first, or brelaz or dom/deg. Explain // how the heuristic works // q5: 20 variables (n = 20) each with 5 values (m = 5) // therefore 5^20 //