MCPcopy Create free account
hub / github.com/Gecode/gecode / getSpace

Method getSpace

contribs/qecode/QCSPPlusUnblockable.cc:195–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195MySpace* 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
231MySpace* QcspUnblockable::getGoal() {

Callers

nothing calls this directly

Calls 4

statusMethod · 0.45
cloneMethod · 0.45
sizeMethod · 0.45
branchMethod · 0.45

Tested by

no test coverage detected