| 1987 | } |
| 1988 | |
| 1989 | void |
| 1990 | FlatZincSpace::constrain(const Space& s) { |
| 1991 | if (_optVarIsInt) { |
| 1992 | if (_method == MIN) |
| 1993 | rel(*this, iv[_optVar], IRT_LE, |
| 1994 | static_cast<const FlatZincSpace*>(&s)->iv[_optVar].val()); |
| 1995 | else if (_method == MAX) |
| 1996 | rel(*this, iv[_optVar], IRT_GR, |
| 1997 | static_cast<const FlatZincSpace*>(&s)->iv[_optVar].val()); |
| 1998 | } else { |
| 1999 | #ifdef GECODE_HAS_FLOAT_VARS |
| 2000 | if (_method == MIN) |
| 2001 | rel(*this, fv[_optVar], FRT_LE, |
| 2002 | static_cast<const FlatZincSpace*>(&s)->fv[_optVar].val()-step); |
| 2003 | else if (_method == MAX) |
| 2004 | rel(*this, fv[_optVar], FRT_GR, |
| 2005 | static_cast<const FlatZincSpace*>(&s)->fv[_optVar].val()+step); |
| 2006 | #endif |
| 2007 | } |
| 2008 | } |
| 2009 | |
| 2010 | bool |
| 2011 | FlatZincSpace::slave(const MetaInfo& mi) { |