Construct version 5.4.3
An agent based modeling framework
Output_dynetml Struct Reference

Outputs the contents of a set of networks to dynetml files. More...

Inheritance diagram for Output_dynetml:
Collaboration diagram for Output_dynetml:

Public Member Functions

 ~Output_dynetml (void)
 
void process_nodesets ()
 
void process (void)
 
void add_output (const Graph< bool > *g)
 
template<typename T >
void add_output (const Graph< T > *g)
 
void process (unsigned int t) override
 Called after each model has executed. More...
 
 Output_dynetml (const dynet::ParameterMap &params, Construct &construct)
 Constructor for the "dynetml" type output. More...
 
- Public Member Functions inherited from Output
 Output (const dynet::ParameterMap &params, Construct &construct)
 Sets up the output to only record during certain timeperiods. Allows the usage of should_process.
 
 Output ()
 Creates an output that does not depend on time. Output::should_process should not be called when using this constructor.
 
bool should_process (int t)
 Given the current time index, returns true if the current time period is flagged to be processed.
 
virtual ~Output ()
 Virtual Deconstructor. More...
 
virtual std::vector< int > get_output_timeperiods (const dynet::ParameterMap &params, Construct &construct)
 Creates a vector of indexes that indicate in which timeperiod output should be processed. The parameter "timeperiods" in params controls this value. "all" will fill the entire the array with -1 followed by all timeperiods. "last" will set it to only contain the last time index. "initial" will set it to only contain -1. If it is none of these, the param is tokenized with a comma delimiter and converts the tokens to integers. Returned vector should always be ordered.
 
virtual void process (unsigned int t)=0
 Called after each model has executed. More...
 

Public Attributes

std::vector< const Typeless_Graph * > _graphs
 
std::unordered_set< const Nodeset * > _nodesets
 
std::unordered_map< const Nodeset *, const std::vector< dynet::ParameterMap > * > nodeset_attributes
 
std::ofstream _output_file
 

Detailed Description

Outputs the contents of a set of networks to dynetml files.

Constructor & Destructor Documentation

◆ ~Output_dynetml()

Output_dynetml::~Output_dynetml ( void  )
inline

summary>

◆ Output_dynetml()

Output_dynetml::Output_dynetml ( const dynet::ParameterMap params,
Construct construct 
)
inline

Constructor for the "dynetml" type output.

Exception Safety

If parameters "network names", "output file", or "timeperiods" are not in the ParameterMap, a dynet::could_not_find_parameter is thrown. If a network could not be found, a dynet::could_not_find_network is thrown. If a network is 3d (slice_nodeset != NULL), a dynet::construct_exception is thrown. If a network has data type std::string, an assertion is raised. If the "output file" parameter does not have extension ".xml", a dynet::wrong_file_extension is thrown. If this file can not be opened for writing, a dynet::could_not_open_file is thrown. If the value for parameter "timeperiods" is not "last", "all", or "initial", a dynet::unknown_value is thrown.

Here is the call graph for this function:

Member Function Documentation

◆ add_output() [1/2]

void Output_dynetml::add_output ( const Graph< bool > *  g)
inline

summary>

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_output() [2/2]

template<typename T >
void Output_dynetml::add_output ( const Graph< T > *  g)
inline

summary>

Here is the call graph for this function:

◆ process() [1/2]

void Output_dynetml::process ( unsigned int  t)
inlineoverridevirtual

Called after each model has executed.

Parameters
tThe current time period.

Implements Output.

Here is the call graph for this function:

◆ process() [2/2]

void Output_dynetml::process ( void  )
inline

summary>

Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_nodesets()

void Output_dynetml::process_nodesets ( )
inline

summary>

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _graphs

std::vector<const Typeless_Graph*> Output_dynetml::_graphs

summary>

◆ _nodesets

std::unordered_set<const Nodeset*> Output_dynetml::_nodesets

summary>

◆ nodeset_attributes

std::unordered_map<const Nodeset*, const std::vector<dynet::ParameterMap>* > Output_dynetml::nodeset_attributes

summary>