Class sdm::FunctionSpace

template <typename TFunction typename TFunction>

Class List > sdm > FunctionSpace

The class for function spaces. This is helpfull in case we need to enumerate all possible functions (only usable when input space and output space are DiscreteSpace ).More...

  • #include <function_space.hpp>

Inherits the following classes: sdm::DiscreteSpace

Public Types

Type Name
typedef DiscreteSpace::iterator_type iterator_type

Public Types inherited from sdm::DiscreteSpace

See sdm::DiscreteSpace

Type Name
typedef Space::iterator_type iterator_type
typedef std::shared_ptr< Item > value_type

Public Types inherited from sdm::Space

See sdm::Space

Type Name
typedef std::shared_ptr< ItemIterator > iterator_type

Public Functions

Type Name
FunctionSpace (const std::shared_ptr< Space > & input_space, const std::shared_ptr< Space > & output_space, bool store_functions=false)
FunctionSpace (std::vector< input_type > possible_inputs, std::vector< output_type > possible_outputs, bool store_functions=false)
Construct a new Function __Space object.
FunctionSpace (const std::shared_ptr< Space > & input_space, const std::vector< std::shared_ptr< Space >> & output_spaces, bool store_functions=false)
Construct a new Function __Space object.
FunctionSpace (std::vector< input_type > possible_inputs, std::vector< std::vector< output_type >> possible_outputs, bool store_functions=false)
virtual iterator_type begin ()
virtual iterator_type end ()

Public Functions inherited from sdm::DiscreteSpace

See sdm::DiscreteSpace

Type Name
DiscreteSpace ()
Construct a new Discrete Space object (default)
DiscreteSpace (const std::vector< std::shared_ptr< Item >> & items)
Construct a new Discrete Space object.
DiscreteSpace (const std::vector< T > & items)
DiscreteSpace (std::initializer_list< std::shared_ptr< Item >> vals)
Construct a new Discrete Space object from a list initializer.
DiscreteSpace (const DiscreteSpace & copy)
Copy constructor.
virtual iterator_type begin ()
bool contains (const std::shared_ptr< Item > &) const
Verify is the discrete space contains the std::shared_ptr<Item>;.
virtual iterator_type end ()
int find (const std::shared_ptr< Item > & item) const
std::vector< std::shared_ptr< Item > > getAll ()
Get all possible items in the space.
virtual std::vector< number > getDim () const
Get the dimension.
std::shared_ptr< Item > getItem (number index) const
Get the item at a specific index.
std::shared_ptr< Item > getItemAddress (const T & item_value)
Get the item at a specific index.
number getItemIndex (const std::shared_ptr< Item > & item) const
Get the index of an item.
number getNumItems () const
Get the number of items in the space.
virtual bool isDiscrete () const
Return true because this is a discrete space.
bool isStoringItems () const
bool operator!= (const DiscreteSpace & sp) const
bool operator== (const DiscreteSpace & sp) const
virtual std::shared_ptr< Item > sample () const
Sample a random item from the space.
std::string short_str () const
void storeItems (bool store_items)
virtual std::string str () const
Space as a string.

Public Functions inherited from sdm::Space

See sdm::Space

Type Name
virtual iterator_type begin () = 0
virtual iterator_type end () = 0
virtual std::vector< number > getDim () const = 0
Get the dimension of the space.
bool isContinuous () const
Check if the space is continous.
virtual bool isDiscrete () const = 0
Check if the space is discrete.
bool operator!= (const Space & sp) const
bool operator== (const Space & sp) const
virtual std::shared_ptr< Item > sample () const
Sample a random item from the space.
virtual std::string str () const = 0
Space as a string.
std::shared_ptr< DiscreteSpace > toDiscreteSpace ()
std::shared_ptr< MultiDiscreteSpace > toMultiDiscreteSpace ()
virtual ~Space ()

Protected Types

Type Name
typedef typename TFunction::input_type input_type
typedef typename TFunction::output_type output_type
typedef TFunction value_type

Protected Types inherited from sdm::DiscreteSpace

See sdm::DiscreteSpace

Type Name
typedef boost::bimaps::bimap< number, std::shared_ptr< Item > > items_bimap
typedef items_bimap::value_type items_bimap_value

Protected Attributes

Type Name
std::shared_ptr< Space > input_space_
The input space.
std::vector< std::shared_ptr< Space > > output_space_
The vector of output spaces (possibly one output space for each input space). In case output space are similar for all input, use the adequate constructor.

Protected Attributes inherited from sdm::DiscreteSpace

See sdm::DiscreteSpace

Type Name
items_bimap all_items_
the list of possible items in the space with their index
std::vector< std::shared_ptr< Item > > list_items_
the list of possible items without their index
number num_items_
number of possible items in the space (ex: [5, 12] > 8 items)
bool store_items_ = = true

Protected Functions inherited from sdm::DiscreteSpace

See sdm::DiscreteSpace

Type Name
void generateItems ()
Generates all joint items and maintains a bimap of indexes and corresponding pointers of joint items.
bool isGenerated ()

Detailed Description

Template parameters:

  • TFunction The type of function to generate.

Public Types Documentation

typedef iterator_type

using sdm::FunctionSpace< TFunction >::iterator_type =  DiscreteSpace::iterator_type;

Public Functions Documentation

function FunctionSpace [1/4]

sdm::FunctionSpace::FunctionSpace (
    const std::shared_ptr< Space > & input_space,
    const std::shared_ptr< Space > & output_space,
    bool store_functions=false
) 

function FunctionSpace [2/4]

sdm::FunctionSpace::FunctionSpace (
    std::vector< input_type > possible_inputs,
    std::vector< output_type > possible_outputs,
    bool store_functions=false
) 

Parameters:

  • possible_inputs possible inputs
  • possible_outputs possible ouputs

function FunctionSpace [3/4]

sdm::FunctionSpace::FunctionSpace (
    const std::shared_ptr< Space > & input_space,
    const std::vector< std::shared_ptr< Space >> & output_spaces,
    bool store_functions=false
) 

Parameters:

  • input_space
  • output_sps output spaces, one for each input value (requirements : input_space->size() == output_spaces.size() or output_spaces.size()==1).

function FunctionSpace [4/4]

sdm::FunctionSpace::FunctionSpace (
    std::vector< input_type > possible_inputs,
    std::vector< std::vector< output_type >> possible_outputs,
    bool store_functions=false
) 

function begin

virtual iterator_type sdm::FunctionSpace::begin () 

Implements sdm::DiscreteSpace::begin

function end

virtual iterator_type sdm::FunctionSpace::end () 

Implements sdm::DiscreteSpace::end

Protected Types Documentation

typedef input_type

using sdm::FunctionSpace< TFunction >::input_type =  typename TFunction::input_type;

typedef output_type

using sdm::FunctionSpace< TFunction >::output_type =  typename TFunction::output_type;

typedef value_type

using sdm::FunctionSpace< TFunction >::value_type =  TFunction;

Protected Attributes Documentation

variable input_space_

std::shared_ptr<Space> sdm::FunctionSpace< TFunction >::input_space_;

variable output_space_

std::vector<std::shared_ptr<Space> > sdm::FunctionSpace< TFunction >::output_space_;

The documentation for this class was generated from the following file src/sdm/core/space/function_space.hpp