Empirical
|
#include <AvidaGP.h>
Public Types | |
using | base_t = AvidaCPU_Base< AvidaGP > |
using | genome_t = Genome |
using | inst_lib_t = AvidaCPU_InstLib< hardware_t, arg_t, INST_ARGS > |
using | this_t = AvidaCPU_Base< AvidaGP > |
using | hardware_t = AvidaGP |
using | inst_t = Instruction |
using | arg_t = size_t |
using | stack_t = emp::vector< double > |
using | arg_set_t = emp::array< arg_t, INST_ARGS > |
Public Member Functions | |
AvidaGP (const genome_t &in_genome) | |
AvidaGP (Ptr< const inst_lib_t > inst_lib) | |
AvidaGP (const inst_lib_t &inst_lib) | |
AvidaGP ()=default | |
AvidaGP (const AvidaGP &)=default | |
AvidaGP (AvidaGP &&)=default | |
virtual | ~AvidaGP () |
void | ExitScope () |
bool | UpdateScope (size_t new_scope, ScopeType type=ScopeType::BASIC) |
void | BypassScope (size_t scope) |
bool | operator< (const this_t &other) const |
void | Reset () |
Reset the entire CPU to a starting state, without a genome. More... | |
virtual void | ResetHardware () |
Reset just the CPU hardware, but keep the genome and traits. More... | |
void | ResetIP () |
Reset the instruction pointer to the beginning of the genome AND reset scope. More... | |
Ptr< const inst_lib_t > | GetInstLib () const |
inst_t | GetInst (size_t pos) const |
const genome_t & | GetGenome () const |
const size_t | GetSize () const |
double | GetReg (size_t id) const |
double | GetInput (int id) const |
const std::unordered_map< int, double > & | GetInputs () const |
size_t | GetNumInputs () const |
double | GetOutput (int id) const |
const std::unordered_map< int, double > & | GetOutputs () const |
size_t | GetNumOutputs () const |
const stack_t & | GetStack (size_t id) const |
int | GetFunStart (size_t id) const |
size_t | GetIP () const |
emp::vector< ScopeInfo > | GetScopeStack () const |
size_t | CurScope () const |
ScopeType | CurScopeType () const |
ScopeType | GetScopeType (size_t id) |
emp::vector< RegBackup > | GetRegStack () const |
emp::vector< size_t > | GetCallStack () const |
size_t | GetNumErrors () const |
double | GetTrait (size_t id) const |
const emp::vector< double > & | GetTraits () |
size_t | GetNumTraits () const |
void | SetInst (size_t pos, const inst_t &inst) |
void | SetInst (size_t pos, size_t id, size_t a0=0, size_t a1=0, size_t a2=0) |
void | SetGenome (const genome_t &g) |
void | SetReg (size_t id, double val) |
void | SetInput (int input_id, double value) |
void | SetInputs (const std::unordered_map< int, double > &vals) |
void | SetInputs (std::unordered_map< int, double > &&vals) |
void | SetOutput (int output_id, double value) |
void | SetOutputs (const std::unordered_map< int, double > &vals) |
void | SetOutputs (std::unordered_map< int, double > &&vals) |
double | PopStack (size_t id) |
void | PushStack (size_t id, double value) |
void | SetFunStart (size_t id, int value) |
void | SetIP (size_t pos) |
void | PushRegInfo (size_t scope_id, size_t reg_id) |
void | PushCallInfo (size_t pos) |
void | IncErrors () |
void | SetTrait (size_t id, double val) |
void | PushTrait (double val) |
inst_t | GetRandomInst (Random &rand) |
void | RandomizeInst (size_t pos, Random &rand) |
void | PushInst (size_t id, size_t a0=0, size_t a1=0, size_t a2=0) |
void | PushInst (const std::string &name, size_t a0=0, size_t a1=0, size_t a2=0) |
void | PushInst (const Instruction &inst) |
void | PushInst (Instruction &&inst) |
void | PushInstString (std::string info) |
void | PushRandom (Random &rand, const size_t count=1) |
bool | Load (std::istream &input) |
bool | Load (const std::string &filename) |
void | ProcessInst (const inst_t &inst) |
Process a specified instruction, provided by the caller. More... | |
size_t | InstScope (const inst_t &inst) const |
Determine the scope associated with a particular instruction. More... | |
void | SingleProcess () |
Process the NEXT instruction pointed to be the instruction pointer. More... | |
void | Process (size_t num_inst) |
Process the next SERIES of instructions, directed by the instruction pointer. More... | |
void | PrintInst (const inst_t &inst, std::ostream &os=std::cout) const |
Print out a single instruction, with its arguments. More... | |
void | PrintGenome (std::ostream &os=std::cout) const |
Print out this program. More... | |
void | PrintGenome (const std::string &filename) const |
size_t | PredictNextInst () const |
Figure out which instruction is going to actually be run next SingleProcess() More... | |
void | PrintState (std::ostream &os=std::cout) const |
Print out the state of the virtual CPU. More... | |
void | Trace (size_t num_inst, std::ostream &os=std::cout) |
Trace the instructions being exectured, with full CPU details. More... | |
void | Trace (size_t num_inst, const std::string &filename) |
Public Attributes | |
genome_t | genome |
emp::array< double, CPU_SIZE > | regs |
std::unordered_map< int, double > | inputs |
std::unordered_map< int, double > | outputs |
emp::array< stack_t, CPU_SIZE > | stacks |
emp::array< int, CPU_SIZE > | fun_starts |
size_t | inst_ptr |
emp::vector< ScopeInfo > | scope_stack |
emp::vector< RegBackup > | reg_stack |
emp::vector< size_t > | call_stack |
size_t | errors |
emp::vector< double > | traits |
Static Public Attributes | |
static constexpr size_t | CPU_SIZE |
static constexpr size_t | INST_ARGS |
static constexpr size_t | STACK_CAP |
|
inherited |
|
inherited |
using emp::AvidaGP::base_t = AvidaCPU_Base<AvidaGP> |
using emp::AvidaCPU_Base< HARDWARE >::genome_t = Genome |
|
inherited |
using emp::AvidaCPU_Base< HARDWARE >::inst_lib_t = AvidaCPU_InstLib<hardware_t, arg_t, INST_ARGS> |
|
inherited |
|
inherited |
|
inherited |
|
inline |
|
inline |
|
inline |
|
default |
|
default |
|
default |
|
inlinevirtual |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inherited |
Determine the scope associated with a particular instruction.
|
inherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inherited |
Figure out which instruction is going to actually be run next SingleProcess()
|
inherited |
Print out this program.
|
inherited |
|
inherited |
Print out a single instruction, with its arguments.
|
inherited |
Print out the state of the virtual CPU.
|
inlineinherited |
Process the next SERIES of instructions, directed by the instruction pointer.
|
inlineinherited |
Process a specified instruction, provided by the caller.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Reset the entire CPU to a starting state, without a genome.
|
inlinevirtualinherited |
Reset just the CPU hardware, but keep the genome and traits.
|
inlineinherited |
Reset the instruction pointer to the beginning of the genome AND reset scope.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Process the NEXT instruction pointed to be the instruction pointer.
|
inlineinherited |
Trace the instructions being exectured, with full CPU details.
|
inlineinherited |
|
inlineinherited |
|
inherited |
|
staticinherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
staticinherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
staticinherited |
|
inherited |
|
inherited |