Evoplex  0.2.1
Public Member Functions | List of all members
evoplex::AbstractModelInterface Class Referenceabstract

Provides a common interface for Model plugins. More...

#include <abstractmodel.h>

Inheritance diagram for evoplex::AbstractModelInterface:
evoplex::AbstractPlugin evoplex::AbstractModel

Public Member Functions

virtual ~AbstractModelInterface ()=default
 Provide a default destructor to keep compilers happy.
 
virtual void beforeLoop ()=0
 It is executed before the algorithmStep() loop. More...
 
virtual bool algorithmStep ()=0
 It is executed in a loop and must contain all the logic to perform ONE step. More...
 
virtual void afterLoop ()=0
 It is executed after the algorithmStep() loop ends. More...
 
virtual Values customOutputs (const Values &inputs) const =0
 Allows implementing custom outputs for the model plugin. More...
 
virtual bool init ()
 Initializes the plugin. More...
 
- Public Member Functions inherited from evoplex::AbstractPlugin
virtual bool init ()
 Initializes the plugin. More...
 
PRGprg () const
 pseudo-random generator pointer. More...
 
PRGrand () const
 prg() alias More...
 
const Attributesattrs () const
 Gets the plugin's attributes.
 
const QString & attrName (int attrId) const
 Gets the attribute's name for attrId. More...
 
const Valueattr (int attrId) const
 Gets the attribute's value for attrId. More...
 
Value attr (const QString &name, Value defaultValue=Value()) const
 Gets the value of the attribute name. More...
 
bool attrExists (const char *name) const
 Checks if the plugin's attribute name exists. More...
 
bool attrExists (const QString &name) const
 Checks if the plugin's attribute name exists. More...
 

Additional Inherited Members

- Protected Member Functions inherited from evoplex::AbstractPlugin
 AbstractPlugin ()=default
 constructor
 
 ~AbstractPlugin ()=default
 destructor
 
- Protected Attributes inherited from evoplex::AbstractPlugin
Trial * m_trial
 

Detailed Description

Provides a common interface for Model plugins.

See also
AbstractModel

Member Function Documentation

◆ afterLoop()

virtual void evoplex::AbstractModelInterface::afterLoop ( )
pure virtual

It is executed after the algorithmStep() loop ends.

The default implementation of this function does nothing.

Implemented in evoplex::AbstractModel.

◆ algorithmStep()

virtual bool evoplex::AbstractModelInterface::algorithmStep ( )
pure virtual

It is executed in a loop and must contain all the logic to perform ONE step.

Returns
true if algorithm is good for another step or false to stop asap.

◆ beforeLoop()

virtual void evoplex::AbstractModelInterface::beforeLoop ( )
pure virtual

It is executed before the algorithmStep() loop.

The default implementation of this function does nothing.

Implemented in evoplex::AbstractModel.

◆ customOutputs()

virtual Values evoplex::AbstractModelInterface::customOutputs ( const Values &  inputs) const
pure virtual

Allows implementing custom outputs for the model plugin.

A "custom output" can be plotted or stored in a file through Evoplex. The inputs must be defined in the metadata.json file. If an experiment requests some custom output, this function will be called once at each time step, receiving the requested inputs. The default implementation of this function does nothing.

Returns
the Value output for each of the inputs

Implemented in evoplex::AbstractModel.

◆ init()

virtual bool evoplex::AbstractPlugin::init

Initializes the plugin.

This method is called when the plugin is created and is mainly used to validate inputs and set the environment. The default implementation does nothing.

Returns
true if successful

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