Skip to content

Class cowboys::Graph

ClassList > cowboys > Graph

A graph of nodes that can be used to make decisions.

  • #include <Graph.hpp>

Public Functions

Type Name
void AddLayer (const GraphLayer & layer)
Add a layer to the graph. Purely organizational, but important for CGP for determining the "layers back" parameter.
std::vector< std::shared_ptr< GraphNode > > GetFunctionalNodes () const
Returns a vector of functional (non-input) nodes in the graph.
size_t GetLayerCount () const
Get the number of layers in the graph.
size_t GetNodeCount () const
Get the number of nodes in the graph.
std::vector< std::shared_ptr< GraphNode > > GetNodes () const
Returns a vector of all nodes in the graph.
Graph () = default
size_t MakeDecision (const std::vector< double > & inputs, const std::vector< size_t > & actions)
Makes a decision based on the inputs and the action vector.
~Graph () = default

Protected Attributes

Type Name
std::vector< GraphLayer > layers
Layers of nodes in the graph.

Public Functions Documentation

function AddLayer

Add a layer to the graph. Purely organizational, but important for CGP for determining the "layers back" parameter.

inline void cowboys::Graph::AddLayer (
    const GraphLayer & layer
) 

Parameters:

  • layer The layer of nodes to add.

function GetFunctionalNodes

Returns a vector of functional (non-input) nodes in the graph.

inline std::vector< std::shared_ptr< GraphNode > > cowboys::Graph::GetFunctionalNodes () const

Returns:

A vector of functional nodes in the graph.

function GetLayerCount

Get the number of layers in the graph.

inline size_t cowboys::Graph::GetLayerCount () const

Returns:

The number of layers in the graph.

function GetNodeCount

Get the number of nodes in the graph.

inline size_t cowboys::Graph::GetNodeCount () const

Returns:

The number of nodes in the graph.

function GetNodes

Returns a vector of all nodes in the graph.

inline std::vector< std::shared_ptr< GraphNode > > cowboys::Graph::GetNodes () const

Returns:

A vector of all nodes in the graph.

function Graph

cowboys::Graph::Graph () = default

function MakeDecision

Makes a decision based on the inputs and the action vector.

inline size_t cowboys::Graph::MakeDecision (
    const std::vector< double > & inputs,
    const std::vector< size_t > & actions
) 

Parameters:

  • inputs The inputs to the graph.
  • action_vec The action vector.

Returns:

The action to take.

function ~Graph

cowboys::Graph::~Graph () = default

Protected Attributes Documentation

variable layers

std::vector<GraphLayer> layers;

The documentation for this class was generated from the following file source/Agents/GP/Graph.hpp