A labelled collection of conditions with associated reward, actions and outcome flags.
More...
|
| | Rule (const size_t index, const label_t label) |
| | Constructs a rule with its sequential index and identifying label.
|
| |
| bool | evaluate () const |
| | Evaluates the rule by checking all of its conditions.
|
| |
| void | setReward (const float reward) |
| | Sets the reward granted when this rule is satisfied.
|
| |
| void | setWinRule (const bool isWinRule) |
| | Sets whether this rule is a win rule.
|
| |
| void | setFailRule (const bool isFailRule) |
| | Sets whether this rule is a fail rule.
|
| |
| void | setCheckpointRule (const bool isCheckpointRule) |
| | Sets whether this rule is a checkpoint rule.
|
| |
| void | setCheckpointTolerance (const size_t checkPointTolerance) |
| | Sets the checkpoint tolerance for this rule.
|
| |
| void | setSaveSolutionRule (const bool isSaveSolutionRule) |
| | Sets whether this rule triggers saving the solution.
|
| |
| void | setSaveSolutionPath (const std::string &saveSolutionPath) |
| | Sets the path where the solution is saved.
|
| |
| void | addAction (const std::function< void()> &function) |
| | Appends a game-specific action to run for this rule.
|
| |
| void | addCondition (std::unique_ptr< Condition > condition) |
| | Adds a condition that must hold for this rule to be satisfied.
|
| |
| void | addSatisfyRuleLabel (const label_t satisfyRuleLabel) |
| | Adds the label of another rule considered satisfied alongside this one.
|
| |
| void | addSatisfyRule (Rule *const subRule) |
| | Adds a pointer to another rule considered satisfied alongside this one.
|
| |
| label_t | getLabel () const |
| | Returns the rule's identifying label.
|
| |
| float | getReward () const |
| | Returns the reward granted when this rule is satisfied.
|
| |
| bool | isWinRule () const |
| | Returns whether this rule is a win rule.
|
| |
| bool | isFailRule () const |
| | Returns whether this rule is a fail rule.
|
| |
| bool | isCheckpointRule () const |
| | Returns whether this rule is a checkpoint rule.
|
| |
| size_t | getCheckpointTolerance () const |
| | Returns the rule's checkpoint tolerance.
|
| |
| bool | isSaveSolutionRule () const |
| | Returns whether this rule triggers saving the solution.
|
| |
| const std::string & | getSaveSolutionPath () const |
| | Returns the path where the solution is saved.
|
| |
| const std::unordered_set< label_t > & | getSatisfyRuleLabels () const |
| | Returns the labels of rules satisfied alongside this one.
|
| |
| const std::vector< Rule * > & | getSatisfyRules () const |
| | Returns pointers to the rules satisfied alongside this one.
|
| |
| size_t | getIndex () const |
| | Returns the rule's internal sequential index.
|
| |
| const std::vector< std::function< void()> > & | getActions () const |
| | Returns the rule's game-specific actions.
|
| |
|
| std::unordered_set< std::unique_ptr< Condition > > | _conditions |
| | Conditions that must all hold for the rule to be satisfied.
|
| |
| const size_t | _index |
| | Internal index for sequential access.
|
| |
| const label_t | _label |
| | Identifying label for the rule.
|
| |
| float | _reward = 0.0 |
| | Reward associated with meeting this rule.
|
| |
| bool | _isWinRule = false |
| | Whether this rule marks a win.
|
| |
| bool | _isFailRule = false |
| | Whether this rule marks a fail.
|
| |
| bool | _isCheckpointRule = false |
| | Whether this rule marks a checkpoint.
|
| |
| size_t | _checkPointTolerance = 0 |
| | Checkpoint tolerance value.
|
| |
| bool | _isSaveSolutionRule = false |
| | Whether this rule triggers saving the solution.
|
| |
| std::string | _saveSolutionPath |
| | Path where the solution is saved.
|
| |
| std::unordered_set< label_t > | _satisfyRuleLabels |
| | Labels of rules also satisfied when this one is.
|
| |
| std::vector< Rule * > | _satisfyRules |
| | Pointers to rules also satisfied when this one is.
|
| |
| std::vector< std::function< void()> > | _actions |
| | Storage for game-specific actions run for this rule.
|
| |
A labelled collection of conditions with associated reward, actions and outcome flags.
A rule is satisfied when all of its conditions evaluate to true (logical AND). On top of that it carries an identifying label and index, a numeric reward, a list of game-specific actions, and a set of other rules (by label or pointer) that are considered satisfied alongside it. Boolean flags mark the rule as a win, fail, checkpoint or save-solution rule.
Definition at line 26 of file rule.hpp.