SGSolve
sgedgepolicy.hpp
1 // This file is part of the SGSolve library for stochastic games
2 // Copyright (C) 2019 Benjamin A. Brooks
3 //
4 // SGSolve free software: you can redistribute it and/or modify it
5 // under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // SGSolve is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see
16 // <http://www.gnu.org/licenses/>.
17 //
18 // Benjamin A. Brooks
19 // ben@benjaminbrooks.net
20 // Chicago, IL
21 
22 #ifndef _SGEDGEPOLICY_HPP
23 #define _SGEDGEPOLICY_HPP
24 
25 #include "sgproductpolicy.hpp"
26 
28 
35 {
36 private:
39  vector<SGPolicySet::const_iterator> policies;
43  SGPolicySet::const_iterator subPolicy;
44  int baseState;
47  int subState;
49 public:
51  SGEdgePolicy(const SGProductPolicy & _master);
52 
54  const vector<SGPolicySet::const_iterator> & getPolicies() const
55  { return policies; }
56 
58  const SGPolicySet::const_iterator & getSubPolicy() const
59  { return subPolicy; }
60 
62  bool incrementBasePolicy();
64  bool incrementSubPolicy();
66  const int getBaseState() const
67  { return baseState; }
69  const int getSubState() const
70  { return subState; }
72 
73  std::string hash() const;
75  bool operator++();
76 
77 }; // SGEdgePolicy
78 
79 #endif
SGEdgePolicy::getSubPolicy
const SGPolicySet::const_iterator & getSubPolicy() const
Returns the current substitution.
Definition: sgedgepolicy.hpp:58
SGEdgePolicy::operator++
bool operator++()
Increment the edge by either advancing the substitution or the base policy.
Definition: sgedgepolicy.cpp:95
SGProductPolicy
Class for storing product policies.
Definition: sgproductpolicy.hpp:39
SGEdgePolicy::incrementBasePolicy
bool incrementBasePolicy()
Increments the base policy.
Definition: sgedgepolicy.cpp:49
SGEdgePolicy::subState
int subState
Definition: sgedgepolicy.hpp:47
SGEdgePolicy::policies
vector< SGPolicySet::const_iterator > policies
Definition: sgedgepolicy.hpp:39
SGEdgePolicy::getSubState
const int getSubState() const
Returns the substitution state.
Definition: sgedgepolicy.hpp:69
SGEdgePolicy::baseState
int baseState
Definition: sgedgepolicy.hpp:44
SGEdgePolicy::hash
std::string hash() const
Generates a unique identifier for the edge.
Definition: sgedgepolicy.cpp:100
SGEdgePolicy::master
const SGProductPolicy & master
Definition: sgedgepolicy.hpp:37
SGEdgePolicy::incrementSubPolicy
bool incrementSubPolicy()
Increments the substitution.
Definition: sgedgepolicy.cpp:78
SGEdgePolicy::subPolicy
SGPolicySet::const_iterator subPolicy
Definition: sgedgepolicy.hpp:43
SGEdgePolicy
Class for iterating edges of a product policy.
Definition: sgedgepolicy.hpp:35
SGEdgePolicy::getBaseState
const int getBaseState() const
Returns the base state.
Definition: sgedgepolicy.hpp:66
SGEdgePolicy::SGEdgePolicy
SGEdgePolicy(const SGProductPolicy &_master)
Constructor.
Definition: sgedgepolicy.cpp:25
SGEdgePolicy::getPolicies
const vector< SGPolicySet::const_iterator > & getPolicies() const
Returns the current policy, as a vector of iterators.
Definition: sgedgepolicy.hpp:54