Hi,
I'm trying to implement an object representing an objective in a map
colouring problem with a set of preferences for each colour at each
node. I want to be able to have several objectives existing at the
same time each with their own list of preferences.
This requires a table[range = choco/IntVar, domain = table]
and an inner table[range = integer, domain = integer]
In the example for tables in the manual it uses
square[x:(0 .. 20)] : integer := (x * x)
this populates the table.
Would it be possible to say
[makePreferenceObjective(prob:choco/Problem) : PreferenceObjective
-> preferenceTable[var:prob.vars] : table := makePreferenceList(var),
PreferenceObjective(preferences = preferenceTable)
]
where prob is the problem containing the variables to create a table
mapping each variable in the problem to a table containing his
preference for eahc value in that variables domain?
Then can I write
[makePreferenceList(var:choco/IntVar) : table
-> scores[value: {set of values in the domain}] : integer :=
random(choco/getDomainSize(var))
]
to return a mapping from each value in the variables domain to a
random number?
When I try to run this I get error message the symbol var is unbound
and if I just try to run makePreferenceList
I get an error that value is unbound.
I ran the example in the manual by typing it in to the interpreter and
it worked fine.
Am I doing something wrong when I use it inside my own methods.
Thanks,
Paidi