Loading...
Searching...
No Matches
ompl::control::World Class Reference

A class to represent an assignment of boolean values to propositions. A World can be partially restrictive, i.e., some propositions do not have to be assigned a value, in which case it can take on any value. Our notion of a World is similar to a set of truth assignments in propositional logic. More...

#include <ompl/control/planners/ltl/World.h>

Public Member Functions

 World (unsigned int numProps)
 Initializes a world with a given number of propositions. More...
 
bool operator[] (unsigned int i) const
 Returns the boolean value of a given proposition in this World. Reports an error if the proposition has not set in this World. More...
 
bool & operator[] (unsigned int i)
 Returns the boolean value of a given proposition in this World. Creates a boolean value for the proposition if one does not already exist. More...
 
unsigned int numProps () const
 Returns the number of propositions declared for this World. Not all of the propositions have necessarily been set. More...
 
bool satisfies (const World &w) const
 Returns whether this World propositionally satisfies a given World w. Specifically, returns true iff for every proposition p assigned in w, p is assigned in this World and this[p] == w[p]. More...
 
std::string formula () const
 Returns a formatted string representation of this World, as a conjunction of literals. More...
 
const std::unordered_map< unsigned int, bool > & props () const
 Returns this World's underlying proposition-to-boolean assignment map. More...
 
bool operator== (const World &w) const
 Returns whether this World is equivalent to a given World, by comparing their truth assignment maps. More...
 
void clear ()
 Clears this world's truth assignment. More...
 

Protected Attributes

unsigned int numProps_
 
std::unordered_map< unsigned int, bool > props_
 

Friends

struct std::hash< World >
 

Detailed Description

A class to represent an assignment of boolean values to propositions. A World can be partially restrictive, i.e., some propositions do not have to be assigned a value, in which case it can take on any value. Our notion of a World is similar to a set of truth assignments in propositional logic.

Definition at line 71 of file World.h.

Constructor & Destructor Documentation

◆ World()

ompl::control::World::World ( unsigned int  numProps)

Initializes a world with a given number of propositions.

Definition at line 43 of file World.cpp.

Member Function Documentation

◆ clear()

void ompl::control::World::clear ( )

Clears this world's truth assignment.

Definition at line 99 of file World.cpp.

◆ formula()

std::string ompl::control::World::formula ( ) const

Returns a formatted string representation of this World, as a conjunction of literals.

Definition at line 77 of file World.cpp.

◆ numProps()

unsigned int ompl::control::World::numProps ( ) const

Returns the number of propositions declared for this World. Not all of the propositions have necessarily been set.

Definition at line 60 of file World.cpp.

◆ operator==()

bool ompl::control::World::operator== ( const World w) const

Returns whether this World is equivalent to a given World, by comparing their truth assignment maps.

Definition at line 94 of file World.cpp.

◆ operator[]() [1/2]

bool & ompl::control::World::operator[] ( unsigned int  i)

Returns the boolean value of a given proposition in this World. Creates a boolean value for the proposition if one does not already exist.

Definition at line 55 of file World.cpp.

◆ operator[]() [2/2]

bool ompl::control::World::operator[] ( unsigned int  i) const

Returns the boolean value of a given proposition in this World. Reports an error if the proposition has not set in this World.

Definition at line 47 of file World.cpp.

◆ props()

const std::unordered_map< unsigned int, bool > & ompl::control::World::props ( ) const

Returns this World's underlying proposition-to-boolean assignment map.

Definition at line 89 of file World.cpp.

◆ satisfies()

bool ompl::control::World::satisfies ( const World w) const

Returns whether this World propositionally satisfies a given World w. Specifically, returns true iff for every proposition p assigned in w, p is assigned in this World and this[p] == w[p].

Definition at line 65 of file World.cpp.

Friends And Related Function Documentation

◆ std::hash< World >

friend struct std::hash< World >
friend

Definition at line 107 of file World.h.

Member Data Documentation

◆ numProps_

unsigned int ompl::control::World::numProps_
protected

Definition at line 112 of file World.h.

◆ props_

std::unordered_map<unsigned int, bool> ompl::control::World::props_
protected

Definition at line 113 of file World.h.


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