Search the web
Sign In
New User? Sign Up
claireprogramminglanguage · Claire Programming Language - A place to discuss about the CLAIRE language
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Tables   Message List  
Reply | Forward Message #580 of 1160 |
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




Thu Aug 14, 2003 6:33 pm

paidi_creed
Offline Offline
Send Email Send Email

Forward
Message #580 of 1160 |
Expand Messages Author Sort by Date

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...
paidi_creed
Offline Send Email
Aug 14, 2003
6:33 pm

I solved my problem. I discovered make_table and used that to write the methods [makePreferencesObjective(prob:choco/Problem): PreferencesObjective -> // Seed...
paidi_creed
Offline Send Email
Aug 14, 2003
7:45 pm

... the ... Hi, a couple of things: (1) getting a seg fault is a bug. If you can isolate your code please report it as a bug (clairebugs@...) (unless you...
ycaseau
Offline
Aug 22, 2003
4:10 am

... Thanks for the advice Yves. I don't think an array would do the job here, I'm using the table as a dictionary. Would it be better to use an array and a...
paidi_creed
Offline Send Email
Aug 22, 2003
5:56 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help