[gecode-users] constraints on solved spaces

Stanimir Dragiev stanio at cs.tu-berlin.de
Wed Feb 6 12:00:56 CET 2008


Hello Guido, 

* Guido Tack <tack at ps.uni-sb.de> [2008-02-05 09:32]:
> The rule is that some easy inferences may be done immediately on  
> posting the constraint, but full propagation only happens when you  
> call status.
> 
> [...]
> 
> Constraints on solved spaces are exactly the same as on unsolved  
> spaces.  You're not guaranteed to get a solution without search.
> 
> [...]
> 
> The problem with your approach is that if you add variables and  
> constraints, you're not guaranteed that all the variables will be  
> assigned after calling status.  It works in the above example, because  
> you add a single constraint, and the new variable can be computed as a  
> function from the old variables.  As soon as you try something more  
> involved, you may need a nested search to actually determine the  
> values.  Another disadvantage is that your version will be  
> considerably slower than a simple computation of the sum.


The real functions actually return an IntVar, and for a
solved space I take the .val(), for unsolved space I add
some constraints on the Var.

My intention was to have the computation code only once for
the sake of simplicity and maintainability, sacrificing some
(minimal, as I thought) efficiency.

I didn't see the issue with the search. 
Thank you very much for your explanation.

greetz
stanio_




More information about the gecode-users mailing list