Skip to content

Commit

Permalink
fixed all them errors
Browse files Browse the repository at this point in the history
  • Loading branch information
amantham20 committed Dec 6, 2023
1 parent bea4fe5 commit 97b5ac2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion source/Agents/GP/CGPAgent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace cowboys {
/// @param doc The XML document to serialize to.
/// @param parentElem The parent element to serialize to.
/// @param fitness The fitness of this agent to write to the XML.
void Serialize(tinyxml2::XMLDocument &doc, tinyxml2::XMLElement *parentElem, double fitness = -1) override {
void SerializeGP(tinyxml2::XMLDocument &doc, tinyxml2::XMLElement *parentElem, double fitness = -1) override {
auto agentElem = doc.NewElement("CGPAgent");
parentElem->InsertEndChild(agentElem);

Expand Down
4 changes: 2 additions & 2 deletions source/Agents/GP/GPAgentBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ namespace cowboys {

};

virtual void Serialize(tinyxml2::XMLDocument &doc, tinyxml2::XMLElement *parentElem, double fitness = -1) = 0;
virtual void SerializeGP(tinyxml2::XMLDocument &doc, tinyxml2::XMLElement *parentElem, double fitness = -1) = 0;

/// TODO: Might have to remove it
virtual std::string Export() { return ""; }

virtual void Reset(bool /*hard*/ = false) { extra_state["previous_action"] = 0; };

// virtual void crossover(const GPAgentBase &other) {};
virtual void Import(const std::string &genotype) {};
virtual void Import(const std::string &genotype) = 0;

// -- Random Number Generation --

Expand Down
2 changes: 1 addition & 1 deletion source/Agents/GP/GPTrainingLoop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ namespace cowboys {

for (size_t i = 0; i < std::min(sortedAgents.size(), topN); ++i) {
auto [arenaIDX, agentIDX] = sortedAgents[i];
agents[arenaIDX][agentIDX]->Serialize(paramDocument, generationTag, TEMPAgentFitness[arenaIDX][agentIDX]);
agents[arenaIDX][agentIDX]->SerializeGP(paramDocument, generationTag, TEMPAgentFitness[arenaIDX][agentIDX]);
}


Expand Down
4 changes: 2 additions & 2 deletions source/Agents/GP/LGPAgent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ namespace cowboys
/// @param doc The XML document to serialize to.
/// @param parentElem The parent element to serialize to.
/// @param fitness The fitness of this agent to write to the XML.
void Serialize(tinyxml2::XMLDocument & doc, tinyxml2::XMLElement* parentElem, double fitness = -1) override
void SerializeGP(tinyxml2::XMLDocument & doc, tinyxml2::XMLElement* parentElem, double fitness = -1) override
{
auto agentElem = doc.NewElement("LGPAgent");
parentElem->InsertEndChild(agentElem);
Expand All @@ -299,7 +299,7 @@ namespace cowboys

/// @brief Load in the string representation of an LGP agent and configure this agent based on it.
/// @param genotype The string representation of an LGP agent.
void Import(std::string encodedLists) {
void Import(const std::string & encodedLists) override {
std::vector<std::tuple<std::string, int, int>> decodedInstructionsList = {};
std::string decodedInstruction;
size_t start_pos = 0;
Expand Down

0 comments on commit 97b5ac2

Please sign in to comment.