fuzzylite  6.0
A Fuzzy Logic Control Library in C++
fl::Console Class Reference

The Console class is a command-line tool that helps to utilize the fuzzylite library. More...

#include <Console.h>

Collaboration diagram for fl::Console:

Classes

struct  Option
 A command-line option given by key, value and description. More...
 

Public Member Functions

virtual std::string usage ()
 Returns a string representation of the usage of the command-line tool. More...
 
virtual std::vector< OptionavailableOptions ()
 Returns a vector of the options available from the command line. More...
 

Static Public Member Functions

static Enginemamdani ()
 Creates a new Mamdani Engine based on the SimpleDimmer example. More...
 
static EnginetakagiSugeno ()
 Creates a new TakagiSugeno Engine based on the Approximation example of \(sin(x)/x\). More...
 
static Enginehybrid ()
 Creates a new Hybrid Engine based on the Tipper example using Mamdani and TakagiSugeno outputs. More...
 
static int main (int argc, const char *argv[])
 

Static Public Attributes

static const std::string KW_INPUT_FILE
 Keyword for input file. More...
 
static const std::string KW_INPUT_FORMAT
 Keyword for input file format. More...
 
static const std::string KW_OUTPUT_FILE
 Keyword for output file. More...
 
static const std::string KW_OUTPUT_FORMAT
 Keyword for output file format. More...
 
static const std::string KW_EXAMPLE
 Keyword for built-in example. More...
 
static const std::string KW_DECIMALS
 Keyword for number of decimals. More...
 
static const std::string KW_DATA_INPUT_FILE
 Keyword for file containing input data. More...
 
static const std::string KW_DATA_VALUES
 Keyword for number of values to generate. More...
 
static const std::string KW_DATA_VALUES_SCOPE
 Keyword for the scope of the number of values to generate. More...
 
static const std::string KW_DATA_EXPORT_HEADER
 Keyword for exporting headers in FLD. More...
 
static const std::string KW_DATA_EXPORT_INPUTS
 Keyword for exporting input values in FLD. More...
 

Protected Member Functions

virtual std::map< std::string, std::string > parse (int argc, const char *argv[])
 
virtual void process (const std::map< std::string, std::string > &options)
 
virtual void process (const std::string &input, std::ostream &writer, const std::string &inputFormat, const std::string &outputFormat, const std::map< std::string, std::string > &options)
 
virtual int readCharacter ()
 
virtual void interactive (std::ostream &writer, Engine *engine)
 
virtual std::string interactiveHelp ()
 
virtual void exportAllExamples (const std::string &from, const std::string &to)
 
virtual void exportAllExamples (const std::string &from, const std::string &to, const std::string &examplesPath, const std::string &outputPath)
 
virtual void benchmark (const std::string &fllFile, const std::string &fldFile, int runs, std::ofstream *writer=fl::null) const
 Benchmarks the engine described in the FLL file against the dataset contained in the FLD file. More...
 
virtual void benchmarks (const std::string &fllFileList, const std::string &fldFileList, int runs, std::ofstream *writer=fl::null) const
 Benchmarks the list of engines against the list of datasets, both described as absolute or relative paths. More...
 

Detailed Description

The Console class is a command-line tool that helps to utilize the fuzzylite library.

Author
Juan Rada-Vilela, Ph.D.
Since
4.0

Definition at line 35 of file Console.h.

Member Function Documentation

◆ availableOptions()

virtual std::vector<Option> fl::Console::availableOptions ( )
virtual

Returns a vector of the options available from the command line.

Returns
a vector of the options available from the command line

◆ benchmark()

virtual void fl::Console::benchmark ( const std::string &  fllFile,
const std::string &  fldFile,
int  runs,
std::ofstream *  writer = fl::null 
) const
protectedvirtual

Benchmarks the engine described in the FLL file against the dataset contained in the FLD file.

Parameters
fllFileis the file describing the engine in FLL format
fldFileis the file containing the dataset in FLD format
runsis the number of runs to evaluate the benchmarks
writeris the output where the results will be written to
Exceptions
Exceptionif something goes wrong reading the files, importing the engines or evaluating the benchmark

◆ benchmarks()

virtual void fl::Console::benchmarks ( const std::string &  fllFileList,
const std::string &  fldFileList,
int  runs,
std::ofstream *  writer = fl::null 
) const
protectedvirtual

Benchmarks the list of engines against the list of datasets, both described as absolute or relative paths.

Parameters
fllFileListis the file containing the list of paths of engines in FLL format
fldFileListis the file containing the list of paths of datasets in FLD format
runsis the number of runs to evaluate the benchmarks
writeris the output where the results will be written to
Exceptions
Exceptionif something goes wrong reading the files, importing the engines or evaluating the benchmark

◆ exportAllExamples() [1/2]

virtual void fl::Console::exportAllExamples ( const std::string &  from,
const std::string &  to 
)
protectedvirtual

◆ exportAllExamples() [2/2]

virtual void fl::Console::exportAllExamples ( const std::string &  from,
const std::string &  to,
const std::string &  examplesPath,
const std::string &  outputPath 
)
protectedvirtual

◆ hybrid()

static Engine* fl::Console::hybrid ( )
static

Creates a new Hybrid Engine based on the Tipper example using Mamdani and TakagiSugeno outputs.

Returns
a new Hybrid Engine based on the Tipper example using Mamdani and TakagiSugeno outputs.

◆ interactive()

virtual void fl::Console::interactive ( std::ostream &  writer,
Engine engine 
)
protectedvirtual

◆ interactiveHelp()

virtual std::string fl::Console::interactiveHelp ( )
protectedvirtual

◆ main()

static int fl::Console::main ( int  argc,
const char *  argv[] 
)
static

◆ mamdani()

static Engine* fl::Console::mamdani ( )
static

Creates a new Mamdani Engine based on the SimpleDimmer example.

Returns
a new Mamdani Engine based on the SimpleDimmer example

◆ parse()

virtual std::map<std::string, std::string> fl::Console::parse ( int  argc,
const char *  argv[] 
)
protectedvirtual

◆ process() [1/2]

virtual void fl::Console::process ( const std::map< std::string, std::string > &  options)
protectedvirtual

◆ process() [2/2]

virtual void fl::Console::process ( const std::string &  input,
std::ostream &  writer,
const std::string &  inputFormat,
const std::string &  outputFormat,
const std::map< std::string, std::string > &  options 
)
protectedvirtual

◆ readCharacter()

virtual int fl::Console::readCharacter ( )
protectedvirtual

◆ takagiSugeno()

static Engine* fl::Console::takagiSugeno ( )
static

Creates a new TakagiSugeno Engine based on the Approximation example of \(sin(x)/x\).

Returns
a new TakagiSugeno Engine based on the Approximation example of \(sin(x)/x\)

◆ usage()

virtual std::string fl::Console::usage ( )
virtual

Returns a string representation of the usage of the command-line tool.

Returns
a string representation of the usage of the command-line tool

Member Data Documentation

◆ KW_DATA_EXPORT_HEADER

const std::string fl::Console::KW_DATA_EXPORT_HEADER
static

Keyword for exporting headers in FLD.

Definition at line 68 of file Console.h.

◆ KW_DATA_EXPORT_INPUTS

const std::string fl::Console::KW_DATA_EXPORT_INPUTS
static

Keyword for exporting input values in FLD.

Definition at line 70 of file Console.h.

◆ KW_DATA_INPUT_FILE

const std::string fl::Console::KW_DATA_INPUT_FILE
static

Keyword for file containing input data.

Definition at line 62 of file Console.h.

◆ KW_DATA_VALUES

const std::string fl::Console::KW_DATA_VALUES
static

Keyword for number of values to generate.

Definition at line 64 of file Console.h.

◆ KW_DATA_VALUES_SCOPE

const std::string fl::Console::KW_DATA_VALUES_SCOPE
static

Keyword for the scope of the number of values to generate.

Definition at line 66 of file Console.h.

◆ KW_DECIMALS

const std::string fl::Console::KW_DECIMALS
static

Keyword for number of decimals.

Definition at line 60 of file Console.h.

◆ KW_EXAMPLE

const std::string fl::Console::KW_EXAMPLE
static

Keyword for built-in example.

Definition at line 58 of file Console.h.

◆ KW_INPUT_FILE

const std::string fl::Console::KW_INPUT_FILE
static

Keyword for input file.

Definition at line 50 of file Console.h.

◆ KW_INPUT_FORMAT

const std::string fl::Console::KW_INPUT_FORMAT
static

Keyword for input file format.

Definition at line 52 of file Console.h.

◆ KW_OUTPUT_FILE

const std::string fl::Console::KW_OUTPUT_FILE
static

Keyword for output file.

Definition at line 54 of file Console.h.

◆ KW_OUTPUT_FORMAT

const std::string fl::Console::KW_OUTPUT_FORMAT
static

Keyword for output file format.

Definition at line 56 of file Console.h.


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