25 throwIfInconsistentNumberOfStates();
29 std::shared_ptr<StateSpace> stateSpace(
new StateSpace(nbOfStates, nbOfPriorityStates, dimensions, priorityStates));
30 stateSpace->domainModel = domainModel;
41 assert(nbOfStates >= 0);
42 dimensions.push_back(dim);
47 if (domainModel ==
nullptr)
48 throw std::runtime_error(
"domainModel is null");
51 void StateSpaceBuilder::throwIfInconsistentNumberOfStates()
53 if (nbOfStates == 1 && nbOfDimensions == 0)
55 if (nbOfPriorityStates == 0)
56 throw std::runtime_error(
"StateSpace has no states defined");
57 if (nbOfPriorityStates == 1)
58 throw std::runtime_error(
"State space has no dimensions and only one priority state");
60 if (nbOfStates > 1 && nbOfDimensions > 0)
64 if (nbOfStates == 1 && nbOfDimensions > 0)
66 throw std::runtime_error(
"The state space has dimensions but all have only one state position");
68 if (nbOfStates == 0 && nbOfDimensions > 0)
70 throw std::runtime_error(
"A statespace dimension has zero state positions");
74 void StateSpaceBuilder::throwIfNoModel()
76 if (domainModel ==
nullptr)
78 throw std::runtime_error(
"no domain model specified");
88 priorityStates.push_back(prio);
void setDomainModel(std::shared_ptr< DomainModel > model)
sets the domain model used by the state space to determine current state
std::shared_ptr< DomainModel > domainModel
std::shared_ptr< StateSpace > getStateSpace()
call this function last!
void addDimension(StateSpaceDimension *dimension)
adds a dimension to the state space
virtual size_t getNumberOfPositions()=0
returns the number of possible positions along that dimension
void addPriorityState(PriorityState *)
adds single states to the state space
std::shared_ptr< DomainModel > domainModel
a single state of the state space
this models a dimension in the state space.