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

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

# tut::BMHelper Class Reference

`#include <BMHelper.h>`

Inheritance diagram for tut::BMHelper:

[legend]
List of all members.

## Public Member Functions
| BMHelper ()
virtual | ~BMHelper ()
## Static Protected Member Functions
static Mers::Models::Base::BaseModelDomain * | loadDomain (const struct BMDomainEntry *domainData, unsigned int index)
static Mers::Models::Base::BaseModelVariable * | loadVariable (Mers::Models::Base::BaseModelDomainArray &domains, const struct BMVariableEntry *variableData, unsigned int index)
static void | loadDomainData (unsigned int numDomains, const struct BMDomainEntry *domainData, Mers::Models::Base::BaseModelDomainArray &doms)
static void | loadVariableData (unsigned int numVariables, const struct BMVariableEntry *variables, Mers::Models::Base::BaseModelDomainArray &doms, Mers::Models::Base::BaseModelVariableArray &vars)
static void | loadModelData (unsigned int numDomains, const struct BMDomainEntry *domainData, unsigned int numVariables, const struct BMVariableEntry *variableData, Mers::Models::Base::BaseModel &model)
static void | getVariableSubset (unsigned int numSubsetVars, const unsigned int *subsetVarData, Mers::Models::Base::BaseModelVariableArray &allVars, Mers::Models::Base::BaseModelVariableArray &subsetVars)
static void | loadClause (unsigned int numAssignments, const int clauseData[], Mers::Models::Base::BaseModelVariableArray &variables, Mers::Models::Base::BaseModelClause &clause)
template<int n>
static void | loadClauses (unsigned int numClauses, const int clauseData[][n], Mers::Models::Base::BaseModelVariableArray &vars, Mers::Models::Base::BaseModelClauseArray &clauses)
template<int n>
static void | loadAssignments (std::vector< Mers::Models::Base::BaseModelAssignmentArray * > &assignments, unsigned int numAssignments, const unsigned int assignmentsData[][n], Mers::Models::Base::BaseModelVariableArray &variables)
## Classes
struct | BMDomainEntry
struct | BMVariableEntry

## Detailed Description

This class defines the basic structure needed to create Base Model Variables and Domains.

Author:
  Paul Elliott

Definition at line 40 of file BMHelper.h.

## Constructor & Destructor Documentation

BMHelper::BMHelper | ( |  | ) |

Creates a new BMHelper object.

Definition at line 32 of file BMHelper.cpp.

BMHelper::~BMHelper | ( |  | ) | `[virtual]`

Destroys this object.

Definition at line 39 of file BMHelper.cpp.

## Member Function Documentation

BaseModelDomain * BMHelper::loadDomain | ( | const struct BMDomainEntry * | domainData,
|  | unsigned int | index |
| ) |  |  | `[static, protected]`

Load a Domain Entry

Parameters:

  | domainData | This data is used to create the requested domain.
  | index | The index of this domain.

These domains own their values

Definition at line 47 of file BMHelper.cpp.

References tut::BMHelper::BMDomainEntry::name, Mers::Models::Base::BaseModelDomain::pushBack(), and tut::BMHelper::BMDomainEntry::values.

Referenced by loadDomainData().

Here is the call graph for this function:

BaseModelVariable * BMHelper::loadVariable | ( | Mers::Models::Base::BaseModelDomainArray & | domains,
|  | const struct BMVariableEntry * | variableData,
|  | unsigned int | index |
| ) |  |  | `[static, protected]`

Load a Variable Entry

Parameters:

  | domains | The list of domains to which the index references.
  | variableData | This data is used to create the requested variable.
  | index | The index of this variable

Definition at line 72 of file BMHelper.cpp.

References tut::BMHelper::BMVariableEntry::domainIndex, Mers::Utils::Containers::DynamicArray::getLength(), tut::BMHelper::BMVariableEntry::name, and tut::BMHelper::BMVariableEntry::varType.

Referenced by loadVariableData().

Here is the call graph for this function:

void BMHelper::loadDomainData | ( | unsigned int | numDomains,
|  | const struct BMDomainEntry * | domainData,
|  | Mers::Models::Base::BaseModelDomainArray & | doms |
| ) |  |  | `[static, protected]`

Loads the domain data into the specified array of domains.

Parameters:

  | numDomains | The number of domains to be loaded.
  | domainData | The list of domain data, with numDomains entries.
  | doms | The domains loaded will be returned here.

Load our domains

Definition at line 92 of file BMHelper.cpp.

References loadDomain(), and Mers::Models::Base::BaseModelDomainArray::pushBack().

Referenced by Mers::Solvers::SAT::GATSAT::unit_tests::GatsatTester::initGATSAT().

Here is the call graph for this function:

void BMHelper::loadVariableData | ( | unsigned int | numVariables,
|  | const struct BMVariableEntry * | variables,
|  | Mers::Models::Base::BaseModelDomainArray & | doms,
|  | Mers::Models::Base::BaseModelVariableArray & | vars |
| ) |  |  | `[static, protected]`

Loads the list of all variables based on the domain list and variable data.

Parameters:

  | numVariables | The number of variables to load.
  | variables | The list of variable entries that are to be loaded.
  | doms | The domains in this list will be used to assign domains to the variables.
  | vars | The variables loaded will be returned here.

Definition at line 106 of file BMHelper.cpp.

References loadVariable(), and Mers::Models::Base::BaseModelVariableArray::pushBack().

Referenced by Mers::Solvers::SAT::GATSAT::unit_tests::GatsatTester::initGATSAT().

Here is the call graph for this function:

void BMHelper::loadModelData | ( | unsigned int | numDomains,
|  | const struct BMDomainEntry * | domainData,
|  | unsigned int | numVariables,
|  | const struct BMVariableEntry * | variableData,
|  | Mers::Models::Base::BaseModel & | model |
| ) |  |  | `[static, protected]`

Loads a set of domain and variable data into a model.

Parameters:

  | numDomains | The number of domains to be loaded.
  | domainData | The list of domain data, with numDomains entries.
  | numVariables | The number of variables to load.
  | variableData | The list of variable entries that are to be loaded.
  | model | The model loaded will be returned here.

Definition at line 120 of file BMHelper.cpp.

References Mers::Models::Base::BaseModel::addDomain(), Mers::Models::Base::BaseModel::addVariable(), tut::BMHelper::BMVariableEntry::domainIndex, Mers::Models::Base::BaseModel::getDomain(), Mers::Models::Base::BaseModel::getDomains(), Mers::Utils::Containers::DynamicArray::getLength(), and Mers::Models::Base::BaseModelValueArray::pushBack().

Here is the call graph for this function:

void BMHelper::getVariableSubset | ( | unsigned int | numSubsetVars,
|  | const unsigned int * | subsetVarData,
|  | Mers::Models::Base::BaseModelVariableArray & | allVars,
|  | Mers::Models::Base::BaseModelVariableArray & | subsetVars |
| ) |  |  | `[static, protected]`

Loads the variables indexed by subsetVarData from the list of all variables to the list of a subset of the variables.

Parameters:

  | numSubsetVars | The number of variables that are present in the subsetVarData list.
  | subsetVarData | The set of indices into the list of all variables that should be copied to the subset variable list.
  | allVars | The set of all variables that can be used in the subset. Note that the data in subsetVarData is an index into this array, as opposed to a set of UIDs. They will only be the same if the set of allVars is ordered from 0.
  | subsetVars | The variables matching the subsetVarData will be loaded into this list.

Definition at line 158 of file BMHelper.cpp.

References Mers::Models::Base::BaseModelVariableArray::pushBack(), and Mers::Utils::Containers::DynamicArray::size().

Referenced by Mers::Solvers::SAT::GATSAT::unit_tests::GatsatTester::getSearchVarData().

Here is the call graph for this function:

void BMHelper::loadClause | ( | unsigned int | numAssignments,
|  | const int | clauseData[],
|  | Mers::Models::Base::BaseModelVariableArray & | variables,
|  | Mers::Models::Base::BaseModelClause & | clause |
| ) |  |  | `[static, protected]`

Loads data about a single clause into a clause.

Parameters:

  | numAssignments | The total number of assignments present in this clause data.
  | clauseData | The data about which assignments are to be added to this clause. This data represents a disjunctive clause. There is exactly one spot for each variable, in order. That spot either contains 0, indicating that the variable is not present in this clause, or contains the index of the value of the variable that is present in the clause. This value is negative if the assignment is negative and positive otherwise.
  | variables | The set of variables to use when generating the clause.
  | clause | The clause loaded is returned in this object.

Definition at line 175 of file BMHelper.cpp.

References Mers::Utils::Containers::DynamicArray::getLength(), and Mers::Models::Base::BaseModelAssignmentArray::pushBack().

Referenced by loadClauses().

Here is the call graph for this function:

template<int n>

static void tut::BMHelper::loadClauses | ( | unsigned int | numClauses,
|  | const int | clauseData[][n],
|  | Mers::Models::Base::BaseModelVariableArray & | vars,
|  | Mers::Models::Base::BaseModelClauseArray & | clauses |
| ) |  |  | `[inline, static, protected]`

Loads a set of clause data into an actual set of clauses.

Parameters:

  | numClauses | The total number of clauses to laod from the clauseData parameter.
  | clauseData | A listing of all the clauses information, with one entry per variable. Each list of length n corresponds to a single disjunctive clause. For each clause entry, there is exactly one spot for each variable, in order. That spot either contains 0, indicating that the variable is not present in this clause, or contains the index of the value of the variable that is present in the clause. This value is negative if the assignment is negative and positive otherwise.
  | vars | The set of variables to use when generating clauses.
  | clauses | The clauses loaded will be returned in this object.

Definition at line 216 of file BMHelper.h.

References loadClause(), and Mers::Models::Base::BaseModelClauseArray::pushBack().

Referenced by Mers::Solvers::SAT::GATSAT::unit_tests::GatsatTester::initGATSAT(), and Mers::Solvers::SAT::GATSAT::unit_tests::GatsatTester::testGATSAT().

Here is the call graph for this function:

template<int n>

static void tut::BMHelper::loadAssignments | ( | std::vector< Mers::Models::Base::BaseModelAssignmentArray * > & | assignments,
|  | unsigned int | numAssignments,
|  | const unsigned int | assignmentsData[][n],
|  | Mers::Models::Base::BaseModelVariableArray & | variables |
| ) |  |  | `[inline, static, protected]`

Loads the specified assignmentData into the assignment list.

Parameters:

  | assignments | The set of assignments loaded will be placed here.
  | numAssignments | The number of sets of assignments present in the data.
  | assignmentsData | The set of assignment data being used to load the assignments. This array is an array of indexes corresponding to values. The value assignmentsData[a][v] is the index of the value to assign to the variable v in the assignment set a. Hence, this allows one to specify compactly the assignments expected. The variables are matched against the variables list in the order they appear in this list. A value of ((unsigned int)-1) indicates that the variable has not value in this assignment. Thus any partial assignment is also possible. Typically this parameter is specified by something like: const unsigned int noVal = (unsigned int)-1; const unsigned int assignments[2][3] = { {1, 0, noVal}, {0, 3, 1} };

Definition at line 258 of file BMHelper.h.

References Mers::Utils::Containers::DynamicArray::getLength(), and Mers::Models::Base::BaseModelVariable::getValue().

Referenced by Mers::Solvers::SAT::GATSAT::unit_tests::GatsatTester::testGATSAT().

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/Models/Base/unit-tests/BMHelper.h
- /Users/fpy/titan-1-5-MBARI/Mers/Models/Base/unit-tests/BMHelper.cpp