| 28 | } |
| 29 | |
| 30 | int ExistOptVar::getVal(Strategy s) { |
| 31 | // cout<<"getval on existoptvar "<<varId<<" at scope "<<scopeId<<endl; |
| 32 | if (s.isTrue()) {cout<<"EOV "<<varId<<" scope "<<scopeId<<" try to get opt value on TRUE"<<endl;abort();} |
| 33 | if (s.isFalse()) {cout<<"EOV "<<varId<<" scope "<<scopeId<<"Try to get opt value on FALSE"<<endl;abort();} // (sub)Strategy must neither be false |
| 34 | if (s.isDummy()) {cout<<"EOV "<<varId<<" scope "<<scopeId<<"Try to get opt value on Dummy"<<endl;abort();} // nor begin with a universal scope |
| 35 | if (s.scope() > scopeId) {cout<<"EOV "<<varId<<" scope "<<scopeId<<"Try to get opt value on asubstrategy not containing opt variable"<<endl;abort();} // nor begin at a scope after the one we want ^^ |
| 36 | |
| 37 | if (s.scope() == scopeId) return s.value(varId-s.VMin()); |
| 38 | // s.getTag() < scope |
| 39 | Strategy nextScope = s.getChild(0); |
| 40 | |
| 41 | return getVal(nextScope); |
| 42 | } |
| 43 | |
| 44 | int ExistOptVar::getScope() {return scopeId;} |
| 45 | |