ian@0
|
1 // Copyright 2011, Ian Hobson.
|
ian@0
|
2 //
|
ian@0
|
3 // This file is part of gpsynth.
|
ian@0
|
4 //
|
ian@0
|
5 // gpsynth is free software: you can redistribute it and/or modify
|
ian@0
|
6 // it under the terms of the GNU General Public License as published by
|
ian@0
|
7 // the Free Software Foundation, either version 3 of the License, or
|
ian@0
|
8 // (at your option) any later version.
|
ian@0
|
9 //
|
ian@0
|
10 // gpsynth is distributed in the hope that it will be useful,
|
ian@0
|
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
ian@0
|
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
ian@0
|
13 // GNU General Public License for more details.
|
ian@0
|
14 //
|
ian@0
|
15 // You should have received a copy of the GNU General Public License
|
ian@0
|
16 // along with gpsynth in the file COPYING.
|
ian@0
|
17 // If not, see http://www.gnu.org/licenses/.
|
ian@0
|
18
|
ian@0
|
19 // The Grammar interface.
|
ian@0
|
20
|
ian@0
|
21 // TODO split out mutation behaviour in to new class
|
ian@0
|
22
|
ian@0
|
23 #pragma once
|
ian@0
|
24
|
ian@0
|
25 #include "synth_graph.hpp"
|
ian@0
|
26
|
ian@0
|
27 struct GrammarInterface {
|
ian@0
|
28
|
ian@0
|
29 virtual void RandomGraph(sg::Graph& graph) const = 0;
|
ian@0
|
30
|
ian@0
|
31 //virtual sg::Graph MutateGraph(const sg::Graph& graph) const = 0;
|
ian@0
|
32
|
ian@0
|
33 virtual void PickCrossoverNodes(const sg::Graph& parent_1,
|
ian@0
|
34 const sg::Graph& parent_2,
|
ian@0
|
35 sg::Vertex* node_1,
|
ian@0
|
36 sg::Vertex* node_2) const = 0;
|
ian@0
|
37
|
ian@0
|
38 virtual bool MutationAddSubTree(sg::Graph& graph) const = 0;
|
ian@0
|
39 virtual bool MutationReplaceSubTree(sg::Graph& graph) const = 0;
|
ian@0
|
40 virtual bool MutationModifyInputs(sg::Graph& graph) const = 0;
|
ian@0
|
41 virtual bool MutationModifyConnections(sg::Graph& graph) const = 0;
|
ian@0
|
42 virtual bool MutationReplaceCommand(sg::Graph& graph) const = 0;
|
ian@0
|
43 virtual bool MutationInsertCommand(sg::Graph& graph) const = 0;
|
ian@0
|
44 };
|