- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Solvers/Entailment/GI/GoalInterpreter.cpp

    00001
    00002 //
    00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00009 // Organization:        Model-based Embedded and Robotic Systems Group
    00010 //                                      Massachusetts Institute of Technology
    00011 //
    00013
    00014 #ifdef _MSC_VER
    00015 #pragma warning( disable : 4786 )
    00016 #endif
    00017
    00018 #include "GoalInterpreter.h"
    00019
    00020 #include <cstdlib>
    00021 #include <cstdio>
    00022 #include <cassert>
    00023 #include <fstream>
    00024
    00025 #include <Mers/Solvers/SAT/GATSAT/OpSAT/Opsat.h>
    00026
    00027 #include <Mers/Solvers/SAT/ISAT/ISATTester.h>
    00028
    00029 #include <Mers/Planning/Reactive/CCA/rpCCAutomata.h>
    00030
    00031 #include <Mers/Utils/Containers/intList.h>
    00032
    00033 #include <Mers/Generators/BFIG/BFIGGenerator.h>
    00034
    00036
    00037 using namespace Mers::Solvers::Entailment::GI;
    00038 using Mers::Solvers::Entailment::GoalInterpreterInterface;
    00039 using Mers::Solvers::SAT::GATSAT::OpSAT::Opsat;
    00040 using Mers::Solvers::SAT::ISAT::ISATTester;
    00041 using Mers::Solvers::SAT::AssignmentTesterInterface;
    00042 using Mers::Generators::BFIG::BFIGGenerator;
    00043 using Mers::Models::CCA::CCAModel;
    00044 using Mers::Models::CCA::CCAVariables;
    00045 using Mers::Models::CCA::CCAVariable;
    00046 using Mers::Models::CCA::CCAValue;
    00047 using Mers::Models::CCA::CCAState;
    00048 using Mers::Models::CCA::CCADomain;
    00049 using Mers::Models::CCA::CCAAutomaton;
    00050 using Mers::Models::Base::BaseModelClause;
    00051 using Mers::Models::Base::BaseModelVariable;
    00052 using Mers::Models::Base::BaseModelValue;
    00053 using Mers::Models::Base::BaseModelAssignment;
    00054 using Mers::Models::Base::BaseModelAssignmentArray;
    00055 using Mers::Models::Base::BaseModelDomain;
    00056 using Mers::Utils::Lang::String;
    00057 using Mers::Utils::Containers::intList;
    00058 using Mers::Utils::Containers::IntegerArray;
    00059 using std::ostream;
    00060 using std::cout;
    00061 using std::cerr;
    00062 using std::endl;
    00063 using std::vector;
    00064
    00066
    00067 /*#
    00068         // useful in conversions. Stupidly absent in C++...
    00069 //static String
    00070 //intString(int n)
    00071 //{
    00072 //      char buf[32];
    00073 //      sprintf(buf, "%d", n);
    00074 //      return String(buf);
    00075 //}
    00076
    00078
    00079 //static String
    00080 //intString(unsigned int n)
    00081 //{
    00082 //      char buf[32];
    00083 //      sprintf(buf, "%u", n);
    00084 //      return String(buf);
    00085 //}
    00086 */
    00087
    00088
    00090 //      CONSTRUCTOR
    00092
    00093 GoalInterpreter::GoalInterpreter(CCAModel const * m, bool initialDebug)
    00094 //: ModelConvertor(m, initialDebug), progressHistory() , observationHistory()
    00095 : mSearchVariables(false),
    00096     mAllConstraints(m->get_all_constraints()),
    00097     progressHistory(), observationHistory(),
    00098     antiGoal(BaseModelClause::DISJUNCTIVE, true)
    00099 {
    00100         assert(m);
    00101
    00102         model = m;
    00103         debug = initialDebug;
    00104         //giHelper.parent = this;
    00105
    00106         clearGoal();
    00107
    00108         // Copy a reference to all the variables we care about.
    00109         CCAVariables const &allVariables = *(model->getVariables());
    00110         for(unsigned int x = 0; x < allVariables.getLength(); x++){
    00111                 if(allVariables[x]->getVariableType() == BaseModelVariable::State) {
    00112                         CCAVariable const * ccaVar = allVariables[x];
    00113                         mSearchVariables.pushBack((BaseModelVariable *) ccaVar);
    00114                 }
    00115         }
    00116
    00117         // Cache our initial cost function.
    00118         unsigned int largestDomain = 0;
    00119         unsigned int numVars = mSearchVariables.getLength();
    00120         // The margin left between the norminal, fault, and cutoff costs.
    00121         double margin = 1.1;
    00122         // Since the maximum nominal cost for any one variable is 1, the
    00123         // maxNominalCost is just numVars * 1.
    00124         double maxNominalCost = numVars;
    00125         double failureCost = maxNominalCost * margin;
    00126         double maxValidCost = failureCost * numVars;
    00127         double cutoffCost = maxValidCost * margin;
    00128         mPruneCost = cutoffCost * 2;
    00129         for(unsigned int varIndex = 0; varIndex < numVars; varIndex++){
    00130                 mValueBaseIndices.pushBack(mAssignmentCosts.size());
    00131                 CCAVariable * ccaVar = (CCAVariable *) mSearchVariables[varIndex];
    00132
    00133                 CCADomain &ccaDomain = *(ccaVar->getDomain());
    00134                 unsigned int domainSize = ccaDomain.getLength();
    00135                 CCAAutomaton const * aut = model->get_automaton_p(*ccaVar);
    00136
    00137                 if(largestDomain < domainSize)
    00138                         largestDomain = domainSize;
    00139
    00140                 for(unsigned int valIndex = 0; valIndex < domainSize; valIndex++) {
    00141                         CCAValue * ccaVal = ccaDomain[valIndex];
    00142                         CCAState const * state = aut->state_p(*ccaVal);
    00143                         double cost;
    00144
    00145                         if(state->getStateType() == CCAState::NOMINAL) {
    00146                                 cost = 1;
    00147                         } else if(state->getStateType() == CCAState::FAILURE){
    00148                                 cost = failureCost;
    00149                         } else {
    00150                                 fprintf(stderr, "GoalInterpreter::GoalInterpreter: Error: Unknown "
    00151                                                                 "state type: %d\n", state->getStateType());
    00152                                 cost = mPruneCost;
    00153                         }
    00154
    00155                         mAssignmentCosts.push_back(cost);
    00156                 }
    00157         }
    00158
    00159         // allocate our value buffer
    00160         mVariableCosts = new double[mAssignmentCosts.size()];
    00161
    00162         // Allocate our current value buffer
    00163         mCurrentValue.resize(numVars);
    00164
    00165         if (debug) {
    00166                 cerr << "Creating opsat with "
    00167                      << mSearchVariables.getLength() << " design vars, "
    00168                      << allVariables.getLength() << " state vars."
    00169                      << endl;
    00170                 fprintf(stderr, "Cutoff cost is %f\n", cutoffCost);
    00171         }
    00172
    00173         bool useDPLL = true;
    00174
    00175         //opsat = new Opsat(mSearchVariables, *model, useDPLL);  // use DPLL
    00176         opsat = new Opsat(mSearchVariables, mValueBaseIndices, mAssignmentCosts,
    00177                 allVariables, mAllConstraints, useDPLL, cutoffCost);
    00178
    00179         // for checking consistency of target state:
    00180         consistencyVsat = new ISATTester(allVariables,
    00181                 allVariables.getLength(), mAllConstraints);
    00182
    00183         setDebug(initialDebug);
    00184 }
    00185
    00187
    00188 GoalInterpreter::~GoalInterpreter()
    00189 {
    00190         //list<BFIGVariable *>::iterator vIter;
    00191         //for (vIter = variablesAll.begin(); vIter != variablesAll.end(); vIter++)
    00192         //{
    00193         //      delete (*vIter);
    00194         //}
    00196         //for (vIter = variablesState.begin(); vIter != variablesState.end(); vIter++)
    00197         //{
    00198         //      delete (*vIter);
    00199         //}
    00200         //list<BFIGConstraint const *>::iterator cIter;
    00201         //for (cIter = constraintsModel.begin(); cIter != constraintsModel.end(); cIter++)
    00202         //{
    00203         //      delete (*cIter);
    00204         //}
    00205         //for (cIter = constraintsGoal.begin(); cIter != constraintsGoal.end(); cIter++)
    00206         //{
    00207         //      delete (*cIter);
    00208         //}
    00209         //if (emptyClause)
    00210         //      delete emptyClause;
    00211
    00212         // Delete Opsat
    00213         delete opsat;
    00214
    00215         // Delete our temporary array.
    00216         delete[] mVariableCosts;
    00217 }
    00218
    00220 //      PUBLIC FUNCTION METHODS
    00222
    00223 void
    00224 GoalInterpreter::setDebug(bool debugState)
    00225 {
    00226         debug = debugState;
    00227         opsat->setDebug(debugState);
    00228 }
    00229
    00231
    00232 bool
    00233 GoalInterpreter::getDebug()  const
    00234 {
    00235         return debug;
    00236 }
    00237
    00239
    00240 int GoalInterpreter::variableAndValueToUID(String var, String val,
    00241                                            unsigned int &varUID,
    00242                                            unsigned int &valUID) const
    00243 {
    00244         CCAVariables const * vars = model->getVariables();
    00245         CCAVariable const * ccaVar = vars->find(var.c_str());
    00246         if(ccaVar){
    00247                 varUID = ccaVar->getUID();
    00248                 CCAValue const * ccaVal = ccaVar->getDomain()->find(val.c_str());
    00249                 if(ccaVal){
    00250                         valUID = ccaVal->getUID();
    00251                         return 0;
    00252                 }
    00253         }
    00254         return 1;
    00255 }
    00256
    00258
    00259 int GoalInterpreter::variableAndValueToString(unsigned int var,
    00260                                               unsigned int val,
    00261                                               String &varString,
    00262                                               String &valString) const
    00263 {
    00264         CCAVariables const * vars = model->getVariables();
    00265         CCAVariable const * ccaVar = (*vars)[var];
    00266         if(ccaVar){
    00267                 varString = ccaVar->getName();
    00268                 CCAValue const * ccaVal = (*(ccaVar->getDomain()))[val];
    00269                 if(ccaVal){
    00270                         valString = ccaVal->getName();
    00271                         return 0;
    00272                 }
    00273         }
    00274         return 1;
    00275 }
    00276
    00278
    00279 bool
    00280 GoalInterpreter::updateGoal(unsigned int var, unsigned int val)
    00281 {
    00282         BaseModelVariable const * variable = model->getVariable(var);
    00283         if(variable == NULL)
    00284         {
    00285                 fprintf(stderr, "GoalInterpreter::updateGoal:"
    00286                         " Error, variable %d was not found\n", var);
    00287                 return false;
    00288         }
    00289
    00290         BaseModelValue const * value = variable->getValue(val);
    00291         if(value == NULL)
    00292         {
    00293                 fprintf(stderr, "GoalInterpreter::updateGoal:"
    00294                         " Error, value %d was not found in variable %s\n",
    00295                         val, variable->getName());
    00296                 return false;
    00297         }
    00298
    00299         BaseModelAssignment * asg =
    00300                 new BaseModelAssignment(variable, value, BaseModelAssignment::Negative);
    00301
    00302         // See if we already have this goal
    00303         unsigned int x;
    00304         for (x = 0; x < antiGoal.getLength(); x++)
    00305         {
    00306                 assert(antiGoal[x]);
    00307                 if ((*asg) == *(antiGoal[x]))
    00308                         return true;  // give up - already is in the goal.
    00309         }
    00310         // constraintsGoal.pushBack(asg);
    00311         antiGoal.pushBack(asg);
    00312         return true;
    00313 }
    00314
    00316
    00317 bool
    00318 GoalInterpreter::updateGoal(String var, String val)
    00319 {
    00320         unsigned int varUID, valUID;
    00321
    00322         if(FAILED(variableAndValueToUID(var, val, varUID, valUID)))
    00323         {
    00324                 fprintf(stderr, "GoalInterpreter::updateGoal:"
    00325                         " Error, (%s = %s) was an unknown assignment\n",
    00326                         var.c_str(), val.c_str());
    00327                 return false;
    00328         }
    00329         return updateGoal(varUID, valUID);
    00330 }
    00331
    00333
    00334 void
    00335 GoalInterpreter::clearGoal()
    00336 {
    00337         // free memory:
    00338         antiGoal.makeEmpty();
    00339 }
    00340
    00342
    00343 bool
    00344 GoalInterpreter::updateReachableStates(intList const * rstates)
    00345 {
    00346         unsigned int x = 0;
    00347         assert(rstates);
    00348         BFIGGenerator * generator = (BFIGGenerator *) opsat->getGenerator();
    00349
    00350         if (debug)
    00351         {
    00352                 cerr << "GI got reachability update:" << endl;
    00353                 intList::const_iterator iit;
    00354                 for (iit = rstates->begin(); iit != rstates->end(); iit++)
    00355                 {
    00356                         unsigned int var = (*iit);
    00357                         iit++;
    00358                         if (iit == rstates->end())
    00359                         {
    00360                                 cerr << "Error: GI found odd number of elements in state update!" <<
    00361                                         endl;
    00362                                 break;
    00363                         }
    00364                         unsigned int val = (*iit);
    00365                         cerr << "(" << var << " = " << val << ")" << " ";
    00366                 }
    00367                 cerr << endl;
    00368         }
    00369
    00370         // Initialize our costs so everything is pruned (unreachable).
    00371         for(x = 0; x < mAssignmentCosts.size(); x++) {
    00372                 mVariableCosts[x] = mPruneCost;
    00373         }
    00374
    00375         // set those allowed as reachable
    00376         intList::const_iterator intIter;
    00377         for (intIter = rstates->begin(); intIter != rstates->end(); intIter++)
    00378         {
    00379                 unsigned int var = (*intIter);
    00380                 intIter++;
    00381                 if (intIter == rstates->end())
    00382                 {
    00383                         cerr << "Error: GI found odd number of elements in state update!" << endl;
    00384                         break;
    00385                 }
    00386                 unsigned int val = (*intIter);
    00387
    00388                 unsigned int varIndex = findUID(var);
    00389                 if(varIndex > mValueBaseIndices.getLength()) {
    00390                         fprintf(stderr, "Error, unknown reachable variable %d in the pair "
    00391                                                         "(%d, %d)\n", var, var, val);
    00392                 } else if(val > mSearchVariables[varIndex]->getDomain()->getLength()) {
    00393                         fprintf(stderr, "Error, unknown reachable value %d in the pair "
    00394                                                         "(%d, %d)\n", val, var, val);
    00395                 } else {
    00396                         unsigned int valIndex = mValueBaseIndices[varIndex] + val;
    00397                         double cost = mAssignmentCosts[valIndex];
    00398
    00399                         if((unsigned int)mCurrentValue[varIndex] == val) {
    00400                                 // If we're already in this state, make it's cost 0 (Less than the minimum cost in the system).
    00401                                 cost = 0;
    00402                         }
    00403
    00404                         mVariableCosts[valIndex] = cost;
    00405                 }
    00406         }
    00407
    00408         // Commit our new costs.
    00409         for(x = 0; x < mSearchVariables.getLength(); x++) {
    00410                 unsigned int valBaseIndex = mValueBaseIndices[x];
    00411                 if(debug) {
    00412                         fprintf(stderr, "Updating cost for %s[%d]:",
    00413                                                         mSearchVariables[x]->getName(), mSearchVariables[x]->getUID());
    00414                         BaseModelDomain &dom = *(mSearchVariables[x]->getDomain());
    00415                         for(unsigned int y = 0; y < dom.getLength(); y++) {
    00416                                 fprintf(stderr, "\n  %s[%d] <- %f", dom[y]->getName(),
    00417                                                                 dom[y]->getUID(), mVariableCosts[valBaseIndex + y]);
    00418                         }
    00419                         fprintf(stderr, "\n");
    00420                 }
    00421                 generator->updateCosts(mSearchVariables[x]->getUID(), mVariableCosts +
    00422                                                                                                          valBaseIndex);
    00423         }
    00424
    00425         return true;
    00426 }
    00427
    00429
    00430 intList const *
    00431 GoalInterpreter::generateGoalState()
    00432 {
    00433         // list<BFIGConstraint const *> constraintSet = constraintsModel;
    00434
    00435
    00436         // just made up this number:
    00437         int spaceLimit = mSearchVariables.getLength() * mSearchVariables.getLength() *
    00438                          1000;
    00439         int timeLimit = mSearchVariables.getLength() * mSearchVariables.getLength() *
    00440                         mSearchVariables.getLength() * 1000;
    00441
    00442         if (antiGoal.isEmpty())   // no goal needed!
    00443         {
    00444                 if (debug)
    00445                         cerr << "No goal needed for GI. " << endl;
    00446                 // is it ok to return an empty int list here?
    00447                 //return new intList();
    00448                 // this *should* find all the current states, and fill in those that
    00449                 // aren't specified:
    00450                 opsat->getGenerator()->reset();
    00451                 BaseModelClause * res = opsat->findSatisfyingSolution(timeLimit, spaceLimit);
    00452                 if(res == NULL)
    00453                 {
    00454                         if (debug)
    00455                                 cerr << "GoalInterpreter could not find any adequate current state!" << endl;
    00456                         return NULL;
    00457                 }
    00458
    00459                 intList * list = new intList(bmAssignmentArrayToIntList(*res));
    00460                 delete res;
    00461                 return list;
    00462         }
    00463
    00464         if (debug)
    00465                 cerr << "GoalInterprester trying to unsatisfy the antigoal: " << antiGoal << endl;
    00466         opsat->getGenerator()->reset();
    00467         opsat->setTemporaryConstraint(&antiGoal);
    00468
    00469
    00470         // Note that a consistency check must be done because this opsat
    00471         // query is a theory prime implicant request and the results of any
    00472         // such query is going to be the set of solutions that are either
    00473         // inconsistent with the model or entail that the goal has been
    00474         // achieved.  Since we want the latter only, we must verify that the
    00475         // returned solution is consistent with the model, implying it
    00476         // entails the goals, as desired.
    00477
    00478         // Cascade the debug setting: (lots of output)
    00479         //bool implicantTerse = BFIGImplicant::terse, assignmentTerse = BFIGAssignment::terse;
    00480         //if (debug)
    00481         //{
    00482                 //BFIGImplicant::terse = true;
    00483                 //BFIGAssignment::terse = true;
    00484                 //opsat->setDebug(true);
    00485         //}
    00486
    00487         if (debug)
    00488                 cerr << "Using opsat:" << endl << *opsat << endl;
    00489
    00490         int ii = 0;
    00491         BaseModelClause * res;
    00492         while (true)
    00493         {
    00494                 if (debug)
    00495                         cerr << "GI iteration #:" << ii++ << endl;
    00496                 res = opsat->findUnsatisfyingSolution(timeLimit, spaceLimit);
    00497                 if (res == NULL)
    00498                 {
    00499                         //if (debug)
    00500                                 cerr << "GoalInterpreter could not find any adequate goal states!" << endl;
    00501                         return NULL;
    00502                 }
    00503
    00504                 BaseModelAssignmentArray conf(false);
    00505                 AssignmentTesterInterface::SolutionType solution
    00506                         = consistencyVsat->tryAssignment(res, 0, true, conf);
    00507                 // Now, must check if target state is consistent! (not guaranteed otherwise):
    00508                 if (solution == AssignmentTesterInterface::Unsatisfiable)
    00509                 {
    00510                         // the result is not consistent with the model...
    00512                         //if (debug)  ////
    00513                         cerr << endl << "    GoalInterpreter found goal state: " << res << ",  "
    00514                                 << "but it is not consistent..." << endl << endl;
    00515
    00516                         delete res;
    00517                         //opsat.addConstraint(&conf);
    00518                 } else
    00519                 {
    00520                         //cerr << endl << "    GoalInterpreter found goal state: " << res << endl << endl;
    00521                         // the result is ok - we're done!
    00522                         break;
    00523                 }
    00524         }
    00525         if (debug)
    00526                 cerr << "GoalInterpreter desires the goal state: " << res << endl;
    00527
    00528         /*
    00529         cerr << endl << endl << "Testing SAT engine..." << endl << endl;
    00530         // Test the resulting state:
    00531         VSAT * vsat = makeTestSat();
    00533         //BFIGConstraint   tryAssignment(BFIGImplicant implicant, bool shouldBeSat, bool useDPLL);
    00534         BFIGConstraint c = vsat->tryAssignment(res, false, true);
    00535         cerr << "Conflict found with desired goal:" << endl << c << endl;
    00536         c = vsat->tryAssignment(res, true, true);
    00537         cerr << "Conflict found with (anti) desired goal:" << endl << c << endl;
    00538
    00539         cerr << endl << endl;
    00540         delete vsat;
    00541         */
    00542
    00543         //if (debug)
    00544         //{
    00545         //      BFIGImplicant::terse = implicantTerse;
    00546         //      BFIGAssignment::terse = assignmentTerse;
    00547         //}
    00548         return new intList(bmAssignmentArrayToIntList(*res));
    00549 }
    00550
    00552
    00553 intList
    00554 GoalInterpreter::bmAssignmentArrayToIntList(BaseModelAssignmentArray const & imp)  const
    00555 {
    00556         intList res;
    00557         unsigned int x;
    00558         for (x = 0; x < imp.getLength(); x++)
    00559         {
    00560                 BaseModelAssignment const * asg = imp[x];
    00561                 assert(asg != NULL);
    00562                 res.push_back(asg->getVariable()->getUID());
    00563                 res.push_back(asg->getValue()->getUID());
    00564         }
    00565         return res;
    00566 }
    00567
    00569
    00570 bool
    00571 GoalInterpreter::updateCurrentState(unsigned int variable_id, unsigned int value_id)
    00572 {
    00573         unsigned int searchVarIndex = findUID(variable_id);
    00574
    00575         if(searchVarIndex >= mSearchVariables.getLength()) {
    00576                 fprintf(stderr, "GoalInterpreter::updateCurrentState: Error: "
    00577                         "Invalid variable UID: %d\n", variable_id);
    00578                 return false;
    00579         }
    00580
    00581         if(value_id >= mSearchVariables[searchVarIndex]->getDomain()->getLength()) {
    00582                 CCAVariable * var = mSearchVariables[searchVarIndex];
    00583                 fprintf(stderr, "GoalInterpreter::updateCurrentState: Error: "
    00584                         "Invalid value UID: %d for variable %s(%d)\n",
    00585                         variable_id, var->getName(), var->getUID());
    00586                 return false;
    00587         }
    00588
    00589         mCurrentValue[searchVarIndex] = value_id;
    00590         return true;
    00591 }
    00592
    00594
    00595 bool
    00596 GoalInterpreter::updateCurrentState(String var, String val)
    00597 {
    00598         unsigned int varUID, valUID;
    00599
    00600         if(FAILED(variableAndValueToUID(var, val, varUID, valUID)))
    00601         {
    00602                 fprintf(stderr, "GoalInterpreter::updateCurrentState:"
    00603                         " Error, (%s = %s) was an unknown assignment\n",
    00604                         var.c_str(), val.c_str());
    00605                 return false;
    00606         }
    00607         return updateCurrentState(varUID, valUID);
    00608 }
    00609
    00611
    00612 void
    00613 GoalInterpreter::showVariables() const
    00614 {
    00615         cout << endl << "variablesAll:" << endl << "    ";
    00616         CCAVariables const * variablesAll = model->getVariables();
    00617         variablesAll->printArray(cout, "\n    ");
    00618         cout << endl;
    00619
    00620         cout << "variablesState:" << endl << "    ";
    00621         mSearchVariables.printArray(cout, "\n    ");
    00622         cout << endl;
    00623 }
    00624
    00626
    00627 unsigned int GoalInterpreter::findUID(unsigned int varUID)
    00628 {
    00629         unsigned int size = mSearchVariables.getLength();
    00630         for(unsigned int x = 0; x < size; x++) {
    00631                 if(mSearchVariables[x]->getUID() == varUID) {
    00632                         return x;
    00633                 }
    00634         }
    00635
    00636         return size;
    00637 }
    00638
    00640
    00641 /*
    00642 list<BFIGVariable *>
    00643 GoalInterpreter::getVariablesAll()
    00644 {
    00645         //if (commandedSinceEstimate)
    00646         //{
    00647         //      insertCurrentProbabilities();
    00648         //}
    00649         return variablesAll;
    00650 }
    00651 */
    00652
    00654
    00655 /*
    00656 list<BFIGVariable *>
    00657 GoalInterpreter::getVariablesState()
    00658 {
    00659         //if (commandedSinceEstimate)
    00660         //{
    00661         //      insertCurrentProbabilities();
    00662         //}
    00663         return variablesState;
    00664 }
    00665 */
    00666
    00668
    00669 #ifndef EMBEDDED
    00670
    00671 void GoalInterpreter::print(ostream& os) const
    00672 {
    00673         // not complete, for now:
    00674         //(void)me;
    00675         os << "GoalInterpreter: " << endl;
    00676
    00677         os << endl << "variablesAll:" << endl;
    00678         CCAVariables const * variablesAll = model->getVariables();
    00679         variablesAll->printArray(os, "\n    ");
    00680         os << endl;
    00681
    00682         os << "variablesState:" << endl << "    ";
    00683         mSearchVariables.printArray(os, "\n    ");
    00684         os << endl;
    00685
    00686         os << "constraintsModel:" << endl << "    ";
    00687         mAllConstraints.printArray(os, " ^\n    ");
    00688         os << endl;
    00689
    00690         os << "antiGoal:" << endl << "    ";
    00691         antiGoal.print(os);
    00692         os << endl;
    00693 }
    00694
    00695 #endif
    00696
    00698
    00699