You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(11) |
Nov
(4) |
Dec
(7) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(2) |
Feb
(8) |
Mar
(13) |
Apr
(1) |
May
(2) |
Jun
(5) |
Jul
(7) |
Aug
(1) |
Sep
(1) |
Oct
(9) |
Nov
(1) |
Dec
(15) |
2006 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(1) |
May
(10) |
Jun
(1) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
(6) |
Dec
|
2007 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(14) |
Jul
(3) |
Aug
|
Sep
(7) |
Oct
(13) |
Nov
(4) |
Dec
(7) |
2008 |
Jan
(1) |
Feb
(4) |
Mar
(2) |
Apr
(7) |
May
(4) |
Jun
(17) |
Jul
(20) |
Aug
(7) |
Sep
(23) |
Oct
(18) |
Nov
(47) |
Dec
(51) |
2009 |
Jan
(35) |
Feb
(20) |
Mar
(32) |
Apr
(38) |
May
(119) |
Jun
(99) |
Jul
(65) |
Aug
(22) |
Sep
(24) |
Oct
(39) |
Nov
(9) |
Dec
(10) |
2010 |
Jan
(8) |
Feb
(8) |
Mar
(76) |
Apr
(72) |
May
(80) |
Jun
(83) |
Jul
(28) |
Aug
(57) |
Sep
(25) |
Oct
(3) |
Nov
|
Dec
(1) |
2011 |
Jan
(2) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2014 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(4) |
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Eric A. <am...@ev...> - 2006-05-23 15:09:27
|
Hello Hadrien, Following your suggestion, I've added the Howto in the last section "Inside Choco" of the user guide. I've added the packages list taken from the Javadoc. If you have special guidelines to follow, please advise. --Eric ----- Original Message -----=20 From: Hadrien=20 To: Eric Amram ; cho...@li...=20 Sent: Tuesday, May 23, 2006 2:12 PM Subject: Re: [Choco-users] CVS Anonymous checkout -- Eclipse HOWTO Hello, >However, I may contribute right now to the documentation, >as I have struggled through the docs & api. >Some parts of the wiki could be developed for the dummy first-time = users. > Please give me your feeling about. This would be great. We recently set up the wiki = http://choco-solver.net/ to this end and I have forgotten to mention it :) ! The "How to check out the CHOCO project" would be very usefull. Feel = free to add it. > Is it possible with current api to : > 1/ Launch the search for 60 sec for instance. > 2/ If there is a solution found, return it to the user > 3/ If there is none (but we know the pb is not unfeasible), alert > the user we keep on searching and RESUME the search=20 > FROM WHERE WE WERE before. > --> Loop to 1/ as long as needed. > Is it possible to call launch() a second time, with restart false,=20 > while keeping all previous results from the first launch() call ? Points 1/ and 2/ are possible with a time limit: = pb.getSolver().setTimeLimit(time_limit_in_millisecond). If a solution has been found, it is restored (the best one found is restored in case = of optimization). However once the limit is reached the solver backtrack to the root = node. I believe it is actually not possible to resume the search after a = limit has been encountered. However, this is exactly what happend when calling nextSolution(), the = solver restarts the search from the node the solution was found. So this = behaviour has not been implemented for SearchLimit but should not be = very difficult to add. It could be a TODO added on the wiki page :) Hadrien ----- Original Message -----=20 From: Eric Amram=20 To: cho...@li...=20 Sent: Tuesday, May 23, 2006 1:41 PM Subject: [Choco-users] CVS Anonymous checkout -- Eclipse HOWTO Hello passionate choco users, Here is a simple Howto to check out CHOCO project=20 from SourceForge, with Eclipse. This is very easy : 1/ In the workspace of your choice, do "New Project" and choose "CVS" / Checkout Projects from CVS" 2/ Check "Create a new repository location" and fill=20 the following info: Host : choco.cvs.sourceforge.net Repository path : /cvsroot/choco User : anonymous (no password) (keep pserver and default port) 3/ "Use an existing module [...]" Select "java" =20 Follow the next screens as usual to create the project. WARNING:=20 1/ You need JUNIT JAR to compile the project properly (www.junit.org if you don't have it already in eclipse) 2/ As I use UTF-8, I had a compile error in a test file : In choco.test.integer.NaryRelationTest Line 156 & next forbiddenTuplesAine has a "=E9" at the end, so does not compile. But I'm sure this will be corrected by the time you read it {;-)) |
From: Hadrien <had...@em...> - 2006-05-23 12:13:36
|
Hello, >However, I may contribute right now to the documentation, >as I have struggled through the docs & api. >Some parts of the wiki could be developed for the dummy first-time = users. > Please give me your feeling about. This would be great. We recently set up the wiki = http://choco-solver.net/ to this end and I have forgotten to mention it :) ! The "How to check out the CHOCO project" would be very usefull. Feel = free to add it. > Is it possible with current api to : > 1/ Launch the search for 60 sec for instance. > 2/ If there is a solution found, return it to the user > 3/ If there is none (but we know the pb is not unfeasible), alert > the user we keep on searching and RESUME the search=20 > FROM WHERE WE WERE before. > --> Loop to 1/ as long as needed. > Is it possible to call launch() a second time, with restart false,=20 > while keeping all previous results from the first launch() call ? Points 1/ and 2/ are possible with a time limit: = pb.getSolver().setTimeLimit(time_limit_in_millisecond). If a solution has been found, it is restored (the best one found is restored in case = of optimization). However once the limit is reached the solver backtrack to the root node. I believe it is actually not possible to resume the search after a limit = has been encountered. However, this is exactly what happend when calling nextSolution(), the = solver restarts the search from the node the solution was found. So this = behaviour has not been implemented for SearchLimit but should not be = very difficult to add. It could be a TODO added on the wiki page :) Hadrien ----- Original Message -----=20 From: Eric Amram=20 To: cho...@li...=20 Sent: Tuesday, May 23, 2006 1:41 PM Subject: [Choco-users] CVS Anonymous checkout -- Eclipse HOWTO Hello passionate choco users, Here is a simple Howto to check out CHOCO project=20 from SourceForge, with Eclipse. This is very easy : 1/ In the workspace of your choice, do "New Project" and choose "CVS" / Checkout Projects from CVS" 2/ Check "Create a new repository location" and fill=20 the following info: Host : choco.cvs.sourceforge.net Repository path : /cvsroot/choco User : anonymous (no password) (keep pserver and default port) 3/ "Use an existing module [...]" Select "java" =20 Follow the next screens as usual to create the project. WARNING:=20 1/ You need JUNIT JAR to compile the project properly (www.junit.org if you don't have it already in eclipse) 2/ As I use UTF-8, I had a compile error in a test file : In choco.test.integer.NaryRelationTest Line 156 & next forbiddenTuplesAine has a "=E9" at the end, so does not compile. But I'm sure this will be corrected by the time you read it {;-)) |
From: Eric A. <am...@ev...> - 2006-05-23 11:42:04
|
Hello passionate choco users, Here is a simple Howto to check out CHOCO project=20 from SourceForge, with Eclipse. This is very easy : 1/ In the workspace of your choice, do "New Project" and choose "CVS" / Checkout Projects from CVS" 2/ Check "Create a new repository location" and fill=20 the following info: Host : choco.cvs.sourceforge.net Repository path : /cvsroot/choco User : anonymous (no password) (keep pserver and default port) 3/ "Use an existing module [...]" Select "java" =20 Follow the next screens as usual to create the project. WARNING:=20 1/ You need JUNIT JAR to compile the project properly (www.junit.org if you don't have it already in eclipse) 2/ As I use UTF-8, I had a compile error in a test file : In choco.test.integer.NaryRelationTest Line 156 & next forbiddenTuplesAine has a "=E9" at the end, so does not compile. But I'm sure this will be corrected by the time you read it {;-)) |
From: Eric A. <am...@ev...> - 2006-05-23 10:55:29
|
Hi all, When doing optimization problems, we often have=20 to deal with huge exploration space that we can not exhaust. So we need to add some time limit, especially if there is a user waiting for. Is it possible with current api to : 1/ Launch the search for 60 sec for instance. 2/ If there is a solution found, return it to the user (as our magnificient heuristics will give one of the best answer) 3/ If there is none (but we know the pb is not unfeasible), alert the user we keep on searching and RESUME the search=20 FROM WHERE WE WERE before. --> Loop to 1/ as long as needed. Is it possible to call launch() a second time, with restart false,=20 while keeping all previous results from the first launch() call ? Thanks for your help, --Eric |
From: Eric A. <am...@ev...> - 2006-05-23 10:42:24
|
Hello Hadrien, Thanks for your answers, episodes are getting more and more interesting {;-) I'll try the new jar asap. It would be nice indeed to be able to check out=20 anonymously from CVS directly, to get last evolutions quickly. About my contribution: I don't consider myself as being knowledgeable enough to develop new constraints myself. Maybe in the next months. However, I may contribute right now to the documentation, as I have struggled through the docs & api. Some parts of the wiki could be developed for the dummy=20 first-time users. Please give me your feeling about. --Eric=20 =20 ----- Original Message -----=20 From: Hadrien=20 To: Eric Amram ; cho...@li...=20 Sent: Tuesday, May 23, 2006 9:40 AM Subject: Re: [Choco-users] Two caveats that can turn into BIG BUGS Hello, 1/ pb.nth( IntVar index, ... ) --> index must be from makeEnumIntVar() = !! Yes ! BoundConsistency is not implemented on the element constraint. = But it seems to make=20 more sens in ArcConsistency. Anyway I have added a clear error message = ...=20 2/ pb.getSolver().attachGoal() is protected. --> Should be public !! Yes ! thank you, it is now public 3/ Is the SourceForge CVS the main repository ? I don't find the Solver.setVerbosity() that is documented is the user = guide... Yes sourceforge is the main repository. Let me send you the last jar = privately until guillaume has published the new one and a guideline to checkout the cvsroot as an anonymous user. (He = promised to do it tonight... :)) 4/ Last but not least: how can I help to contribute to this great = project ? For the moment, the easiest way to contribute is to implement = constraints. You can send us the code of a constraint and a set of tests = so we can add them with the corresponding api in Problem. If you want = then to do more, francois may give you the developper status ! Hadrien ----- Original Message -----=20 From: Eric Amram=20 To: cho...@li...=20 Sent: Friday, May 19, 2006 6:52 PM Subject: [Choco-users] Two caveats that can turn into BIG BUGS Hi all, I would like to notify 2 caveats I've spotted (actually that made my code crash {:-(( 1/ pb.nth( IntVar index, ... ) --> index must be from = makeEnumIntVar() !! It is said to take a IntVar, but if you provide a variable from pb.makeBoundIntVar, it crashes : IntervalIntDomain.getIterator throws an exception. That was a tough bug to find... 2/ pb.getSolver().attachGoal() is protected. --> Should be public !! So the only mean to set the FIRST goal of the solver is to setVarSelector / setValSelector / setValIterator before the generateSearchSolver() That's a little bit tricky, and prevent from using anything else = than AssignVar. The wiki doc "Define your own tree search" is not in sync with = the code (it uses attachGoal). Hope it helps to make Choco better !! --Eric |
From: Hadrien <had...@em...> - 2006-05-23 07:41:32
|
Hello, 1/ pb.nth( IntVar index, ... ) --> index must be from makeEnumIntVar() = !! Yes ! BoundConsistency is not implemented on the element constraint. But = it seems to make=20 more sens in ArcConsistency. Anyway I have added a clear error message = ...=20 2/ pb.getSolver().attachGoal() is protected. --> Should be public !! Yes ! thank you, it is now public 3/ Is the SourceForge CVS the main repository ? I don't find the Solver.setVerbosity() that is documented is the user = guide... Yes sourceforge is the main repository. Let me send you the last jar = privately until guillaume has published the new one and a guideline to checkout the cvsroot as an anonymous user. (He = promised to do it tonight... :)) 4/ Last but not least: how can I help to contribute to this great = project ? For the moment, the easiest way to contribute is to implement = constraints. You can send us the code of a constraint and a set of tests = so we can add them with the corresponding api in Problem. If you want = then to do more, francois may give you the developper status ! =20 Hadrien ----- Original Message -----=20 From: Eric Amram=20 To: cho...@li...=20 Sent: Friday, May 19, 2006 6:52 PM Subject: [Choco-users] Two caveats that can turn into BIG BUGS Hi all, I would like to notify 2 caveats I've spotted (actually that made my code crash {:-(( 1/ pb.nth( IntVar index, ... ) --> index must be from makeEnumIntVar() = !! It is said to take a IntVar, but if you provide a variable from pb.makeBoundIntVar, it crashes : IntervalIntDomain.getIterator throws an exception. That was a tough bug to find... 2/ pb.getSolver().attachGoal() is protected. --> Should be public !! So the only mean to set the FIRST goal of the solver is to setVarSelector / setValSelector / setValIterator before the generateSearchSolver() That's a little bit tricky, and prevent from using anything else = than AssignVar. The wiki doc "Define your own tree search" is not in sync with the = code (it uses attachGoal). Hope it helps to make Choco better !! --Eric |
From: Eric A. <am...@ev...> - 2006-05-22 19:59:00
|
Hello Hadrien, Thank you for your answers, I can't stand waiting for the next episodes {;-) The java.lang.UnsupportedOperationException was indeed linked to that, because of a pb.nth() constraint that does not support BoundIntVar as index. Is the SourceForge CVS the main repository ? I don't find the Solver.setVerbosity() that is documented is the user = guide... Bye, --Eric ----- Original Message -----=20 From: Hadrien=20 To: Eric Amram ; cho...@li...=20 Sent: Monday, May 22, 2006 2:00 PM Subject: Re: [Choco-users] Choco, CVS & = UnsupportedOperationException... Hello, Some answers :),=20 > 2/ Are there features that are still not implemented in the .jar, = like some parts of the AC2001 or the RandomIntValSelector ? > I've noticed some "TODO" remaining in the code.=20 To my knowledge AC2001 for binary constraints as well as the = RandomIntValSelector are available. However the GAC2001 (for n-ary constraints) is not yet fully available > 3/ One of my algorithms runs smoothly, but the other, more complex, = generate a=20 > "UnsupportedOperationException at = choco.integer.var.IntervalIntDomain.getIterator"=20 > Here is the stacktrace:=20 > Exception in thread "main" java.lang.UnsupportedOperationException=20 Yes this is because you ask for a domain iterator on a BounIntVar = variable. A BoundIntVar is only managed by its lower and upper bound so that "holes" in the = domain are taken into account. So you can not iterate on its domain. You can know whether a variable = v is Enumerated or not with v.isEnumerated(). > 4/ There is a "bad.jar" in the contrib section. Is it contained in = the .jar now, or still aside? It is included in the current version. check the http://choco-solver.net in the user-guide section, the part = on "advanced constraints" describes the latest added global constraints. Hop it helps. Answers for the remaining questions will come soon :) = ...=20 We need to publish the last jar. Hadrien ----- Original Message -----=20 From: Eric Amram=20 To: cho...@li...=20 Sent: Friday, May 19, 2006 4:44 PMSubject: [Choco-users] Choco, CVS = & UnsupportedOperationException... Hello,=20 =20 First of all, congratulations for this piece of software, = that's a great achievement! =20 I used to be a user of choco in Claire language, and using = Java is much easier and convenient. Thank you !=20 =20 As I'm rewriting old apps in choco-java, I'm encountering hard = points I have trouble to solve.=20 =20 A few question to you guys, who have the Wisdom and Knowledge = of the Source:=20 =20 1/ Is the 1_1_02.jar the latest available version or is the = CVS version more complete??=20 Is the CVS version of SourceForge up-to-date ? =20 2/ Are there features that are still not implemented in the = .jar, like some parts of the AC2001 or the RandomIntValSelector ? I've = noticed some "TODO" remaining in the code.=20 =20 3/ One of my algorithms runs smoothly, but the other, more = complex, generate a=20 "UnsupportedOperationException at = choco.integer.var.IntervalIntDomain.getIterator"=20 =20 Here is the stacktrace:=20 =20 Exception in thread "main" = java.lang.UnsupportedOperationException=20 at choco.integer.var.IntervalIntDomain.getIterator(Unknown = Source)=20 at = choco.integer.constraints.Element.updateValueFromIndex(Unknown Source)=20 at choco.integer.constraints.Element.awake(Unknown Source)=20 at choco.prop.ConstraintEvent.propagateEvent(Unknown Source)=20 at choco.prop.ConstraintEventQueue.propagateSomeEvents(Unknown = Source)=20 at choco.AbstractProblem.propagate(Unknown Source)=20 at = choco.search.AbstractGlobalSearchSolver.incrementalRun(Unknown Source)=20 at choco.Solver.launch(Unknown Source)=20 ...=20 =20 Would you know where it could come from ???=20 =20 =20 4/ There is a "bad.jar" in the contrib section. Is it = contained in the .jar now, or still aside?=20 =20 5/ Last but not least: how can I help to contribute to this = great project ?=20 =20 Thank you in advance,=20 =20 --Eric=20 P.S.: The choco.sourceforge.net site "Latest downloads" = section is outdated, since it gives version 1_1_01=20 |
From: Hadrien <had...@em...> - 2006-05-22 12:01:52
|
Hello, Some answers :),=20 > 2/ Are there features that are still not implemented in the .jar, like = some parts of the AC2001 or the RandomIntValSelector ? > I've noticed some "TODO" remaining in the code.=20 To my knowledge AC2001 for binary constraints as well as the = RandomIntValSelector are available. However the GAC2001 (for n-ary constraints) is not yet fully available > 3/ One of my algorithms runs smoothly, but the other, more complex, = generate a=20 > "UnsupportedOperationException at = choco.integer.var.IntervalIntDomain.getIterator"=20 > Here is the stacktrace:=20 > Exception in thread "main" java.lang.UnsupportedOperationException=20 Yes this is because you ask for a domain iterator on a BounIntVar = variable. A BoundIntVar is only managed by its lower and upper bound so that "holes" in the = domain are taken into account. So you can not iterate on its domain. You can know whether a variable v = is Enumerated or not with v.isEnumerated(). > 4/ There is a "bad.jar" in the contrib section. Is it contained in the = .jar now, or still aside? It is included in the current version. check the http://choco-solver.net in the user-guide section, the part on = "advanced constraints" describes the latest added global constraints. Hop it helps. Answers for the remaining questions will come soon :) ...=20 We need to publish the last jar. Hadrien ----- Original Message -----=20 From: Eric Amram=20 To: cho...@li...=20 Sent: Friday, May 19, 2006 4:44 PMSubject: [Choco-users] Choco, CVS & = UnsupportedOperationException... Hello,=20 =20 First of all, congratulations for this piece of software, that's = a great achievement! =20 I used to be a user of choco in Claire language, and using Java = is much easier and convenient. Thank you !=20 =20 As I'm rewriting old apps in choco-java, I'm encountering hard = points I have trouble to solve.=20 =20 A few question to you guys, who have the Wisdom and Knowledge of = the Source:=20 =20 1/ Is the 1_1_02.jar the latest available version or is the CVS = version more complete??=20 Is the CVS version of SourceForge up-to-date ? =20 2/ Are there features that are still not implemented in the = .jar, like some parts of the AC2001 or the RandomIntValSelector ? I've = noticed some "TODO" remaining in the code.=20 =20 3/ One of my algorithms runs smoothly, but the other, more = complex, generate a=20 "UnsupportedOperationException at = choco.integer.var.IntervalIntDomain.getIterator"=20 =20 Here is the stacktrace:=20 =20 Exception in thread "main" = java.lang.UnsupportedOperationException=20 at choco.integer.var.IntervalIntDomain.getIterator(Unknown = Source)=20 at = choco.integer.constraints.Element.updateValueFromIndex(Unknown Source)=20 at choco.integer.constraints.Element.awake(Unknown Source)=20 at choco.prop.ConstraintEvent.propagateEvent(Unknown Source)=20 at choco.prop.ConstraintEventQueue.propagateSomeEvents(Unknown = Source)=20 at choco.AbstractProblem.propagate(Unknown Source)=20 at = choco.search.AbstractGlobalSearchSolver.incrementalRun(Unknown Source)=20 at choco.Solver.launch(Unknown Source)=20 ...=20 =20 Would you know where it could come from ???=20 =20 =20 4/ There is a "bad.jar" in the contrib section. Is it contained = in the .jar now, or still aside?=20 =20 5/ Last but not least: how can I help to contribute to this = great project ?=20 =20 Thank you in advance,=20 =20 --Eric=20 P.S.: The choco.sourceforge.net site "Latest downloads" section = is outdated, since it gives version 1_1_01=20 |
From: Eric A. <am...@ev...> - 2006-05-19 16:51:41
|
Hi all, I would like to notify 2 caveats I've spotted (actually that made my code crash {:-(( 1/ pb.nth( IntVar index, ... ) --> index must be from makeEnumIntVar() = !! It is said to take a IntVar, but if you provide a variable from pb.makeBoundIntVar, it crashes : IntervalIntDomain.getIterator throws an exception. That was a tough bug to find... 2/ pb.getSolver().attachGoal() is protected. --> Should be public !! So the only mean to set the FIRST goal of the solver is to setVarSelector / setValSelector / setValIterator before the generateSearchSolver() That's a little bit tricky, and prevent from using anything else than = AssignVar. The wiki doc "Define your own tree search" is not in sync with the = code (it uses attachGoal). Hope it helps to make Choco better !! --Eric |
From: Eric A. <am...@ev...> - 2006-05-19 14:43:54
|
Hello,=20 =20 First of all, congratulations for this piece of software, that's a = great achievement! =20 I used to be a user of choco in Claire language, and using Java is = much easier and convenient. Thank you !=20 =20 As I'm rewriting old apps in choco-java, I'm encountering hard = points I have trouble to solve.=20 =20 A few question to you guys, who have the Wisdom and Knowledge of = the Source:=20 =20 1/ Is the 1_1_02.jar the latest available version or is the CVS = version more complete??=20 Is the CVS version of SourceForge up-to-date ? =20 2/ Are there features that are still not implemented in the .jar, = like some parts of the AC2001 or the RandomIntValSelector ? I've noticed = some "TODO" remaining in the code.=20 =20 3/ One of my algorithms runs smoothly, but the other, more = complex, generate a=20 "UnsupportedOperationException at = choco.integer.var.IntervalIntDomain.getIterator"=20 =20 Here is the stacktrace:=20 =20 Exception in thread "main" java.lang.UnsupportedOperationException = at choco.integer.var.IntervalIntDomain.getIterator(Unknown Source) = at choco.integer.constraints.Element.updateValueFromIndex(Unknown = Source)=20 at choco.integer.constraints.Element.awake(Unknown Source)=20 at choco.prop.ConstraintEvent.propagateEvent(Unknown Source)=20 at choco.prop.ConstraintEventQueue.propagateSomeEvents(Unknown = Source)=20 at choco.AbstractProblem.propagate(Unknown Source)=20 at choco.search.AbstractGlobalSearchSolver.incrementalRun(Unknown = Source)=20 at choco.Solver.launch(Unknown Source)=20 ...=20 =20 Would you know where it could come from ???=20 =20 =20 4/ There is a "bad.jar" in the contrib section. Is it contained in = the .jar now, or still aside?=20 =20 5/ Last but not least: how can I help to contribute to this great = project ?=20 =20 Thank you in advance,=20 =20 --Eric=20 P.S.: The choco.sourceforge.net site "Latest downloads" section is = outdated, since it gives version 1_1_01=20 |
From: <mic...@gm...> - 2006-04-28 17:29:54
|
Hello, the choco-wiki user guide mentions at http://choco-solver.net/index.php?title=User_guide#Logs that the solver can log the search/propagation activity. That would be very useful for me. However, in version 1.1_01 i cannot find Solver.SEARCH or a Solver.setVerbose method? Is this feature in CVS? How can I get it? Thanks, Michael -- GMX Produkte empfehlen und ganz einfach Geld verdienen! Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner |
From: Ola L. <ol...@id...> - 2006-03-04 23:14:51
|
Hi! I want to use Choco in an application where I'd like to use constraint programming not so much for searching for optimal solutions but rather to just the constraint network to propagate values and see how different choices of values affect other variables in the system. In the end it's going to be used in a decision support system of sorts. I thought that using PalmProblem for modelling my domain would be a good idea since it allows me to add and remove constraints dynamically. However, boolean constraints don't seem to work with PalmProblems for some reason and I would very much like to use them in PalmProblems.. I then figured that this could easily be fixed by letting AbstractBinBoolConstraint and AbstractLargeBoolConstraint implement PalmConstraint and PalmIntVarListener, add constraintPlugins in the constructors of these classes along with default methods for propagating restoration of values and bounds to sub-constraints. However, I have run into some problems and I'm starting to think that there may be some fundamental problems for doing this. Therefore I thought I'd just ask some questions to clarify things: * Is there some special reason why boolean constraints cannot be used with palm problems by default? * Do you have any suggestions for how to implement the PalmConstraint and PalmIntVarListener/PalmRealVarListener interfaces in the toplevel abstract boolean constraint classes? How should the variable index be treated and how about translating the awakeOnRestore* methods into other awake methods? Best regards Ola Leifler |
From: Sylvain B. <syl...@ce...> - 2006-02-27 10:41:02
|
Hello all, I am trying to set the time and node limits of the solver by using the setTimeLimit(int) and setNodeLimit(int) methods of class Solver. Unfortunately these methods don't seem to work well (at least in my program). I am using this instruction (s is an instance of class Solver): s.setTimeLimit(1000); Replacing this by : s.getSearchSolver().limits.add(new TimeLimit(s.getSearchSolver(), 1000)); seems to work. Did I misuse or misunderstand the methods setTimeLimit(int) and setNodeLimit(int) ? [I am using the CVS version of Choco.] Thank you in advance ! Regards, Sylvain Bouveret. |
From: <fra...@ya...> - 2006-02-08 10:20:39
|
Dear Michel, indeed, something was wrong in the construction of the CSP in case of Cardinality constraints (and we should hve noticed it, had we made a test on this constraint class). To repair it, one simply needs to modify the following two methods in AbstractLargeCompositeConstraint. As I don't have access to the CVS server from work, I am sending the patch by email. The package will be updated tonight on the site. (and sorry for the late answer !) François ------------------ public void setConstraintIndex(int i, int idx) { int constIdx = getSubConstraintIdx(i); if ((constIdx == -1)) { int varIdx = i - offsets[offsets.length - 1]; additionalIndices[varIdx] = idx; } else { int varIdx = (constIdx == 0) ? i : i - offsets[constIdx - 1]; constraints[constIdx].setConstraintIndex(varIdx, idx); } } public int getConstraintIdx(int i) { int constIdx = getSubConstraintIdx(i); if ((constIdx == -1)) { int varIdx = i - offsets[offsets.length - 1]; return additionalIndices[varIdx]; } else { int varIdx = (constIdx == 0) ? i : i - offsets[constIdx - 1]; return constraints[constIdx].getConstraintIdx(varIdx); } } --------------- ___________________________________________________________________________ Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international. Téléchargez sur http://fr.messenger.yahoo.com |
From: coletta <co...@li...> - 2006-02-03 10:22:30
|
Dear All, The CVS version of the method choco.integer.IntDomainVar getConstraint(int i) seems to be bugged: Bellows is Junit Test to show it. Shall we now use the getConstraintVector() method ? or will the getConstraint(int i) be fixed ? Best regards, -- Remi ------------------------------------------------------------- package choco.test.integer; import java.util.logging.Logger; import choco.Constraint; import choco.Problem; import junit.framework.TestCase; public class IntDomainVarTest extends TestCase { private Logger logger = Logger.getLogger("choco.test.integer.IntDomainVarTest"); private Problem pb; private choco.integer.IntDomainVar x; private choco.integer.IntDomainVar y; private Constraint c1; private Constraint c2; protected void setUp() { logger.fine("EqualXC Testing..."); pb = new Problem(); x = pb.makeBoundIntVar("X", 1, 5); y = pb.makeBoundIntVar("Y", 1, 5); c1 = pb.eq(x, 1); c2 = pb.eq(x, y); pb.post(c1); pb.post(c2); } public void test1() { logger.finer("test1"); assertEquals(x.getNbConstraints(), 2); assertEquals(y.getNbConstraints(), 1); assertNotNull(x.getConstraint(0)); assertNotNull(x.getConstraint(1)); assertNotNull(y.getConstraint(0)); } } ------------------------------------------------------------- |
From: <Mic...@ce...> - 2006-01-24 18:51:08
|
I would very much appreciate some help to make this simple program workin= g. The program compiles normally but when executed I get : =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -2 at choco.bool.AbstractLargeCompositeConstraint.setConstraintIndex(Abstra= ctLargeCompositeConstraint.java:119) at choco.AbstractConstraint.connectVar(AbstractConstraint.java:336) at=20 choco.bool.AbstractLargeBoolConstraintWithCounterOpposite.assignIndices(A= bstractLargeBoolConstraintWithCounterOpposite.java:69) at choco.bool.AbstractCompositeConstraint.addListener(AbstractCompositeC= onstraint.java:47) at choco.Problem.post(Problem.java:262) at p1.main(p1.java:29) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Here is the code : =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D import choco.Problem; import choco.Constraint; import choco.integer.IntVar; import java.util.*; public class p1 { public static void main(String[] args) throws Exception { Problem pb =3D new Problem(); IntVar x =3D pb.makeBoundIntVar("x", 1, 3); IntVar y =3D pb.makeBoundIntVar("y", 1, 3); IntVar z =3D pb.makeBoundIntVar("z", 1, 3); IntVar n =3D pb.makeBoundIntVar("n", 0, 4); Constraint c1 =3D pb.neq(x, y); Constraint c2 =3D pb.geq(y, z); Constraint c3 =3D pb.lt(x,z); Constraint[] cs =3D new Constraint[]{c1, c2, c3}; pb.post( pb.card(cs, n) ); } } Michel Lema=EEtre =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D ONERA/DCSD/CD Centre de Toulouse 2 avenue Edouard Belin - B.P. 4025 - 31055 Toulouse Cedex 4, FRANCE Tel : +33 (0)5 62 25 26 60 Fax : +33 (0)5 62 25 25 64 Michel . Lemaitre @ cert . fr |
From: coletta <co...@li...> - 2006-01-02 16:13:58
|
Dear All, The "++" is probably too much, isn't it ? /** * retrieving the total number of constraints over integers * * @return the total number of constraints over integers in the problem */ public final int getNbIntConstraints() { return this.nbConstraint++; //constraints.size(); } Happy new year 2006 and best wihes. May your dreams come true=20 (May Choco become the most popular solver in the world ;-) -- R=C3=A9mi |
From: Harri P. <fu...@ni...> - 2005-12-27 00:54:30
|
I solved the mystery. There is a bug in solve(), as it does not set "feasible" variable to null in the beginning. That's why it returned Boolean.TRUE in sudoku creation, because the same problem was solved previously successfully with different constraints. So I just added "pb.feasible = null;" to my code before all solve() calls. I also debugged Choco a bit to see where it fails to solve this particular sudoku, but it was beyond my understanding. Next I used another sudoku solver to see if it was solvable: http://sudoku.sourceforge.net/ It says that no, there is no solution. So actually there is no problem in Choco in this case, if the returned null is interpreted to mean that there is no solution (I know that it means that it couldn't solve it). I wonder if there is a bug in incrementalRun: public void incrementalRun() { baseWorld = problem.getEnvironment().getWorldIndex(); boolean feasibleRootState = true; try { newTreeSearch(); problem.propagate(); } catch (ContradictionException e) { feasibleRootState = false; } if (feasibleRootState) { problem.worldPush(); if (stopAtFirstSol) { nextSolution(); } else { while (nextSolution() == Boolean.TRUE) { ; } } //problem.worldPop(); if ((maxNbSolutionStored > 0) && (!stopAtFirstSol) && existsSolution()) { // HERE THERE IS NO ELSE WHERE problem.feasible WOULD BE SET TO FALSE OR null problem.worldPopUntil(baseWorld); restoreBestSolution(); } } else { problem.feasible = Boolean.FALSE; } endTreeSearch(); } -- Harri Harri Pesonen wrote: > There is something mysterious going on. I tried to solve that 22-digit > sudoku > > _9______2 > ___26_8_7 > _____3___ > 8_____1__ > 7___9__6_ > ___8_____ > __4_7____ > __2_5___9 > _69___75_ > > in my program, but pb.solve() returns null. So Choco is not able to > solve this one... still it was able to generate it??? When generating, > I use those worldPush/setInf/setSup/worldPopUntil calls that I don't > use when just solving. > > Changing the value in upper right corner (2) to something else has > this effect: > > 1: 0 solutions > 2: NULL > 3: 29 solutions > 4: 0 solutions > 5: 34 solutions > 6: 39 solutions > 8: 0 solutions > 9: 0 solutions > > What is going on? > > Here is another 22-digit sudoku that it can solve afterwards: > > _______42 > _8___1___ > _7__4__39 > ____38___ > _19__2___ > 5_______6 > _4_______ > 1____96__ > 23______7 > > What does it mean when solve() returns null? A bug somewhere? > > Here is the source code that I use for solving: > > static void sudokuVar(Problem pb, IntDomainVar[][] num, int[][] > givens) { > for (int i=0; i<9; i++) { > for (int j=0; j<9; j++) { > if (givens[i][j] != 0) > num[i][j] = pb.makeEnumIntVar("num" + i + "_" + j, > givens[i][j], givens[i][j]); > else > num[i][j] = pb.makeEnumIntVar("num" + i + "_" + j, > 1, 9); > } > } > } > static void sudokuConstraints(Problem pb, IntDomainVar[][] num) { > for (int j=0; j<9; j++) { > pb.post(pb.allDifferent(num[j])); > } > for (int i=0; i<9; i++) { > pb.post(pb.allDifferent(new IntVar[]{ > num[0][i], > num[1][i], > num[2][i], > num[3][i], > num[4][i], > num[5][i], > num[6][i], > num[7][i], > num[8][i] > })); > } > for (int i=0; i<3; i++) { > for (int j=0; j<3; j++) { > pb.post(pb.allDifferent(new IntVar[]{ > num[0+3*i][0+3*j], num[0+3*i][1+3*j], > num[0+3*i][2+3*j], > num[1+3*i][0+3*j], num[1+3*i][1+3*j], > num[1+3*i][2+3*j], > num[2+3*i][0+3*j], num[2+3*i][1+3*j], > num[2+3*i][2+3*j]})); > } > } > } > static boolean sudokuSolve(Problem pb, int digits) { > int nSolutions = 0; > Boolean solved = pb.solve(); > System.out.println("Digits: " + digits > + " Solved: " + solved > + " WorldIndex:" + pb.getWorldIndex() > + " Nodes:" + ((NodeLimit) > pb.getSolver().getSearchSolver().limits.get(1)).getNbTot()); > return solved == Boolean.TRUE; > } > static int sudokuSolutions(Problem pb, IntDomainVar[][] num, int > maxSolutions, int[][] solution) { > int nSolutions = 0; > do { > nSolutions++; > if (nSolutions > maxSolutions) > break; > if (solution != null && nSolutions == 1) { > for (int i=0; i<9; i++) { > for (int j=0; j<9; j++) { > solution[i][j] = num[i][j].getVal(); > } > } > } > } while (pb.nextSolution() == Boolean.TRUE); > return nSolutions; > } > static int sudoku(int[][] givens, int digits, int maxSolutions, > int[][] solution) { > Problem pb = new Problem(); > IntDomainVar[][] num = new IntDomainVar[9][9]; > sudokuVar(pb, num, givens); > sudokuConstraints(pb, num); > if (sudokuSolve(pb, digits)) > return sudokuSolutions(pb, num, maxSolutions, solution); > return 0; > } > public static final int[][] sudokuX = { > {0,9,0,0,0,0,0,0,2}, > {0,0,0,2,6,0,8,0,7}, > {0,0,0,0,0,3,0,0,0}, > {8,0,0,0,0,0,1,0,0}, > {7,0,0,0,9,0,0,6,0}, > {0,0,0,8,0,0,0,0,0}, > {0,0,4,0,7,0,0,0,0}, > {0,0,2,0,5,0,0,0,9}, > {0,6,9,0,0,0,7,5,0} > }; > public static void main(String[] args) { > sudoku(sudokuX, 22, 1, null); > } > > > -- Harri > > |
From: Harri P. <fu...@ni...> - 2005-12-26 01:40:54
|
There is something mysterious going on. I tried to solve that 22-digit sudoku _9______2 ___26_8_7 _____3___ 8_____1__ 7___9__6_ ___8_____ __4_7____ __2_5___9 _69___75_ in my program, but pb.solve() returns null. So Choco is not able to solve this one... still it was able to generate it??? When generating, I use those worldPush/setInf/setSup/worldPopUntil calls that I don't use when just solving. Changing the value in upper right corner (2) to something else has this effect: 1: 0 solutions 2: NULL 3: 29 solutions 4: 0 solutions 5: 34 solutions 6: 39 solutions 8: 0 solutions 9: 0 solutions What is going on? Here is another 22-digit sudoku that it can solve afterwards: _______42 _8___1___ _7__4__39 ____38___ _19__2___ 5_______6 _4_______ 1____96__ 23______7 What does it mean when solve() returns null? A bug somewhere? Here is the source code that I use for solving: static void sudokuVar(Problem pb, IntDomainVar[][] num, int[][] givens) { for (int i=0; i<9; i++) { for (int j=0; j<9; j++) { if (givens[i][j] != 0) num[i][j] = pb.makeEnumIntVar("num" + i + "_" + j, givens[i][j], givens[i][j]); else num[i][j] = pb.makeEnumIntVar("num" + i + "_" + j, 1, 9); } } } static void sudokuConstraints(Problem pb, IntDomainVar[][] num) { for (int j=0; j<9; j++) { pb.post(pb.allDifferent(num[j])); } for (int i=0; i<9; i++) { pb.post(pb.allDifferent(new IntVar[]{ num[0][i], num[1][i], num[2][i], num[3][i], num[4][i], num[5][i], num[6][i], num[7][i], num[8][i] })); } for (int i=0; i<3; i++) { for (int j=0; j<3; j++) { pb.post(pb.allDifferent(new IntVar[]{ num[0+3*i][0+3*j], num[0+3*i][1+3*j], num[0+3*i][2+3*j], num[1+3*i][0+3*j], num[1+3*i][1+3*j], num[1+3*i][2+3*j], num[2+3*i][0+3*j], num[2+3*i][1+3*j], num[2+3*i][2+3*j]})); } } } static boolean sudokuSolve(Problem pb, int digits) { int nSolutions = 0; Boolean solved = pb.solve(); System.out.println("Digits: " + digits + " Solved: " + solved + " WorldIndex:" + pb.getWorldIndex() + " Nodes:" + ((NodeLimit) pb.getSolver().getSearchSolver().limits.get(1)).getNbTot()); return solved == Boolean.TRUE; } static int sudokuSolutions(Problem pb, IntDomainVar[][] num, int maxSolutions, int[][] solution) { int nSolutions = 0; do { nSolutions++; if (nSolutions > maxSolutions) break; if (solution != null && nSolutions == 1) { for (int i=0; i<9; i++) { for (int j=0; j<9; j++) { solution[i][j] = num[i][j].getVal(); } } } } while (pb.nextSolution() == Boolean.TRUE); return nSolutions; } static int sudoku(int[][] givens, int digits, int maxSolutions, int[][] solution) { Problem pb = new Problem(); IntDomainVar[][] num = new IntDomainVar[9][9]; sudokuVar(pb, num, givens); sudokuConstraints(pb, num); if (sudokuSolve(pb, digits)) return sudokuSolutions(pb, num, maxSolutions, solution); return 0; } public static final int[][] sudokuX = { {0,9,0,0,0,0,0,0,2}, {0,0,0,2,6,0,8,0,7}, {0,0,0,0,0,3,0,0,0}, {8,0,0,0,0,0,1,0,0}, {7,0,0,0,9,0,0,6,0}, {0,0,0,8,0,0,0,0,0}, {0,0,4,0,7,0,0,0,0}, {0,0,2,0,5,0,0,0,9}, {0,6,9,0,0,0,7,5,0} }; public static void main(String[] args) { sudoku(sudokuX, 22, 1, null); } -- Harri |
From: Harri P. <fu...@ni...> - 2005-12-26 00:38:36
|
Sorry it seems that Thunderbird removes extra blanks, but this must work: _9______2 ___26_8_7 _____3___ 8_____1__ 7___9__6_ ___8_____ __4_7____ __2_5___9 _69___75_ Harri Pesonen wrote: > Sorry I don't know what happened to that sudoku when I sent the > message, here is a new try: > > 9 2| > 26 8 7| > 3 | > 8 1 | > 7 9 6 | > 8 | > 4 7 | > 2 5 9| > 69 75 | > > > Harri Pesonen wrote: > >> The latest version can generate difficult sudokus, even ones with >> only 22 digits, here is one: >> >> --------- >> 8 6 7 5 9 4 3 >> 9 6 4 2 97 >> 8 2 7 1 >> 6 8 1 53 >> --------- >> >> The code for generating a new random sudoku is here (I posted the >> variable and constraint initialization earlier): >> >> public void run() { >> int[][] values = new int[9][9]; >> Problem pb = new Problem(); >> IntDomainVar[][] num = new IntDomainVar[9][9]; >> Main.sudokuVar(pb, num, values); >> Main.sudokuConstraints(pb, num); >> int i = 0; >> int iTries = 0; // tries in the current level >> int tries = 0; >> Random r = new Random(); >> int minIndex = Integer.MAX_VALUE; // minimum index/nodes >> int minX = -1; >> int minY = -1; >> int minVal = 0; >> for (;;) { >> int x = r.nextInt(9); >> int y = r.nextInt(9); >> if (values[x][y] == 0) { >> int baseIndex = pb.getWorldIndex(); >> pb.worldPush(); >> int val = r.nextInt(9) + 1; >> values[x][y] = val; >> try { >> num[x][y].setInf(val); >> num[x][y].setSup(val); >> } catch (ContradictionException e) { >> System.out.println(e.toString()); >> } >> tries++; >> iTries++; >> Boolean solved = pb.solve(); >> int index = pb.getWorldIndex(); // number of >> nodes? >> if (solved && index < minIndex) { >> minIndex = index; >> minX = x; >> minY = y; >> minVal = val; >> } >> Log("Digits: " + (i + 1) >> + " Solved: " + solved >> + " Index:" + index); >> int nSol = 0; >> if (solved) { >> nSol = Main.sudokuSolutions(pb, num, 1, >> null); >> if (nSol == 1) { >> PrintSudoku(values); >> thisSudoku.setEnabled(true); >> SetStatus("OK in " + tries); >> SetSolutions("1"); >> LogSudoku(values); >> Log("Digits: " + jTextDigits.getText() >> + " Tries: " + tries + " " + jTextDifficulty.getText()); >> return; >> } >> } >> values[x][y] = 0; >> pb.worldPopUntil(baseIndex); >> if (nSol == 0 >> || i >= 10 && i < 15 && iTries < 10 >> || i >= 15 && i < 20 && iTries < 20 >> || i >= 20 && iTries < 40) { >> continue; >> } >> values[minX][minY] = minVal; >> try { >> num[minX][minY].setInf(minVal); >> num[minX][minY].setSup(minVal); >> } catch (ContradictionException e) { >> System.out.println(e.toString()); >> } >> i++; >> iTries = 0; >> minIndex = Integer.MAX_VALUE; >> PrintSudoku(values); >> SetStatus("Try # " + tries); >> SetSolutions("> 1"); >> } >> } >> } >> >> I updated jnlp as well: >> http://www.netsonic.fi/~kkylan05/SudokuWeb.jnlp >> >> -- Harri >> >> > > |
From: Harri P. <fu...@ni...> - 2005-12-26 00:36:22
|
Sorry I don't know what happened to that sudoku when I sent the message, here is a new try: 9 2| 26 8 7| 3 | 8 1 | 7 9 6 | 8 | 4 7 | 2 5 9| 69 75 | Harri Pesonen wrote: > The latest version can generate difficult sudokus, even ones with only > 22 digits, here is one: > > --------- > 8 6 7 5 9 4 3 > 9 6 4 2 97 > 8 2 7 1 > 6 8 1 53 > --------- > > The code for generating a new random sudoku is here (I posted the > variable and constraint initialization earlier): > > public void run() { > int[][] values = new int[9][9]; > Problem pb = new Problem(); > IntDomainVar[][] num = new IntDomainVar[9][9]; > Main.sudokuVar(pb, num, values); > Main.sudokuConstraints(pb, num); > int i = 0; > int iTries = 0; // tries in the current level > int tries = 0; > Random r = new Random(); > int minIndex = Integer.MAX_VALUE; // minimum index/nodes > int minX = -1; > int minY = -1; > int minVal = 0; > for (;;) { > int x = r.nextInt(9); > int y = r.nextInt(9); > if (values[x][y] == 0) { > int baseIndex = pb.getWorldIndex(); > pb.worldPush(); > int val = r.nextInt(9) + 1; > values[x][y] = val; > try { > num[x][y].setInf(val); > num[x][y].setSup(val); > } catch (ContradictionException e) { > System.out.println(e.toString()); > } > tries++; > iTries++; > Boolean solved = pb.solve(); > int index = pb.getWorldIndex(); // number of > nodes? > if (solved && index < minIndex) { > minIndex = index; > minX = x; > minY = y; > minVal = val; > } > Log("Digits: " + (i + 1) > + " Solved: " + solved > + " Index:" + index); > int nSol = 0; > if (solved) { > nSol = Main.sudokuSolutions(pb, num, 1, null); > if (nSol == 1) { > PrintSudoku(values); > thisSudoku.setEnabled(true); > SetStatus("OK in " + tries); > SetSolutions("1"); > LogSudoku(values); > Log("Digits: " + jTextDigits.getText() > + " Tries: " + tries + " " + jTextDifficulty.getText()); > return; > } > } > values[x][y] = 0; > pb.worldPopUntil(baseIndex); > if (nSol == 0 > || i >= 10 && i < 15 && iTries < 10 > || i >= 15 && i < 20 && iTries < 20 > || i >= 20 && iTries < 40) { > continue; > } > values[minX][minY] = minVal; > try { > num[minX][minY].setInf(minVal); > num[minX][minY].setSup(minVal); > } catch (ContradictionException e) { > System.out.println(e.toString()); > } > i++; > iTries = 0; > minIndex = Integer.MAX_VALUE; > PrintSudoku(values); > SetStatus("Try # " + tries); > SetSolutions("> 1"); > } > } > } > > I updated jnlp as well: > http://www.netsonic.fi/~kkylan05/SudokuWeb.jnlp > > -- Harri > > |
From: Harri P. <fu...@ni...> - 2005-12-26 00:29:23
|
The latest version can generate difficult sudokus, even ones with only 22 digits, here is one: --------- 8 6 7 5 9 4 3 9 6 4 2 97 8 2 7 1 6 8 1 53 --------- The code for generating a new random sudoku is here (I posted the variable and constraint initialization earlier): public void run() { int[][] values = new int[9][9]; Problem pb = new Problem(); IntDomainVar[][] num = new IntDomainVar[9][9]; Main.sudokuVar(pb, num, values); Main.sudokuConstraints(pb, num); int i = 0; int iTries = 0; // tries in the current level int tries = 0; Random r = new Random(); int minIndex = Integer.MAX_VALUE; // minimum index/nodes int minX = -1; int minY = -1; int minVal = 0; for (;;) { int x = r.nextInt(9); int y = r.nextInt(9); if (values[x][y] == 0) { int baseIndex = pb.getWorldIndex(); pb.worldPush(); int val = r.nextInt(9) + 1; values[x][y] = val; try { num[x][y].setInf(val); num[x][y].setSup(val); } catch (ContradictionException e) { System.out.println(e.toString()); } tries++; iTries++; Boolean solved = pb.solve(); int index = pb.getWorldIndex(); // number of nodes? if (solved && index < minIndex) { minIndex = index; minX = x; minY = y; minVal = val; } Log("Digits: " + (i + 1) + " Solved: " + solved + " Index:" + index); int nSol = 0; if (solved) { nSol = Main.sudokuSolutions(pb, num, 1, null); if (nSol == 1) { PrintSudoku(values); thisSudoku.setEnabled(true); SetStatus("OK in " + tries); SetSolutions("1"); LogSudoku(values); Log("Digits: " + jTextDigits.getText() + " Tries: " + tries + " " + jTextDifficulty.getText()); return; } } values[x][y] = 0; pb.worldPopUntil(baseIndex); if (nSol == 0 || i >= 10 && i < 15 && iTries < 10 || i >= 15 && i < 20 && iTries < 20 || i >= 20 && iTries < 40) { continue; } values[minX][minY] = minVal; try { num[minX][minY].setInf(minVal); num[minX][minY].setSup(minVal); } catch (ContradictionException e) { System.out.println(e.toString()); } i++; iTries = 0; minIndex = Integer.MAX_VALUE; PrintSudoku(values); SetStatus("Try # " + tries); SetSolutions("> 1"); } } } I updated jnlp as well: http://www.netsonic.fi/~kkylan05/SudokuWeb.jnlp -- Harri |
From: Patrick P. <pa...@dc...> - 2005-12-25 13:32:33
|
Hi everyone Helmut Simmonis wrote a cp05 workshop paper on modelling & solving = Sudoku problems. It should be easy to find. =20 I think you are right that an instance should be solvable by some = consistency level (path consistency and maybe singleton arc) otherwise = us poor humans would have given up on sudoku early on.=20 =20 Barbara Smith has also spent some time looking at Sudoku (but you'd = expect that, wouldn't you :) =20 Merry Christmas =20 Patrick =20 -- Patrick Prosser tel: +44 141 330 4934 Computing Science fax: +44 141 330 4913 University of Glasgow web: http://www.dcs.gla.ac.uk/~pat/ Glasgow G12 8RZ email: pa...@dc... ________________________________ From: cho...@li... on behalf of = cho...@li... Sent: Sun 25/12/2005 04:12 To: cho...@li... Subject: Choco-users digest, Vol 1 #51 - 3 msgs Send Choco-users mailing list submissions to cho...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/choco-users or, via email, send a message with subject or body 'help' to cho...@li... You can reach the person managing the list at cho...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of Choco-users digest..." Today's Topics: 1. Re: Re: Sudoku problem (Maurice Diamantini (dom)) 2. Re: Re: Sudoku problem (Harri Pesonen) 3. Re: Re: Sudoku problem (Harri Pesonen) --__--__-- Message: 1 Cc: "Maurice Diamantini (dom)" <md...@fr...>, cho...@li... From: Maurice Diamantini (dom) <md...@fr...> Subject: Re: [Choco-users] Re: Sudoku problem Date: Sat, 24 Dec 2005 13:57:10 +0100 To: Harri Pesonen <fu...@ni...> Le 24 d=3DE9c. 05 =3DE0 03:19, Harri Pesonen a =3DE9crit : > Hello Maurice, combining your codes with Hadrien's gives me: > > static void test() { > Problem pb =3D3D new Problem(); > IntDomainVar v1 =3D3D pb.makeEnumIntVar("v1",1,9); > IntDomainVar v2 =3D3D pb.makeEnumIntVar("v2",1,9); > IntDomainVar v3 =3D3D pb.makeEnumIntVar("v3",1,9); > pb.post(pb.allDifferent(new IntVar[]{v1,v2,v3})); > // here is the initial state > pb.worldPush(); > try { > v1.setInf(2); // works before the problem has been solved > v1.setSup(8); > } catch (ContradictionException e) { > System.out.println(e.toString()); > } > pb.solve(); > System.out.println(" " + v1.getVal() + " " + v2.getVal() + " = =3D20=3D > " + v3.getVal()); > pb.worldPop(); // I want to reset the problem to the initial = =3D20=3D > state Your problem is that solve() do many worldPush(), so your last =3D20 worldPop() put you into some final solving state, not your original world. You have to record your one "starting state" from any current state : // at least one worldPush() should have been done here //... int baseWorld =3D3D pb.getWorldIndex(); while (!found) { s.pb.worldPopUntil(baseWorld); s.pb.worldPush(); // any solve(), setVar() setInf() and pb.propagate() // can be done here.. found =3D3D tryHeuristic(); } > try { > v1.setInf(3); // does not work Because you restored a world in which 3 is no more in v1 domain > v1.setSup(5); > } catch (ContradictionException e) { > System.out.println(e.toString()); // I get this > } > pb.solve(); > System.out.println(" " + v1.getVal() + " " + v2.getVal() + " = =3D20=3D > " + v3.getVal()); > } > > Unfortunately this does not work either. Hadrien's code works but = =3D20 > it does not do what I want. Because I want to minimize the =3D20 > constraint building cost, I just want to change the original =3D20 > constraints one variable at a time, until I get just one solution. What do you call initial "contraint" is the initial "domain" variables I suppose. I think an human solvable sudoku should be immediat to solve with choco. So another way to find solvable sudoku could be to sove over filled grid (which should raise immediately an exception), then free instanciated variable one at a time, until you reach a faisable problem. > It's not a big problem if this is not possible, but I am just =3D20 > wondering. > > You can see what I am doing by running this: > http://www.netsonic.fi/~kkylan05/SudokuWeb.jnlp Not be able to lauch it. > Clicking Random will generate a new random sudoku. I have a better = =3D20 > version already, which generates more difficult sudokus, but it is = =3D20 > much slower. I can probably make it faster by checking the number = =3D20 > of nodes and backtracks used for solving. > > Thanks, Harri Good look, Maurice --__--__-- Message: 2 Date: Sat, 24 Dec 2005 22:39:16 +0200 From: Harri Pesonen <fu...@ni...> To: "Maurice Diamantini (dom)" <md...@fr...> Cc: cho...@li... Subject: Re: [Choco-users] Re: Sudoku problem Thanks, I can confirm that this works. This will make sudoku = creation=3D20 much faster. As for my Sudoku page, you should probably save SudokuWeb.jnlp to=3D20 desktop and try to launch it from there. It requires Java 1.5. -- Harri Maurice Diamantini (dom) wrote: > > Le 24 d=3DE9c. 05 =3DE0 03:19, Harri Pesonen a =3DE9crit : > >> Hello Maurice, combining your codes with Hadrien's gives me: >> >> static void test() { >> Problem pb =3D3D new Problem(); >> IntDomainVar v1 =3D3D pb.makeEnumIntVar("v1",1,9); >> IntDomainVar v2 =3D3D pb.makeEnumIntVar("v2",1,9); >> IntDomainVar v3 =3D3D pb.makeEnumIntVar("v3",1,9); >> pb.post(pb.allDifferent(new IntVar[]{v1,v2,v3})); >> // here is the initial state >> pb.worldPush(); >> try { >> v1.setInf(2); // works before the problem has been solved >> v1.setSup(8); >> } catch (ContradictionException e) { >> System.out.println(e.toString()); >> } >> pb.solve(); >> System.out.println(" " + v1.getVal() + " " + v2.getVal() + " = =3D20 >> " + v3.getVal()); >> pb.worldPop(); // I want to reset the problem to the initial = =3D20 >> state > > > Your problem is that solve() do many worldPush(), so your last =3D20 > worldPop() > put you into some final solving state, not your original world. > You have to record your one "starting state" from any current state : > > // at least one worldPush() should have been done here > //... > int baseWorld =3D3D pb.getWorldIndex(); > > while (!found) { > s.pb.worldPopUntil(baseWorld); > s.pb.worldPush(); > > // any solve(), setVar() setInf() and pb.propagate() > // can be done here.. > found =3D3D tryHeuristic(); > } > > > > > >> try { >> v1.setInf(3); // does not work > > > Because you restored a world in which 3 is no more in v1 domain > >> v1.setSup(5); >> } catch (ContradictionException e) { >> System.out.println(e.toString()); // I get this >> } >> pb.solve(); >> System.out.println(" " + v1.getVal() + " " + v2.getVal() + " = =3D20 >> " + v3.getVal()); >> } >> >> Unfortunately this does not work either. Hadrien's code works but = it=3D20 >> does not do what I want. Because I want to minimize the = constraint=3D20 >> building cost, I just want to change the original constraints = one=3D20 >> variable at a time, until I get just one solution. > > > What do you call initial "contraint" is the initial "domain" variables > I suppose. > I think an human solvable sudoku should be immediat to solve with = choco=3D . > So another way to find solvable sudoku could be to sove over filled = gri=3D d > (which should raise immediately an exception), then free instanciated > variable one at a time, until you reach a faisable problem. > > >> It's not a big problem if this is not possible, but I am just =3D20 >> wondering. >> >> You can see what I am doing by running this: >> http://www.netsonic.fi/~kkylan05/SudokuWeb.jnlp > > > Not be able to lauch it. > >> Clicking Random will generate a new random sudoku. I have a better = =3D20 >> version already, which generates more difficult sudokus, but it is = =3D20 >> much slower. I can probably make it faster by checking the number = of=3D20 >> nodes and backtracks used for solving. >> >> Thanks, Harri > > > Good look, > Maurice > > > --__--__-- Message: 3 Date: Sun, 25 Dec 2005 04:24:36 +0200 From: Harri Pesonen <fu...@ni...> To: Hadrien <had...@em...> Cc: cho...@li... Subject: Re: [Choco-users] Re: Sudoku problem By the way, I noticed that nodes =3D ((NodeLimit) pb.getSolver().getSearchSolver().limits.get(1)).getNbTot(); results in the same as pb.getWorldIndex(), at least in my case. And that I can use this information to optimize sudoku creation, the smaller the better (less digits in the resulting sudoku so more difficult). -- Harri Hadrien wrote: > Hello, >=20 > 1) That's true, we have a problem with the cvs right now, it does not > delete some classes correctly. I can send you the last choco.jar > if you want. Otherwise delete the concrete classes > choco.set.SetModeler and choco.integer.var.IntDomainVar, it should > compile correctly. >=20 > 2) You can indeed add a constraint on the fly. Have look at the > following code : >=20 > public static void main(String[] args) { > Problem pb =3D new Problem(); > IntDomainVar v1 =3D pb.makeEnumIntVar("v1",1,9); > IntDomainVar v2 =3D pb.makeEnumIntVar("v2",1,9); > IntDomainVar v3 =3D pb.makeEnumIntVar("v3",1,9); >=20 > pb.post(pb.allDifferent(new IntVar[]{v1,v2,v3})); > pb.solve(); > System.out.println(" " + v1.getVal() + " " + v2.getVal() + " " > + v3.getVal()); > pb.postCut(pb.geq(v1,6)); > pb.nextSolution(); > System.out.println(" " + v1.getVal() + " " + v2.getVal() + " " > + v3.getVal()); >=20 > } >=20 > 3) I can send you a more complete documentation about search in > attachment. The whole user guide will come soon. But because choco is > changing right now, we were waiting for the new version. >=20 > 4) There is not yet any clear api to access the number of nodes and > time spent for search. > You can use the following ugly line of code to get the number of nodes > (a proper way to access it > will come soon) : >=20 > nodes =3D ((NodeLimit) > pb.getSolver().getSearchSolver().limits.get(1)).getNbTot(); >=20 > However the number of backtrack is not provided by default. But you > can extend the limit mechanism of choco > to get it. For example create the following class : >=20 > public class BacktLimit extends AbstractGlobalSearchLimit { > public BacktLimit(AbstractGlobalSearchSolver theSolver, int > theLimit) { > super(theSolver, theLimit); > } >=20 > public boolean newNode(AbstractGlobalSearchSolver solver) { > return true; > } >=20 > public boolean endNode(AbstractGlobalSearchSolver solver) { > nb++; > return true; > } > } > Then instead of calling a pb.solve() do something like : >=20 > Solver s =3D pb.getSolver(); > s.setFirstSolution(true); > s.generateSearchSolver(pb); > s.getSearchSolver().limits.add(new BacktLimit = (s.getSearchSolver(),-1)); > s.launch(); >=20 > and access to your own limit by : >=20 > backt =3D ((BacktLimit) > pb.getSolver().getSearchSolver().limits.get(2)).getNbTot(); >=20 > I can send you the not yet available documentation that explains the > whole mechanism >=20 > I hope it helps until everything will be set up >=20 > Hadrien >=20 --__--__-- _______________________________________________ Choco-users mailing list Cho...@li... https://lists.sourceforge.net/lists/listinfo/choco-users End of Choco-users Digest |
From: Harri P. <fu...@ni...> - 2005-12-25 02:24:36
|
By the way, I noticed that nodes = ((NodeLimit) pb.getSolver().getSearchSolver().limits.get(1)).getNbTot(); results in the same as pb.getWorldIndex(), at least in my case. And that I can use this information to optimize sudoku creation, the smaller the better (less digits in the resulting sudoku so more difficult). -- Harri Hadrien wrote: > Hello, > > 1) That's true, we have a problem with the cvs right now, it does not > delete some classes correctly. I can send you the last choco.jar > if you want. Otherwise delete the concrete classes > choco.set.SetModeler and choco.integer.var.IntDomainVar, it should > compile correctly. > > 2) You can indeed add a constraint on the fly. Have look at the > following code : > > public static void main(String[] args) { > Problem pb = new Problem(); > IntDomainVar v1 = pb.makeEnumIntVar("v1",1,9); > IntDomainVar v2 = pb.makeEnumIntVar("v2",1,9); > IntDomainVar v3 = pb.makeEnumIntVar("v3",1,9); > > pb.post(pb.allDifferent(new IntVar[]{v1,v2,v3})); > pb.solve(); > System.out.println(" " + v1.getVal() + " " + v2.getVal() + " " > + v3.getVal()); > pb.postCut(pb.geq(v1,6)); > pb.nextSolution(); > System.out.println(" " + v1.getVal() + " " + v2.getVal() + " " > + v3.getVal()); > > } > > 3) I can send you a more complete documentation about search in > attachment. The whole user guide will come soon. But because choco is > changing right now, we were waiting for the new version. > > 4) There is not yet any clear api to access the number of nodes and > time spent for search. > You can use the following ugly line of code to get the number of nodes > (a proper way to access it > will come soon) : > > nodes = ((NodeLimit) > pb.getSolver().getSearchSolver().limits.get(1)).getNbTot(); > > However the number of backtrack is not provided by default. But you > can extend the limit mechanism of choco > to get it. For example create the following class : > > public class BacktLimit extends AbstractGlobalSearchLimit { > public BacktLimit(AbstractGlobalSearchSolver theSolver, int > theLimit) { > super(theSolver, theLimit); > } > > public boolean newNode(AbstractGlobalSearchSolver solver) { > return true; > } > > public boolean endNode(AbstractGlobalSearchSolver solver) { > nb++; > return true; > } > } > Then instead of calling a pb.solve() do something like : > > Solver s = pb.getSolver(); > s.setFirstSolution(true); > s.generateSearchSolver(pb); > s.getSearchSolver().limits.add(new BacktLimit (s.getSearchSolver(),-1)); > s.launch(); > > and access to your own limit by : > > backt = ((BacktLimit) > pb.getSolver().getSearchSolver().limits.get(2)).getNbTot(); > > I can send you the not yet available documentation that explains the > whole mechanism > > I hope it helps until everything will be set up > > Hadrien > |
From: Harri P. <fu...@ni...> - 2005-12-24 20:39:13
|
Thanks, I can confirm that this works. This will make sudoku creation=20 much faster. As for my Sudoku page, you should probably save SudokuWeb.jnlp to=20 desktop and try to launch it from there. It requires Java 1.5. -- Harri Maurice Diamantini (dom) wrote: > > Le 24 d=E9c. 05 =E0 03:19, Harri Pesonen a =E9crit : > >> Hello Maurice, combining your codes with Hadrien's gives me: >> >> static void test() { >> Problem pb =3D new Problem(); >> IntDomainVar v1 =3D pb.makeEnumIntVar("v1",1,9); >> IntDomainVar v2 =3D pb.makeEnumIntVar("v2",1,9); >> IntDomainVar v3 =3D pb.makeEnumIntVar("v3",1,9); >> pb.post(pb.allDifferent(new IntVar[]{v1,v2,v3})); >> // here is the initial state >> pb.worldPush(); >> try { >> v1.setInf(2); // works before the problem has been solved >> v1.setSup(8); >> } catch (ContradictionException e) { >> System.out.println(e.toString()); >> } >> pb.solve(); >> System.out.println(" " + v1.getVal() + " " + v2.getVal() + " =20 >> " + v3.getVal()); >> pb.worldPop(); // I want to reset the problem to the initial =20 >> state > > > Your problem is that solve() do many worldPush(), so your last =20 > worldPop() > put you into some final solving state, not your original world. > You have to record your one "starting state" from any current state : > > // at least one worldPush() should have been done here > //... > int baseWorld =3D pb.getWorldIndex(); > > while (!found) { > s.pb.worldPopUntil(baseWorld); > s.pb.worldPush(); > > // any solve(), setVar() setInf() and pb.propagate() > // can be done here.. > found =3D tryHeuristic(); > } > > > > > >> try { >> v1.setInf(3); // does not work > > > Because you restored a world in which 3 is no more in v1 domain > >> v1.setSup(5); >> } catch (ContradictionException e) { >> System.out.println(e.toString()); // I get this >> } >> pb.solve(); >> System.out.println(" " + v1.getVal() + " " + v2.getVal() + " =20 >> " + v3.getVal()); >> } >> >> Unfortunately this does not work either. Hadrien's code works but it=20 >> does not do what I want. Because I want to minimize the constraint=20 >> building cost, I just want to change the original constraints one=20 >> variable at a time, until I get just one solution. > > > What do you call initial "contraint" is the initial "domain" variables > I suppose. > I think an human solvable sudoku should be immediat to solve with choco= . > So another way to find solvable sudoku could be to sove over filled gri= d > (which should raise immediately an exception), then free instanciated > variable one at a time, until you reach a faisable problem. > > >> It's not a big problem if this is not possible, but I am just =20 >> wondering. >> >> You can see what I am doing by running this: >> http://www.netsonic.fi/~kkylan05/SudokuWeb.jnlp > > > Not be able to lauch it. > >> Clicking Random will generate a new random sudoku. I have a better =20 >> version already, which generates more difficult sudokus, but it is =20 >> much slower. I can probably make it faster by checking the number of=20 >> nodes and backtracks used for solving. >> >> Thanks, Harri > > > Good look, > Maurice > > > |