diff src/grammar.hpp @ 0:add35537fdbb tip

Initial import
author irh <ian.r.hobson@gmail.com>
date Thu, 25 Aug 2011 11:05:55 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/grammar.hpp	Thu Aug 25 11:05:55 2011 +0100
@@ -0,0 +1,44 @@
+//  Copyright 2011, Ian Hobson.
+//
+//  This file is part of gpsynth.
+//
+//  gpsynth is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  gpsynth is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with gpsynth in the file COPYING. 
+//  If not, see http://www.gnu.org/licenses/.
+
+// The Grammar interface.
+
+// TODO split out mutation behaviour in to new class
+
+#pragma once
+
+#include "synth_graph.hpp"
+
+struct GrammarInterface {
+  
+  virtual void RandomGraph(sg::Graph& graph) const = 0;
+  
+  //virtual sg::Graph MutateGraph(const sg::Graph& graph) const = 0;
+  
+  virtual void PickCrossoverNodes(const sg::Graph& parent_1, 
+                                  const sg::Graph& parent_2,
+                                  sg::Vertex* node_1,
+                                  sg::Vertex* node_2) const = 0;
+
+  virtual bool MutationAddSubTree(sg::Graph& graph) const = 0;
+  virtual bool MutationReplaceSubTree(sg::Graph& graph) const = 0;
+  virtual bool MutationModifyInputs(sg::Graph& graph) const = 0;
+  virtual bool MutationModifyConnections(sg::Graph& graph) const = 0;
+  virtual bool MutationReplaceCommand(sg::Graph& graph) const = 0;
+  virtual bool MutationInsertCommand(sg::Graph& graph) const = 0;
+};