some template classes and functions which did not need
to be templates have been changed to normal classes and functions with hard coded typed This might help with M$VC++ 6.0 compatibility
This commit is contained in:
parent
61ea207287
commit
7abbf595f7
2 changed files with 9 additions and 10 deletions
|
|
@ -95,8 +95,7 @@ double _negate(double arg1)
|
|||
|
||||
// now let's define our tree nodes
|
||||
|
||||
template<class TreeNode>
|
||||
void init(vector<TreeNode> &initSequence)
|
||||
void init(vector<Node> &initSequence)
|
||||
{
|
||||
|
||||
// we have only one variable (X)
|
||||
|
|
@ -162,12 +161,12 @@ void init(vector<TreeNode> &initSequence)
|
|||
};
|
||||
|
||||
|
||||
template <class FType, class TreeNode>
|
||||
class RegFitness: public eoEvalFunc< eoParseTree<FType, TreeNode> >
|
||||
|
||||
class RegFitness: public eoEvalFunc< eoParseTree<FitnessType, Node> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef eoParseTree<FType, TreeNode> EoType;
|
||||
typedef eoParseTree<FitnessType, Node> EoType;
|
||||
|
||||
void operator()(EoType &_eo)
|
||||
{
|
||||
|
|
@ -175,7 +174,7 @@ class RegFitness: public eoEvalFunc< eoParseTree<FType, TreeNode> >
|
|||
vector< double > input(1); // the input variable(s)
|
||||
double output;
|
||||
double target;
|
||||
FType fitness;
|
||||
FitnessType fitness;
|
||||
|
||||
|
||||
float x=0;
|
||||
|
|
@ -205,9 +204,9 @@ class RegFitness: public eoEvalFunc< eoParseTree<FType, TreeNode> >
|
|||
|
||||
|
||||
|
||||
RegFitness(eoValueParam<unsigned> &_generationCounter, vector< TreeNode > &initSequence, Parameters &_parameter) : eoEvalFunc<EoType>(), generationCounter(_generationCounter), parameter(_parameter)
|
||||
RegFitness(eoValueParam<unsigned> &_generationCounter, vector< Node > &initSequence, Parameters &_parameter) : eoEvalFunc<EoType>(), generationCounter(_generationCounter), parameter(_parameter)
|
||||
{
|
||||
init<TreeNode>(initSequence);
|
||||
init(initSequence);
|
||||
best[NORMAL] = 1000;
|
||||
tree= "not found";
|
||||
};
|
||||
|
|
@ -221,7 +220,7 @@ class RegFitness: public eoEvalFunc< eoParseTree<FType, TreeNode> >
|
|||
private:
|
||||
eoValueParam<unsigned> &generationCounter; // so we know the current generation
|
||||
Parameters ¶meter; // the parameters
|
||||
FType best; // the best found fitness
|
||||
FitnessType best; // the best found fitness
|
||||
string tree;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ int main(int argc, char *argv[])
|
|||
// create an instantiation of the fitness/evaluation function
|
||||
// it initializes the initSequence vector
|
||||
// the parameters are passed on as well
|
||||
RegFitness<FitnessType, Node > eval(generationCounter, initSequence, parameter);
|
||||
RegFitness eval(generationCounter, initSequence, parameter);
|
||||
|
||||
// Depth Initializor, defaults to grow method.
|
||||
eoParseTreeDepthInit<FitnessType, Node> initializer(parameter.InitMaxDepth, initSequence);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue