#include <SIG_Program.h>
Public Methods | |
SIGEL_Program::SIG_Program& | operator= (SIGEL_Program::SIG_Program& prg) |
This operator copies a complete program. More... | |
SIG_Program () | |
This constructor creates an empty program (that contains no program lines). More... | |
SIG_Program (SIGEL_GP::SIG_GPParameter ¶m, SIGEL_Robot::SIG_LanguageParameters &languageP, SIGEL_Tools::SIG_Randomizer& random) | |
This constructor creates a program. More... | |
virtual | ~SIG_Program () |
This destructor deletes all program lines and all data that belongs to the current program. More... | |
vector< SIGEL_Program::SIG_ProgramLine* >& | getPrgLines () |
This function returns the list of programlines. More... | |
void | writeToFile (QTextStream &file) |
This functions write a complete program to a text stream. More... | |
void | readFromFile (QTextStream &file) |
This function reads a program out of a given text stream. More... | |
void | printToString (QString &str) |
This function transfers a complete program into a QString. More... | |
void | clear () |
This function deletes a complete program. More... | |
void | print () |
This function has only been implemented for test purposes. More... | |
long | getProgramLength () |
This function returns the length of the current program. More... | |
SIGEL_Program::SIG_ProgramLine* | getLine (long no) |
This functions returns a program line. More... | |
void | deleteLine (long no) |
This function deletes the line with the index no. More... | |
void | appendLine (SIGEL_Program::SIG_ProgramLine *l) |
This function appends a line to program. More... | |
void | insertLine (long no, SIGEL_Program::SIG_ProgramLine *l) |
This function inserts a program line at position no. More... | |
SIG_Program (int length, int nop, SIGEL_Tools::SIG_Randomizer &r) | |
This constructor creates a program that contains randomly generated program lines. More... | |
void | generateRandomProgram (SIGEL_GP::SIG_GPParameter ¶m, SIGEL_Robot::SIG_LanguageParameters &languageP, SIGEL_Tools::SIG_Randomizer& random) |
This function generates a random program using the language and GP definitions. More... | |
void | importProgram ( QString& filename ) |
This function imports a complete program from an existing file. More... | |
void | exportProgram ( QString& filename ) |
This function exports a complete program to a file. More... | |
void | checkLength ( long minimum, long maximum, SIGEL_Tools::SIG_Randomizer &r, SIGEL_Robot::SIG_LanguageParameters &languageP, QArray< int > &prob, int &historyInfo ) |
This function checks if the current program length is too long or too short. More... | |
Protected Attributes | |
vector< SIG_ProgramLine* > | lines |
A program consists of program lines that contain the data of the correponding program instructions. The program lines are saved in a (Q)list, so the program supports all neccessary functions to work with such a list (of program lines). All program lines can be accessed with an index. The first line has the index 0.
Definition at line 48 of file SIG_Program.h.
|
This constructor creates an empty program (that contains no program lines).
Definition at line 233 of file SIG_Program.cpp. |
|
This constructor creates a program. Its properties are dependend on the language and GP parameters.
Definition at line 329 of file SIG_Program.cpp. |
|
This destructor deletes all program lines and all data that belongs to the current program.
Definition at line 357 of file SIG_Program.cpp. |
|
This constructor creates a program that contains randomly generated program lines. This constructor needs a randomizer because a program does not have an own randomizer. All parameters are simulated by fixed values, e.g. the length is always set to 15. This constructor should only be used for test purposes.
|
|
This function appends a line to program. It can also be the first program line.
Definition at line 172 of file SIG_Program.cpp. Referenced by checkLength(), SIGEL_GP::SIG_GPOperations::crossOver(), generateRandomProgram(), operator=(), and readFromFile(). |
|
This function checks if the current program length is too long or too short. In case of a too long program, the obsolete program lines (>maximum) will be deleted. In case of a too short program, the number of program lines will be increased to mininum. Definition at line 248 of file SIG_Program.cpp. Referenced by SIGEL_GP::SIG_GPOperations::crossOver(), SIGEL_GP::SIG_GPOperations::mutation(), and SIGEL_GP::SIG_GPOperations::reproduction(). |
|
This function deletes a complete program.
Definition at line 90 of file SIG_Program.cpp. Referenced by generateRandomProgram(), importProgram(), operator=(), readFromFile(), SIGEL_GP::SIG_GPIndividual::readFromFile(), and ~SIG_Program(). |
|
This function deletes the line with the index no.
Definition at line 158 of file SIG_Program.cpp. Referenced by checkLength(), SIGEL_GP::SIG_GPOperations::crossOver(), and SIGEL_GP::SIG_GPOperations::mutation(). |
|
This function exports a complete program to a file.
Definition at line 216 of file SIG_Program.cpp. Referenced by SIGEL_GP::SIG_GPIndividual::exportProgram(). |
|
This function generates a random program using the language and GP definitions. WARNING: An old program will be deleted.
Definition at line 337 of file SIG_Program.cpp. Referenced by SIG_Program(). |
|
This functions returns a program line.
Definition at line 143 of file SIG_Program.cpp. Referenced by SIGEL_GP::SIG_GPOperations::crossOver(), SIGEL_GP::SIG_GPOperations::mutation(), and operator=(). |
|
This function returns the list of programlines.
Definition at line 57 of file SIG_Program.cpp. |
|
This function returns the length of the current program.
Definition at line 52 of file SIG_Program.cpp. Referenced by appendLine(), checkLength(), SIGEL_GP::SIG_GPOperations::crossOver(), insertLine(), SIGEL_GP::SIG_GPOperations::mutation(), operator=(), readFromFile(), and writeToFile(). |
|
This function imports a complete program from an existing file.
Definition at line 198 of file SIG_Program.cpp. Referenced by SIGEL_GP::SIG_GPIndividual::importProgram(). |
|
This function inserts a program line at position no.
Definition at line 187 of file SIG_Program.cpp. Referenced by SIGEL_GP::SIG_GPOperations::mutation(). |
|
This operator copies a complete program.
Definition at line 12 of file SIG_Program.cpp. |
|
This function has only been implemented for test purposes. It is obsolete.
Definition at line 74 of file SIG_Program.cpp. Referenced by SIGEL_GP::SIG_GPIndividual::print(). |
|
This function transfers a complete program into a QString. The string can displayed, e.g. with cout.
Definition at line 62 of file SIG_Program.cpp. Referenced by SIGEL_MasterGUI::SIG_AllIndividualsView::slotSelectionChanged(), and SIGEL_SlaveGUI::SIG_SimulationWidget::visualizeThis(). |
|
This function reads a program out of a given text stream.
Definition at line 96 of file SIG_Program.cpp. Referenced by importProgram(), and SIGEL_GP::SIG_GPIndividual::readFromFile(). |
|
This functions write a complete program to a text stream.
Definition at line 81 of file SIG_Program.cpp. Referenced by exportProgram(), SIGEL_GP::SIG_GPPVMData::savePVMDataTransfer(), and SIGEL_GP::SIG_GPIndividual::writeToFile(). |
|
Definition at line 52 of file SIG_Program.h. |