| 193 | } |
| 194 | |
| 195 | MySpace* QcspUnblockable::getSpace(int scope) { |
| 196 | if (scope<0 || scope>nbSpaces) { |
| 197 | cout<<"I return NULL coz of bad scope value (<0)"<<endl; |
| 198 | return NULL; |
| 199 | } |
| 200 | if (scope==nbSpaces) { |
| 201 | if (goal->status() == SS_FAILED) { |
| 202 | cout<<"I return NULL coz goal is failed"<<endl; |
| 203 | return NULL; |
| 204 | } |
| 205 | // cout<<"I return the goal"<<endl; |
| 206 | return static_cast<MySpace*>(goal->clone()); |
| 207 | } |
| 208 | if (arul->status() == SS_FAILED) { |
| 209 | cout<<"I return NULL coz scope "<<scope<<" is failed"<<endl; |
| 210 | return NULL; |
| 211 | } |
| 212 | // cout<<"I return the rule "<<scope<<endl; |
| 213 | MySpace* ret= (static_cast<MySpace*>(arul->clone())); |
| 214 | IntVarArgs iva(vars[scope].size()); |
| 215 | BoolVarArgs bva(bvars[scope].size()); |
| 216 | // cout << "sizes : " <<iva.size() << " " << bva.size()<<endl; |
| 217 | for (int i=0;i<iva.size();i++) { |
| 218 | int idx = (vars[scope])[i]; |
| 219 | iva[i]=*( static_cast<IntVar*>(ret->v[idx]) ); |
| 220 | } |
| 221 | for (int i=0;i<bva.size();i++) { |
| 222 | int idx = (bvars[scope])[i]; |
| 223 | bva[i]=*( static_cast<BoolVar*>(ret->v[idx]) ); |
| 224 | } |
| 225 | br->branch(ret,iva,bva); |
| 226 | |
| 227 | return ret; |
| 228 | } |
| 229 | |
| 230 | |
| 231 | MySpace* QcspUnblockable::getGoal() { |