CARLsim  6.1.0
CARLsim: a GPU-accelerated SNN simulator
PTI Class Reference

#include <PTI.h>

Classes

struct  PTIImpl
 

Public Member Functions

 PTI (const int argc, const char *const argv[], ostream &outputStream)
 
 PTI (const int argc, const char *const argv[], ostream &outputStream, istream &defaultInputStream)
 
 ~PTI ()
 
bool repOK () const
 
void runExperiment (const Experiment &experiment) const
 
string usage () const
 

Detailed Description

The CARLsim parameter-tuning interface (PTI) provides a standardized interface for tuning a model with an external optimization tool.

The PTI class reads a list of real-valued parameter vectors from a file or istream and passes them to an Experiment object to have their performance evaluated. You should implement a subclass of Experiment that executes your model and calculates some kind of information about its behavior, which PTI will write to an ostream.

The intent is that PTI and an Experiment can be used in the main method of a simple program:

int main(int argc, char* argv[]) {
/* First we Initialize an Experiment and a PTI object. The PTI parses CLI
* arguments, and then loads the Parameters from a file (if one has been
* specified by the user) or else from a default istream (std::cin here). */
const AbortExperiment experiment;
const PTI pti(argc, argv, std::cout, std::cin);
/* The PTI will now cheerfully iterate through all the Parameter sets and
* run your Experiment on each one, printing the results to the specified
* ostream (std::cout here). */
pti.runExperiment(experiment);
return 0;
}

A program like this can serve as the interface between CARLsim an an optimization tool (such as the ECJ metaheuristics toolkit).

Definition at line 28 of file PTI.h.

Constructor & Destructor Documentation

◆ PTI() [1/2]

PTI ( const int  argc,
const char *const  argv[],
ostream &  outputStream 
)

Parse command-line arguments and set up a PTI instance that writes fitnesses or phenotypes to the specified ostream.

If a file is specified in the arguments via the option '-f filename', then parameter vectors are read from the file. Otherwise, the are read from std::cin.

Parameters
argcThe number of command-line arguments
argvArray of command-line argument
outputStreamAn ostream to write fitness or phenotype values to

Definition at line 72 of file PTI.cpp.

Here is the call graph for this function:

◆ PTI() [2/2]

PTI ( const int  argc,
const char *const  argv[],
ostream &  outputStream,
istream &  defaultInputStream 
)

Parse command-line arguments and set up a PTI instance that writes fitnesses or phenotypes to the specified ostream.

If a file is specified in the arguments via the option '-f filename', then parameter vectors are read from the file. Otherwise, they are read from the specified default istream.

Parameters
argcThe number of command-line arguments
argvArray of command-line argument
outputStreamAn ostream to write fitness or phenotype values to
defaultInputStreamAn istream to receive parameter vectors from if no file is specified.

Definition at line 78 of file PTI.cpp.

Here is the call graph for this function:

◆ ~PTI()

~PTI ( )

Definition at line 85 of file PTI.cpp.

Member Function Documentation

◆ repOK()

bool repOK ( ) const

Representation invariant: used for debugging; always returns true unless the class's state is inconsistent.

Definition at line 102 of file PTI.cpp.

Here is the caller graph for this function:

◆ runExperiment()

void runExperiment ( const Experiment experiment) const

Execute an Experiment on the incoming parameter vectors, telling it to write results to the outgoing ostream.

Parameters
experimentThe Experiment whose Experiment::run() method should be executed.

Definition at line 97 of file PTI.cpp.

Here is the call graph for this function:

◆ usage()

string usage ( ) const

A string explaining how to use the command-line options.

Definition at line 87 of file PTI.cpp.


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