Hi, Just as a side comment: always write a copy constructor even if you are not using search (currently). Future versions of Gecode might invoke copying for garbage collection behind your back (earlier versions actually did). So always implement!
Christian -- Christian Schulte, http://www.imit.kth.se/~schulte/ -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mikael Zayenz Lagerkvist Sent: Tuesday, November 06, 2007 7:11 AM To: Malcolm Ryan Cc: gecode list Subject: Re: [gecode-users] Gecode/J: What is Space abstract? On 11/6/07, Malcolm Ryan <[EMAIL PROTECTED]> wrote: > On 05/11/2007, at 2:57 PM, Mikael Zayenz Lagerkvist wrote: > > > On 11/5/07, Malcolm Ryan <[EMAIL PROTECTED]> wrote: > >> What is the Space class abstract in Gecode/J when it doesn't have any > >> abstract methods? Is there any harm in doing: > >> > >> Space space = new Space() {}; > >> > > > > While there is no harm in doing the above (as far as I can recall at > > the moment), I'm not sure I see what the point would be. The only > > information you would be able to get out of a problem set up in the > > space-variable would be if there are any solutions, since you can not > > access the variables of the problem. > > I'm writing JUnit tests, for my code to check that the system of > constraints I am creating are valid. I want to do something like: > > Space space = new Space(); > > // ... create vars in space ... > IntVar x = new IntVar(space, ...) > IntVar y = new IntVar(space, ...) > > // ... post constraints ... > mySystem.postConstraints(space, x, y, ...) > > // propagate > space.status(); > > // test results > assertTrue(x.assigned()); > assertEquals(0, x.val()); > // etc Ok, if you do not want to do any search, I understand how can use it. > What is the purpose of the copy constructor in the Queens.java > example? Should every space have such a constructor? When is it called? It is called when copying a Space during search, so if you want to search for a solution you need to implement it. Anything that you want to refer to in a solution needs to be updated here. Cheers, Mikael PS. if you haven't seen it before, http://www.gecode.org/gecodej/doc/PageGlossary.html has some short descriptions of the terms often used for Gecode(/J). -- Mikael Zayenz Lagerkvist, http://www.ict.kth.se/~zayenz/ _______________________________________________ Gecode users mailing list [EMAIL PROTECTED] https://www.gecode.org/mailman/listinfo/gecode-users _______________________________________________ Gecode users mailing list [EMAIL PROTECTED] https://www.gecode.org/mailman/listinfo/gecode-users
