-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcl_ga_tools.h
55 lines (43 loc) · 1.24 KB
/
cl_ga_tools.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//cl_ga_tools.h
/*
Copyright (C) 2013 AIDEUS
authors: Sergey Rodionov (astroseger@gmail.com)
Alexey Potapov (potapov@aideus.com)
aideus.com
This file is part of cl-lab.
cl-lab is released under the GNU General Public License (GNU GPL).
Please read the included file COPYING for more information.
*/
//some tools for genetic algorithms
#ifndef __CL_GA_TOOLS_H__
#define __CL_GA_TOOLS_H__
#include "cl_base.h"
#include <set>
class cl_ga_valuator
{
public:
cl_ga_valuator(double pen_progsize, double pen_wrongrez, double pen_absentrez);
double evaluate(size_t prog_size, string rez, string req_rez);
private:
double pen_progsize, pen_wrongrez, pen_absentrez;
};
class cl_ga_member
{
public:
cl_term* term; //member in form of cl_term
string term_str; //term in form of string
double penalty; //quality assesment
string rez; //computation rezult (till required lenght)
int generation;
public:
~cl_ga_member() {if (term != NULL) delete term;};
};
class cl_ga_uniqchecker: private set<string>
{
public:
//if string is new --> return true and add string
//if string is not new --> return false
bool try_to_add(string s);
void delete_string(string s);
};
#endif