Hi,
The problem to parse the meaning of a string has really nothing to do with constraint programming or Gecode. Please consult a textbook on compilers on how to parse a string. Best Christian -- Christian Schulte, www.ict.kth.se/~cschulte/ From: [email protected] [mailto:[email protected]] On Behalf Of fei liu Sent: Monday, August 15, 2011 10:34 AM To: [email protected] Subject: [gecode-users] How to use CSP to sovle the problem of the assignment of values to variables Dear developer, I am now trying to use CSP to sovle the problem of the assignment of values to variables. But I got a couple of questions. Problem description: Each time I input a number of variables each of which has a value domain to the CSP solver, and a couple of constrains (e.g. in the string form, put in a vector). That is to say, each time the number of variables and constraints are changing. For example, variables: x,y; //which you will get from a vector (in c++) value domains: x: 1-5; y: 1-3; //which you will also get from a vector constraints: x==y //it can be any boolean expression, and can be got from a string vector. For this, I should get the following results: x, y 1, 1 2, 2 3, 3 That is, we will get each assignment. Questions: -- how to define a dynamic IntVarArray given a variable name vector e.g. a vector that stores x and y -- How to read constraints (in the string form) from a vector, e.g. a vector that stores "x==y" or other constraints. That is, each time we use different constraints. Could you please give me some suggestions or answers about these questions? Thank you very much. Fei Liu
_______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users
