Philipp Marcus wrote: > > assignItems([I1,I2,I3,I4,I5,I6],Measure) :- > (local domain(knapsacks("B","C","D"))), > [I1,I2,I3,I4,I5,I6] &:: > ["B","C","D"],Items=[item{id:"item1",knap:I1},item{id:"item2",knap:I2},item{id:"item3",knap:I3},item{id:"item4",knap:I4},item{id:"item5",knap:I5},item{id:"item6",knap:I6}], > sigma(Items,"B",Value1),sigma(Items,"C",Value2),sigma(Items,"D",Value3), > Measure $= (Value1 + Value2 + Value3), > branch_and_bound:minimize(search([I1,I2,I3,I4,I5,I6]),Measure). Some technical remarks: 1. the domain declaration should be a directive :- local domain(knapsacks('B','C','D')). 2. for things that are names/symbols, use atoms instead of strings: 'C' instead of "C", and item2 instead of "item2" -- JoachimReceived on Wed Apr 14 2010 - 10:41:15 CEST
This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET