[gecode-users] Gecode/J: What is Space abstract?

Malcolm Ryan malcolmr at cse.unsw.edu.au
Tue Nov 6 00:38:23 CET 2007


On 05/11/2007, at 2:57 PM, Mikael Zayenz Lagerkvist wrote:

> On 11/5/07, Malcolm Ryan <malcolmr at cse.unsw.edu.au> 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

What is the purpose of the copy constructor in the Queens.java  
example? Should every space have such a constructor? When is it called?

Malcolm

--
      "The act of defending any of the cardinal virtues has today all
       the exhilaration of a vice."
                                     - G.K.Chesterton A Defense of  
Humility







More information about the gecode-users mailing list