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

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Mers::Solvers::Entailment::GI::GoalInterpreter Class Reference

Inheritance diagram for Mers::Solvers::Entailment::GI::GoalInterpreter:

[legend]
Collaboration diagram for Mers::Solvers::Entailment::GI::GoalInterpreter:

[legend]
List of all members.

## Public Member Functions
| GoalInterpreter (Mers::Models::CCA::CCAModel const *m, bool initialDebug=false)
virtual | ~GoalInterpreter ()
bool | updateGoal (unsigned int var, unsigned int val)
bool | updateGoal (Mers::Utils::Lang::String var, Mers::Utils::Lang::String val)
bool | updateCurrentState (unsigned int variable_id, unsigned int value_id)
bool | updateCurrentState (Mers::Utils::Lang::String var, Mers::Utils::Lang::String val)
bool | updateReachableStates (Mers::Utils::Containers::intList const *rstates)
void | clearGoal ()
Mers::Utils::Containers::intList const * | generateGoalState ()
void | setDebug (bool debugState)
bool | getDebug () const
void | showVariables () const
virtual int | variableAndValueToUID (Mers::Utils::Lang::String var, Mers::Utils::Lang::String val, unsigned int &varUID, unsigned int &valUID) const
virtual int | variableAndValueToString (unsigned int var, unsigned int val, Mers::Utils::Lang::String &varString, Mers::Utils::Lang::String &valString) const
virtual void | print (std::ostream &out) const

## Detailed Description

Definition at line 48 of file GoalInterpreter.h.

## Member Function Documentation

bool GoalInterpreter::updateGoal | ( | unsigned int | var,
|  | unsigned int | val |
| ) |  |  | `[virtual]`

Updates GI's current goal list by adding (var = val)

Parameters:

  | var | the variable of the goal
  | val | the value of the variable of the goal

Returns:
  true if the goal was added, false if this function failed to add the goal

Implements Mers::Solvers::Entailment::GoalInterpreterInterface.

Definition at line 280 of file GoalInterpreter.cpp.

References Mers::Utils::Containers::DynamicArray::getLength(), Mers::Models::Base::BaseModelVariable::getName(), Mers::Models::Base::BaseModelVariable::getValue(), Mers::Models::Base::BaseModel::getVariable(), and Mers::Models::Base::BaseModelAssignmentArray::pushBack().

Referenced by updateGoal().

Here is the call graph for this function:

bool GoalInterpreter::updateGoal | ( | Mers::Utils::Lang::String | var,
|  | Mers::Utils::Lang::String | val |
| ) |  |  | `[virtual]`

Updates GI's current goal list by adding (var = val)

Parameters:

  | var | the variable of the goal
  | val | the value of the variable of the goal

Returns:
  true if the goal was added, false if this function failed to add the goal

Implements Mers::Solvers::Entailment::GoalInterpreterInterface.

Definition at line 318 of file GoalInterpreter.cpp.

References Mers::Utils::Lang::String::c_str(), updateGoal(), and variableAndValueToUID().

Here is the call graph for this function:

bool GoalInterpreter::updateCurrentState | ( | unsigned int | variable_id,
|  | unsigned int | value_id |
| ) |  |  | `[virtual]`

Updates the current state with the assignment (variable_id = value_id)

Parameters:

  | variable_id | the variable whos state is being updated
  | value_id | the new value of the state

Returns:
  true if the state was updated, false if this function failed to update variable_id's state

Implements Mers::Solvers::Entailment::GoalInterpreterInterface.

Definition at line 571 of file GoalInterpreter.cpp.

References Mers::Utils::Containers::DynamicArray::getLength().

Referenced by updateCurrentState().

Here is the call graph for this function:

bool GoalInterpreter::updateCurrentState | ( | Mers::Utils::Lang::String | var,
|  | Mers::Utils::Lang::String | val |
| ) |  |  | `[virtual]`

Updates the current state with the assignment (var = val)

Parameters:

  | var | the variable whos state is being updated
  | val | the new value of the state

Returns:
  true if the state was updated, false if this function failed to update var's state

Implements Mers::Solvers::Entailment::GoalInterpreterInterface.

Definition at line 596 of file GoalInterpreter.cpp.

References Mers::Utils::Lang::String::c_str(), updateCurrentState(), and variableAndValueToUID().

Here is the call graph for this function:

bool GoalInterpreter::updateReachableStates | ( | Mers::Utils::Containers::intList const * | rstates | ) | `[virtual]`

Sets the new set of reachable states to rstates All states listed in rstates are reachable, all states not mentioned are assumed to be unreachable

Parameters:

  | rstates | the new set of rechable states. Each state is defined by an integer pair (variableUID, valueUID) so rstates should have an even number of elements in it

Returns:
  true if the update was successfull, false if there was a problem updating the reachable states

Implements Mers::Solvers::Entailment::GoalInterpreterInterface.

Definition at line 344 of file GoalInterpreter.cpp.

References Mers::Utils::Containers::intList::begin(), Mers::Utils::Containers::intList::end(), Mers::Solvers::SAT::GATSAT::GATSAT::getGenerator(), Mers::Utils::Containers::DynamicArray::getLength(), and Mers::Generators::BFIG::BFIGGenerator::updateCosts().

Here is the call graph for this function:

void GoalInterpreter::clearGoal | ( |  | ) | `[virtual]`

clears the internal list of goals so subsequent calls to updateGoal will add the goals from scratch

Implements Mers::Solvers::Entailment::GoalInterpreterInterface.

Definition at line 335 of file GoalInterpreter.cpp.

References Mers::Utils::Containers::DynamicArray::makeEmpty().

Referenced by GoalInterpreter().

Here is the call graph for this function:

intList const * GoalInterpreter::generateGoalState | ( |  | ) | `[virtual]`

Returns a complete set of state assignments. These state assignments are the least expensive state that entails the current goals

Returns:
  a list of UID pairs (variableUID, valueUID) that represent the set of goal-state assignments.

Implements Mers::Solvers::Entailment::GoalInterpreterInterface.

Definition at line 431 of file GoalInterpreter.cpp.

References Mers::Solvers::SAT::GATSAT::GATSAT::findSatisfyingSolution(), Mers::Solvers::SAT::GATSAT::GATSAT::findUnsatisfyingSolution(), Mers::Solvers::SAT::GATSAT::GATSAT::getGenerator(), Mers::Utils::Containers::DynamicArray::getLength(), Mers::Utils::Containers::DynamicArray::isEmpty(), Mers::Generators::AssignmentGeneratorInterface::reset(), Mers::Solvers::SAT::GATSAT::OpSAT::Opsat::setTemporaryConstraint(), and Mers::Solvers::SAT::ISAT::ISATTester::tryAssignment().

Here is the call graph for this function:

void GoalInterpreter::setDebug | ( | bool | debugState | ) | `[virtual]`

sets the debug mode of this goal interpreter to debugState

Parameters:

  | debugState | the new debug state. Set to true to turn debug printing on or false to turn it off

Reimplemented from Mers::Solvers::Entailment::GoalInterpreterInterface.

Definition at line 224 of file GoalInterpreter.cpp.

References Mers::Solvers::SAT::GATSAT::GATSAT::setDebug().

Referenced by GoalInterpreter().

Here is the call graph for this function:

bool GoalInterpreter::getDebug | ( |  | ) | const`[virtual]`

returns true if debug printing is on

Returns:
  true if the current debug state is on (true)

Reimplemented from Mers::Solvers::Entailment::GoalInterpreterInterface.

Definition at line 233 of file GoalInterpreter.cpp.

void GoalInterpreter::showVariables | ( |  | ) | const`[virtual]`

Prints out all of the variables in the GoalInterpreter

Implements Mers::Solvers::Entailment::GoalInterpreterInterface.

Definition at line 613 of file GoalInterpreter.cpp.

References Mers::Models::CCA::CCAModel::getVariables(), and Mers::Utils::Containers::DynamicArray::printArray().

Here is the call graph for this function:

int GoalInterpreter::variableAndValueToUID | ( | Mers::Utils::Lang::String | var,
|  | Mers::Utils::Lang::String | val,
|  | unsigned int & | varUID,
|  | unsigned int & | valUID |
| ) |  |  | const`[virtual]`

converts the (var = val) string pair into the equivalent pair of integers

Parameters:

  | var | the variable name being converted
  | val | the value name being converted
  | varUID | the variable UID is returned here
  | valUID | the value UID is returned here

Returns:
  0 on success or a positive number if the variable or value could not be found

Implements Mers::Solvers::Entailment::GoalInterpreterInterface.

Definition at line 240 of file GoalInterpreter.cpp.

References Mers::Utils::Lang::String::c_str(), Mers::Models::Base::BaseModelValueArray::find(), Mers::Models::Base::BaseModelVariableArray::find(), Mers::Models::Base::BaseModelValue::getDomain(), Mers::Models::Base::BaseModelValue::getUID(), Mers::Models::Base::BaseModelVariable::getUID(), and Mers::Models::CCA::CCAModel::getVariables().

Referenced by updateCurrentState(), and updateGoal().

Here is the call graph for this function:

int GoalInterpreter::variableAndValueToString | ( | unsigned int | var,
|  | unsigned int | val,
|  | Mers::Utils::Lang::String & | varString,
|  | Mers::Utils::Lang::String & | valString |
| ) |  |  | const`[virtual]`

converts the (var = val) integer pair into the equivalent pair of strings

Parameters:

  | var | the variable name being converted
  | val | the value name being converted
  | varString | the variable string is returned here
  | valString | the value string is returned here

Returns:
  0 on success or a positive number if the variable or value could not be found

Implements Mers::Solvers::Entailment::GoalInterpreterInterface.

Definition at line 259 of file GoalInterpreter.cpp.

References Mers::Models::CCA::CCAModel::getVariables().

Here is the call graph for this function:

void GoalInterpreter::print | ( | std::ostream & | out | ) | const`[virtual]`

Prints the Goal Interpreters information to the stream Derived classes should define this function to define what is printed for the GoalInterpreter

Parameters:

  | out | the stream being printed to

Implements Mers::Solvers::Entailment::GoalInterpreterInterface.

Definition at line 671 of file GoalInterpreter.cpp.

References Mers::Models::CCA::CCAModel::getVariables(), Mers::Models::Base::BaseModelClause::print(), and Mers::Utils::Containers::DynamicArray::printArray().

Here is the call graph for this function:

The documentation for this class was generated from the following files:

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