* whitespace cleanup
This commit is contained in:
parent
56c6edab04
commit
70e60a50d2
195 changed files with 1763 additions and 1873 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
The Evolving Distribution Objects framework (EDO) is a template-based,
|
The Evolving Distribution Objects framework (EDO) is a template-based,
|
||||||
ANSI-C++ evolutionary computation library which helps you to write your
|
ANSI-C++ evolutionary computation library which helps you to write your
|
||||||
own estimation of distribution algorithms.
|
own estimation of distribution algorithms.
|
||||||
|
|
|
||||||
14
edo/COPYING
14
edo/COPYING
|
|
@ -1,5 +1,5 @@
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
Version 2.1, February 1999
|
Version 2.1, February 1999
|
||||||
|
|
||||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
as the successor of the GNU Library Public License, version 2, hence
|
as the successor of the GNU Library Public License, version 2, hence
|
||||||
the version number 2.1.]
|
the version number 2.1.]
|
||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
The licenses for most software are designed to take away your
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
|
@ -112,7 +112,7 @@ modification follow. Pay close attention to the difference between a
|
||||||
former contains code derived from the library, whereas the latter must
|
former contains code derived from the library, whereas the latter must
|
||||||
be combined with the library in order to run.
|
be combined with the library in order to run.
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
0. This License Agreement applies to any software library or other
|
0. This License Agreement applies to any software library or other
|
||||||
|
|
@ -432,7 +432,7 @@ decision will be guided by the two goals of preserving the free status
|
||||||
of all derivatives of our free software and of promoting the sharing
|
of all derivatives of our free software and of promoting the sharing
|
||||||
and reuse of software generally.
|
and reuse of software generally.
|
||||||
|
|
||||||
NO WARRANTY
|
NO WARRANTY
|
||||||
|
|
||||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||||
|
|
@ -455,9 +455,9 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
DAMAGES.
|
DAMAGES.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
How to Apply These Terms to Your New Libraries
|
How to Apply These Terms to Your New Libraries
|
||||||
|
|
||||||
If you develop a new library, and you want it to be of the greatest
|
If you develop a new library, and you want it to be of the greatest
|
||||||
possible use to the public, we recommend making it free software that
|
possible use to the public, we recommend making it free software that
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,3 @@ Authors:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "edo"
|
#include "edo"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,4 +60,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !_edoBounderRng_h
|
#endif // !_edoBounderRng_h
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,16 +39,16 @@ public:
|
||||||
|
|
||||||
void operator()( EOT& sol )
|
void operator()( EOT& sol )
|
||||||
{
|
{
|
||||||
unsigned int size = sol.size();
|
unsigned int size = sol.size();
|
||||||
assert(size > 0);
|
assert(size > 0);
|
||||||
|
|
||||||
for (unsigned int d = 0; d < size; ++d) {
|
for (unsigned int d = 0; d < size; ++d) {
|
||||||
|
|
||||||
if ( sol[d] < this->min()[d] || sol[d] > this->max()[d]) {
|
if ( sol[d] < this->min()[d] || sol[d] > this->max()[d]) {
|
||||||
// use EO's global "rng"
|
// use EO's global "rng"
|
||||||
sol[d] = rng.uniform( this->min()[d], this->max()[d] );
|
sol[d] = rng.uniform( this->min()[d], this->max()[d] );
|
||||||
}
|
}
|
||||||
} // for d in size
|
} // for d in size
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void operator ()(eoPop< EOT > & pop)
|
void operator ()(eoPop< EOT > & pop)
|
||||||
{
|
{
|
||||||
assert(pop.size() > 0);
|
assert(pop.size() > 0);
|
||||||
|
|
||||||
//double temperature = _initial_temperature;
|
//double temperature = _initial_temperature;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void operator ()(eoPop< EOT > & pop)
|
void operator ()(eoPop< EOT > & pop)
|
||||||
{
|
{
|
||||||
assert(pop.size() > 0);
|
assert(pop.size() > 0);
|
||||||
|
|
||||||
double temperature = _initial_temperature;
|
double temperature = _initial_temperature;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,3 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !_edoModifier_h
|
#endif // !_edoModifier_h
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,4 +42,3 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !_edoModifierMass_h
|
#endif // !_edoModifierMass_h
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,4 +44,3 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !_edoNormalMonoCenter_h
|
#endif // !_edoNormalMonoCenter_h
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
// (c) Thales group, 2010
|
// (c) Thales group, 2010
|
||||||
/*
|
/*
|
||||||
Authors:
|
Authors:
|
||||||
Johann Dreo <johann.dreo@thalesgroup.com>
|
Johann Dreo <johann.dreo@thalesgroup.com>
|
||||||
Caner Candan <caner.candan@thalesgroup.com>
|
Caner Candan <caner.candan@thalesgroup.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _edoNormalMulti_h
|
#ifndef _edoNormalMulti_h
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ public:
|
||||||
{
|
{
|
||||||
AtomType mean = distrib.mean()[i];
|
AtomType mean = distrib.mean()[i];
|
||||||
AtomType variance = distrib.variance()[i];
|
AtomType variance = distrib.variance()[i];
|
||||||
AtomType random = rng.normal(mean, variance);
|
AtomType random = rng.normal(mean, variance);
|
||||||
|
|
||||||
assert(variance >= 0);
|
assert(variance >= 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ from numpy import arange
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
for p1 in list(arange(0.1, 1.1, 0.1)):
|
for p1 in list(arange(0.1, 1.1, 0.1)):
|
||||||
for p2 in list(arange(-1., 0., 0.1)) + list(arange(0., 1.1, 0.1)):
|
for p2 in list(arange(-1., 0., 0.1)) + list(arange(0., 1.1, 0.1)):
|
||||||
for p3 in list(arange(0.1, 1.1, 0.1)):
|
for p3 in list(arange(0.1, 1.1, 0.1)):
|
||||||
gen = '%d_%.1f_%.1f_%.1f_%.1f' % (PSIZE, MEAN, p1, p2, p3)
|
gen = '%d_%.1f_%.1f_%.1f_%.1f' % (PSIZE, MEAN, p1, p2, p3)
|
||||||
cmd = CMD % ( PSIZE, MEAN, p1, p2, p3, gen, gen )
|
cmd = CMD % ( PSIZE, MEAN, p1, p2, p3, gen, gen )
|
||||||
print cmd
|
print cmd
|
||||||
system( cmd )
|
system( cmd )
|
||||||
|
|
|
||||||
36
eo/CHANGELOG
36
eo/CHANGELOG
|
|
@ -3592,7 +3592,7 @@ Date: Mon Jun 17 04:13:45 2002 +0000
|
||||||
|
|
||||||
Adding the truncation selectors.
|
Adding the truncation selectors.
|
||||||
2 versions: eoTruncatedSelectOne is an eoSelectOne, and
|
2 versions: eoTruncatedSelectOne is an eoSelectOne, and
|
||||||
eoTruncatedSelectMany works like an eoSelectMany (but is NOT)
|
eoTruncatedSelectMany works like an eoSelectMany (but is NOT)
|
||||||
|
|
||||||
Author: jeggermo <jeggermo>
|
Author: jeggermo <jeggermo>
|
||||||
Date: Mon Jun 10 14:10:35 2002 +0000
|
Date: Mon Jun 10 14:10:35 2002 +0000
|
||||||
|
|
@ -4537,8 +4537,8 @@ Date: Sat Nov 10 09:02:17 2001 +0000
|
||||||
|
|
||||||
Small modifications here and there to be MSVC++ compatible
|
Small modifications here and there to be MSVC++ compatible
|
||||||
Mainly, time.h -> ctime
|
Mainly, time.h -> ctime
|
||||||
definition of loop index out of loops when multiply used
|
definition of loop index out of loops when multiply used
|
||||||
no typename in declaration using template typename
|
no typename in declaration using template typename
|
||||||
|
|
||||||
Author: evomarc <evomarc>
|
Author: evomarc <evomarc>
|
||||||
Date: Sat Nov 10 06:59:02 2001 +0000
|
Date: Sat Nov 10 06:59:02 2001 +0000
|
||||||
|
|
@ -4883,8 +4883,8 @@ Date: Mon Jul 2 13:31:04 2001 +0000
|
||||||
|
|
||||||
Changed the directory structure for gp
|
Changed the directory structure for gp
|
||||||
now: eoParseTree <-- the eoParseTree class
|
now: eoParseTree <-- the eoParseTree class
|
||||||
eoParseTreeDepthInit <-- the eoParseTree depth initializer (eoGpDepthInitializer)
|
eoParseTreeDepthInit <-- the eoParseTree depth initializer (eoGpDepthInitializer)
|
||||||
eoParseTreeOp <-- the operators (xover and mutation)
|
eoParseTreeOp <-- the operators (xover and mutation)
|
||||||
|
|
||||||
base documentation written for:
|
base documentation written for:
|
||||||
* eoParseTree
|
* eoParseTree
|
||||||
|
|
@ -6014,8 +6014,8 @@ Date: Fri Feb 9 05:09:26 2001 +0000
|
||||||
I also changed
|
I also changed
|
||||||
- the eoQuadratic into eoQuad (as dicussed with Maarten)
|
- the eoQuadratic into eoQuad (as dicussed with Maarten)
|
||||||
- the eoBin into eoBit, with more appropriate names for the "binary"
|
- the eoBin into eoBit, with more appropriate names for the "binary"
|
||||||
operators (that can be unary!) as no one protested when I posted on
|
operators (that can be unary!) as no one protested when I posted on
|
||||||
eodev list
|
eodev list
|
||||||
|
|
||||||
Author: evomarc <evomarc>
|
Author: evomarc <evomarc>
|
||||||
Date: Wed Feb 7 05:15:18 2001 +0000
|
Date: Wed Feb 7 05:15:18 2001 +0000
|
||||||
|
|
@ -6039,7 +6039,7 @@ Date: Wed Feb 7 05:04:24 2001 +0000
|
||||||
Added selection methods
|
Added selection methods
|
||||||
eoBestSelect always return the best individual
|
eoBestSelect always return the best individual
|
||||||
eoSequentialSelect a selectOne version of eoDetSelect (uses an index to
|
eoSequentialSelect a selectOne version of eoDetSelect (uses an index to
|
||||||
return next offspring from sorted pop)
|
return next offspring from sorted pop)
|
||||||
|
|
||||||
Author: evomarc <evomarc>
|
Author: evomarc <evomarc>
|
||||||
Date: Thu Feb 1 05:27:36 2001 +0000
|
Date: Thu Feb 1 05:27:36 2001 +0000
|
||||||
|
|
@ -6630,16 +6630,16 @@ Author: evomarc <evomarc>
|
||||||
Date: Mon Dec 4 06:58:43 2000 +0000
|
Date: Mon Dec 4 06:58:43 2000 +0000
|
||||||
|
|
||||||
Added the lastCall construct: if the stopping condition becomes true in eoCheckPoint,
|
Added the lastCall construct: if the stopping condition becomes true in eoCheckPoint,
|
||||||
a method called lastCall is called for everything contained in that checkpoint
|
a method called lastCall is called for everything contained in that checkpoint
|
||||||
(stats, updaters and monitors). This can be extremely useful
|
(stats, updaters and monitors). This can be extremely useful
|
||||||
- for stateSavers (see below)
|
- for stateSavers (see below)
|
||||||
- for monitoring things like rates of success of operators, where what you
|
- for monitoring things like rates of success of operators, where what you
|
||||||
are interested in is the final result only.
|
are interested in is the final result only.
|
||||||
Added of course a virtual method lastCall that does nothing by default in classes
|
Added of course a virtual method lastCall that does nothing by default in classes
|
||||||
eoBaseStat, eoBaseSortedStat, eoUpdater and eoMonitor
|
eoBaseStat, eoBaseSortedStat, eoUpdater and eoMonitor
|
||||||
Added a boolean to control the save of the state in method eoCountedStateSaver::lastCall
|
Added a boolean to control the save of the state in method eoCountedStateSaver::lastCall
|
||||||
so you can ask that the state is saved at final population, whatever happens.
|
so you can ask that the state is saved at final population, whatever happens.
|
||||||
I also added the corresponding constructor to take this into account.
|
I also added the corresponding constructor to take this into account.
|
||||||
|
|
||||||
Author: evomarc <evomarc>
|
Author: evomarc <evomarc>
|
||||||
Date: Mon Dec 4 05:55:59 2000 +0000
|
Date: Mon Dec 4 05:55:59 2000 +0000
|
||||||
|
|
@ -6822,8 +6822,8 @@ Author: evomarc <evomarc>
|
||||||
Date: Tue Nov 28 06:46:37 2000 +0000
|
Date: Tue Nov 28 06:46:37 2000 +0000
|
||||||
|
|
||||||
Modified the contructor: the default value for the delimiter is now " "
|
Modified the contructor: the default value for the delimiter is now " "
|
||||||
and I added a boolean argument to indicate whether or not we want to
|
and I added a boolean argument to indicate whether or not we want to
|
||||||
overwrite an existing file with same name (default is overwrite).
|
overwrite an existing file with same name (default is overwrite).
|
||||||
Added the getFileName accessor.
|
Added the getFileName accessor.
|
||||||
|
|
||||||
Author: evomarc <evomarc>
|
Author: evomarc <evomarc>
|
||||||
|
|
|
||||||
|
|
@ -457,7 +457,7 @@ DAMAGES.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
How to Apply These Terms to Your New Libraries
|
How to Apply These Terms to Your New Libraries
|
||||||
|
|
||||||
If you develop a new library, and you want it to be of the greatest
|
If you develop a new library, and you want it to be of the greatest
|
||||||
possible use to the public, we recommend making it free software that
|
possible use to the public, we recommend making it free software that
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
# NOTE: only add something here if it is really needed by EO
|
# NOTE: only add something here if it is really needed by EO
|
||||||
|
|
||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
|
|
@ -28,6 +27,3 @@ check_include_files(stdint.h "stdint.h" HAVE_STDINT_H)
|
||||||
# check is to be added to get the proper set of headers. Example :
|
# check is to be added to get the proper set of headers. Example :
|
||||||
|
|
||||||
#check_symbol_exists(asymbol "symbole.h" HAVE_SYMBOLE)
|
#check_symbol_exists(asymbol "symbole.h" HAVE_SYMBOLE)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -233,4 +233,3 @@ operates.
|
||||||
|
|
||||||
`configure' also accepts some other, not widely useful, options. Run
|
`configure' also accepts some other, not widely useful, options. Run
|
||||||
`configure --help' for more details.
|
`configure --help' for more details.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -457,7 +457,7 @@ DAMAGES.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
How to Apply These Terms to Your New Libraries
|
How to Apply These Terms to Your New Libraries
|
||||||
|
|
||||||
If you develop a new library, and you want it to be of the greatest
|
If you develop a new library, and you want it to be of the greatest
|
||||||
possible use to the public, we recommend making it free software that
|
possible use to the public, we recommend making it free software that
|
||||||
|
|
@ -500,5 +500,3 @@ necessary. Here is a sample; alter the names:
|
||||||
Ty Coon, President of Vice
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
That's all there is to it!
|
That's all there is to it!
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
11
eo/NEWS
11
eo/NEWS
|
|
@ -7,11 +7,11 @@
|
||||||
- GCC 4.3 compatibility
|
- GCC 4.3 compatibility
|
||||||
- new versatile log system with several nested verbose levels
|
- new versatile log system with several nested verbose levels
|
||||||
- classes using intern verbose parameters marked as deprecated, please update your code accordingly if you use one of the following files:
|
- classes using intern verbose parameters marked as deprecated, please update your code accordingly if you use one of the following files:
|
||||||
eo/src/eoCombinedInit.h
|
eo/src/eoCombinedInit.h
|
||||||
eo/src/eoGenContinue.h
|
eo/src/eoGenContinue.h
|
||||||
eo/src/eoProportionalCombinedOp.h
|
eo/src/eoProportionalCombinedOp.h
|
||||||
eo/src/utils/eoData.h
|
eo/src/utils/eoData.h
|
||||||
eo/src/utils/eoStdoutMonitor.h
|
eo/src/utils/eoStdoutMonitor.h
|
||||||
- an evaluator that throw an exception if a maximum eval numbers has been reached, independently of the number of generations
|
- an evaluator that throw an exception if a maximum eval numbers has been reached, independently of the number of generations
|
||||||
- new monitor that can write on any ostream
|
- new monitor that can write on any ostream
|
||||||
- new continuator that can catch POSIX system user signals
|
- new continuator that can catch POSIX system user signals
|
||||||
|
|
@ -39,4 +39,3 @@
|
||||||
* release 0.9.3z.1 (1. Oct. 2005)
|
* release 0.9.3z.1 (1. Oct. 2005)
|
||||||
- Support gcc-3.4 and gcc.4.x.
|
- Support gcc-3.4 and gcc.4.x.
|
||||||
- Provide full automake/autoconf/configure support.
|
- Provide full automake/autoconf/configure support.
|
||||||
|
|
||||||
|
|
|
||||||
11
eo/README
11
eo/README
|
|
@ -1,8 +1,7 @@
|
||||||
|
EO README FILE
|
||||||
EO README FILE
|
|
||||||
|
|
||||||
=======================================================================
|
=======================================================================
|
||||||
check latest news at http://eodev.sourceforge.net/
|
check latest news at http://eodev.sourceforge.net/
|
||||||
=======================================================================
|
=======================================================================
|
||||||
|
|
||||||
Welcome to EO, the Evolving Objects library.
|
Welcome to EO, the Evolving Objects library.
|
||||||
|
|
@ -23,7 +22,7 @@ an introduction;)
|
||||||
|
|
||||||
|
|
||||||
==================================================================
|
==================================================================
|
||||||
BUILDING EO
|
BUILDING EO
|
||||||
==================================================================
|
==================================================================
|
||||||
The basic installation procedure goes the following:
|
The basic installation procedure goes the following:
|
||||||
|
|
||||||
|
|
@ -50,7 +49,7 @@ specific about EO.
|
||||||
|
|
||||||
|
|
||||||
===================================================================
|
===================================================================
|
||||||
DIRECTORY STRUCTURE
|
DIRECTORY STRUCTURE
|
||||||
===================================================================
|
===================================================================
|
||||||
After unpacking the archive file, you should end up with the following
|
After unpacking the archive file, you should end up with the following
|
||||||
structure:
|
structure:
|
||||||
|
|
@ -103,7 +102,7 @@ structure:
|
||||||
|
|
||||||
|
|
||||||
===================================================================
|
===================================================================
|
||||||
NOTES
|
NOTES
|
||||||
===================================================================
|
===================================================================
|
||||||
If you extracted a fresh snapshot from the cvs-repository, remember
|
If you extracted a fresh snapshot from the cvs-repository, remember
|
||||||
to run
|
to run
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,3 @@ IF(NOT WIN32 OR CYGWIN)
|
||||||
ENDIF(NOT WIN32 OR CYGWIN)
|
ENDIF(NOT WIN32 OR CYGWIN)
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -207,12 +207,12 @@ int correct(const mlp::net& net, const mlp::set& set)
|
||||||
unsigned partial = 0;
|
unsigned partial = 0;
|
||||||
|
|
||||||
for (unsigned i = 0; i < s->output.size(); ++i)
|
for (unsigned i = 0; i < s->output.size(); ++i)
|
||||||
if ((s->output[i] < 0.5 && net(s->input)[i] < 0.5) ||
|
if ((s->output[i] < 0.5 && net(s->input)[i] < 0.5) ||
|
||||||
(s->output[i] > 0.5 && net(s->input)[i] > 0.5))
|
(s->output[i] > 0.5 && net(s->input)[i] > 0.5))
|
||||||
++partial;
|
++partial;
|
||||||
|
|
||||||
if (partial == s->output.size())
|
if (partial == s->output.size())
|
||||||
++sum;
|
++sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sum;
|
return sum;
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ namespace l2
|
||||||
while (++current_layer != rend())
|
while (++current_layer != rend())
|
||||||
{
|
{
|
||||||
reverse_iterator forward_layer = current_layer - 1;
|
reverse_iterator forward_layer = current_layer - 1;
|
||||||
reverse_iterator backward_layer = current_layer + 1;
|
reverse_iterator backward_layer = current_layer + 1;
|
||||||
|
|
||||||
for (unsigned j = 0; j < current_layer->size(); ++j)
|
for (unsigned j = 0; j < current_layer->size(); ++j)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ namespace std {
|
||||||
istream& operator>>(istream& is, mlp::vector& v)
|
istream& operator>>(istream& is, mlp::vector& v)
|
||||||
{
|
{
|
||||||
for (mlp::vector::iterator vi = v.begin() ; vi != v.end() ; vi++) {
|
for (mlp::vector::iterator vi = v.begin() ; vi != v.end() ; vi++) {
|
||||||
is >> *vi;
|
is >> *vi;
|
||||||
}
|
}
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
@ -133,15 +133,15 @@ namespace mlp
|
||||||
#ifdef HAVE_LIBYAML_CPP
|
#ifdef HAVE_LIBYAML_CPP
|
||||||
YAML_SERIALIZABLE_AUTO(neuron)
|
YAML_SERIALIZABLE_AUTO(neuron)
|
||||||
void emit_yaml(YAML::Emitter&out) const {
|
void emit_yaml(YAML::Emitter&out) const {
|
||||||
out << YAML::BeginMap;
|
out << YAML::BeginMap;
|
||||||
out << YAML::Key << "Class" << YAML::Value << "mlp::neuron";
|
out << YAML::Key << "Class" << YAML::Value << "mlp::neuron";
|
||||||
YAML_EMIT_MEMBER(out,bias);
|
YAML_EMIT_MEMBER(out,bias);
|
||||||
YAML_EMIT_MEMBER(out,weight);
|
YAML_EMIT_MEMBER(out,weight);
|
||||||
out << YAML::EndMap;
|
out << YAML::EndMap;
|
||||||
}
|
}
|
||||||
void load_yaml(const YAML::Node& node) {
|
void load_yaml(const YAML::Node& node) {
|
||||||
YAML_LOAD_MEMBER(node, bias);
|
YAML_LOAD_MEMBER(node, bias);
|
||||||
YAML_LOAD_MEMBER(node, weight);
|
YAML_LOAD_MEMBER(node, weight);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
@ -213,17 +213,17 @@ namespace mlp {
|
||||||
}
|
}
|
||||||
#ifdef HAVE_LIBYAML_CPP
|
#ifdef HAVE_LIBYAML_CPP
|
||||||
friend ostream& operator<<(YAML::Emitter& e, const layer &l) {
|
friend ostream& operator<<(YAML::Emitter& e, const layer &l) {
|
||||||
e << ((std::vector<neuron>)l);
|
e << ((std::vector<neuron>)l);
|
||||||
}
|
}
|
||||||
|
|
||||||
friend void operator>>(const YAML::Node& n, layer &l) {
|
friend void operator>>(const YAML::Node& n, layer &l) {
|
||||||
// These temporary variable shenanegins are necessary because
|
// These temporary variable shenanegins are necessary because
|
||||||
// the compiler gets very confused about which template operator>>
|
// the compiler gets very confused about which template operator>>
|
||||||
// function to use.
|
// function to use.
|
||||||
// The following does not work: n >> l;
|
// The following does not work: n >> l;
|
||||||
// So we use a temporary variable thusly:
|
// So we use a temporary variable thusly:
|
||||||
std::vector<mlp::neuron> *obviously_a_vector = &l;
|
std::vector<mlp::neuron> *obviously_a_vector = &l;
|
||||||
n >> *obviously_a_vector;
|
n >> *obviously_a_vector;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -243,7 +243,7 @@ namespace std {
|
||||||
istream& operator>>(istream& is, mlp::layer& l)
|
istream& operator>>(istream& is, mlp::layer& l)
|
||||||
{
|
{
|
||||||
for (mlp::layer::iterator li = l.begin() ; li != l.end() ; li++) {
|
for (mlp::layer::iterator li = l.begin() ; li != l.end() ; li++) {
|
||||||
is >> *li;
|
is >> *li;
|
||||||
}
|
}
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
@ -277,13 +277,13 @@ namespace mlp {
|
||||||
#ifdef HAVE_LIBYAML_CPP
|
#ifdef HAVE_LIBYAML_CPP
|
||||||
YAML_SERIALIZABLE_AUTO(net)
|
YAML_SERIALIZABLE_AUTO(net)
|
||||||
void emit_members(YAML::Emitter&out) const {
|
void emit_members(YAML::Emitter&out) const {
|
||||||
const std::vector<layer>* me_as_layer_vector = this;
|
const std::vector<layer>* me_as_layer_vector = this;
|
||||||
out << YAML::Key << "layers" << YAML::Value << *me_as_layer_vector;
|
out << YAML::Key << "layers" << YAML::Value << *me_as_layer_vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_members(const YAML::Node& node) {
|
void load_members(const YAML::Node& node) {
|
||||||
std::vector<layer>* me_as_layer_vector = this;
|
std::vector<layer>* me_as_layer_vector = this;
|
||||||
node["layers"] >> *me_as_layer_vector;
|
node["layers"] >> *me_as_layer_vector;
|
||||||
}
|
}
|
||||||
#endif // HAVE_LIBYAML_CPP
|
#endif // HAVE_LIBYAML_CPP
|
||||||
|
|
||||||
|
|
@ -303,14 +303,14 @@ namespace mlp {
|
||||||
is >> layer_size;
|
is >> layer_size;
|
||||||
layer_sizes.push_back(layer_size);
|
layer_sizes.push_back(layer_size);
|
||||||
}
|
}
|
||||||
unsigned check_outputs;
|
unsigned check_outputs;
|
||||||
is >> check_outputs;
|
is >> check_outputs;
|
||||||
assert (check_outputs == num_outputs);
|
assert (check_outputs == num_outputs);
|
||||||
init (num_inputs,num_outputs,layer_sizes);
|
init (num_inputs,num_outputs,layer_sizes);
|
||||||
// skip forward to pass up opening '<' char
|
// skip forward to pass up opening '<' char
|
||||||
char c=' ';
|
char c=' ';
|
||||||
while (c!='<' && !is.eof()) { is >> c;}
|
while (c!='<' && !is.eof()) { is >> c;}
|
||||||
for (iterator l =begin() ; l != end(); l++) {
|
for (iterator l =begin() ; l != end(); l++) {
|
||||||
is >> *l;
|
is >> *l;
|
||||||
}
|
}
|
||||||
do { is >> c; } while (c == ' ' && !is.eof());
|
do { is >> c; } while (c == ' ' && !is.eof());
|
||||||
|
|
@ -351,15 +351,15 @@ namespace mlp {
|
||||||
}
|
}
|
||||||
|
|
||||||
void save(ostream &os) const {
|
void save(ostream &os) const {
|
||||||
// Save the number of inputs, number of outputs, and number of hidden layers
|
// Save the number of inputs, number of outputs, and number of hidden layers
|
||||||
os << num_inputs() << "\n" << num_outputs() << "\n" << num_hidden_layers() << "\n";
|
os << num_inputs() << "\n" << num_outputs() << "\n" << num_hidden_layers() << "\n";
|
||||||
for(const_iterator l = begin(); l != end(); ++l)
|
for(const_iterator l = begin(); l != end(); ++l)
|
||||||
os << l->size() << " ";
|
os << l->size() << " ";
|
||||||
os << "\n";
|
os << "\n";
|
||||||
os << "< ";
|
os << "< ";
|
||||||
for(const_iterator l = begin(); l != end(); ++l)
|
for(const_iterator l = begin(); l != end(); ++l)
|
||||||
os << *l << " ";
|
os << *l << " ";
|
||||||
os << ">\n";
|
os << ">\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -454,7 +454,7 @@ namespace mlp {
|
||||||
|
|
||||||
void load(istream &is) {
|
void load(istream &is) {
|
||||||
unsigned input_size, output_size;
|
unsigned input_size, output_size;
|
||||||
is >> input_size >> output_size;
|
is >> input_size >> output_size;
|
||||||
sample samp(input_size, output_size);;
|
sample samp(input_size, output_size);;
|
||||||
while (is >> samp) { push_back(samp); }
|
while (is >> samp) { push_back(samp); }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ namespace qp
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
for(iterator n = begin(); n != end(); ++n)
|
for(iterator n = begin(); n != end(); ++n)
|
||||||
n->reset();
|
n->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
vector operator()(const vector& input)
|
vector operator()(const vector& input)
|
||||||
|
|
@ -110,7 +110,7 @@ namespace qp
|
||||||
vector output(size());
|
vector output(size());
|
||||||
|
|
||||||
for(unsigned i = 0; i < output.size(); ++i)
|
for(unsigned i = 0; i < output.size(); ++i)
|
||||||
output[i] = (*this)[i](input);
|
output[i] = (*this)[i](input);
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +135,7 @@ namespace qp
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
for(iterator l = begin(); l != end(); ++l)
|
for(iterator l = begin(); l != end(); ++l)
|
||||||
l->reset();
|
l->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
real train(const set& ts,
|
real train(const set& ts,
|
||||||
|
|
|
||||||
|
|
@ -211,4 +211,3 @@ template<class T> T euclidean_distance(const std::vector<T>& v1,
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,4 +36,3 @@ SET_TARGET_PROPERTIES(gpsymreg PROPERTIES VERSION "${GPSYMREG_VERSION}")
|
||||||
TARGET_LINK_LIBRARIES(gpsymreg eo eoutils)
|
TARGET_LINK_LIBRARIES(gpsymreg eo eoutils)
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
jeggermo@liacs.nl
|
jeggermo@liacs.nl
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _FITNESS_FUNCTION_H
|
#ifndef _FITNESS_FUNCTION_H
|
||||||
|
|
@ -225,4 +225,3 @@ class RegFitness: public eoEvalFunc< eoParseTree<FitnessType, Node> >
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
|
|
||||||
jeggermo@liacs.nl
|
jeggermo@liacs.nl
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -146,25 +146,25 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
// the parameters are passed on as well
|
// the parameters are passed on as well
|
||||||
|
|
||||||
RegFitness eval(generationCounter, initSequence, parameter);
|
RegFitness eval(generationCounter, initSequence, parameter);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Depth Initializor, set for Ramped Half and Half Initialization
|
// Depth Initializor, set for Ramped Half and Half Initialization
|
||||||
|
|
||||||
eoParseTreeDepthInit<FitnessType, Node> initializer(parameter.InitMaxDepth, initSequence, true, true);
|
eoParseTreeDepthInit<FitnessType, Node> initializer(parameter.InitMaxDepth, initSequence, true, true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create the initial population
|
// create the initial population
|
||||||
|
|
||||||
Pop pop(parameter.population_size, initializer);
|
Pop pop(parameter.population_size, initializer);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// and evaluate the individuals
|
// and evaluate the individuals
|
||||||
|
|
||||||
apply<EoType>(eval, pop);
|
apply<EoType>(eval, pop);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -335,10 +335,3 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
jeggermo@liacs.nl
|
jeggermo@liacs.nl
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _NODE_H
|
#ifndef _NODE_H
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
jeggermo@liacs.nl
|
jeggermo@liacs.nl
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _PARAMETERS_FUNCTION_H
|
#ifndef _PARAMETERS_FUNCTION_H
|
||||||
|
|
@ -100,8 +100,8 @@ struct Parameters{
|
||||||
|
|
||||||
if (parser.userNeedsHelp())
|
if (parser.userNeedsHelp())
|
||||||
{
|
{
|
||||||
parser.printHelp(cout);
|
parser.printHelp(cout);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -36,4 +36,3 @@ SET_TARGET_PROPERTIES(mastermind PROPERTIES VERSION "${MASTERMIND_VERSION}")
|
||||||
TARGET_LINK_LIBRARIES(mastermind eo eoutils)
|
TARGET_LINK_LIBRARIES(mastermind eo eoutils)
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
catch (exception& e)
|
catch (exception& e)
|
||||||
{
|
{
|
||||||
cerr << argv[0] << ": " << e.what() << endl;
|
cerr << argv[0] << ": " << e.what() << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
170
eo/config.guess
vendored
170
eo/config.guess
vendored
|
|
@ -3,7 +3,7 @@
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||||
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2004-03-03'
|
timestamp='2011-05-05'
|
||||||
|
|
||||||
# This file is free software; you can redistribute it and/or modify it
|
# This file is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public License as published by
|
# under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -186,7 +186,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
os=netbsd
|
os=netbsd
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
# The OS release
|
# The OS release
|
||||||
|
|
@ -270,7 +270,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||||
;;
|
;;
|
||||||
*5.*)
|
*5.*)
|
||||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
# According to Compaq, /usr/sbin/psrinfo has been available on
|
# According to Compaq, /usr/sbin/psrinfo has been available on
|
||||||
|
|
@ -342,7 +342,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||||
echo i370-ibm-openedition
|
echo i370-ibm-openedition
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:OS400:*:*)
|
*:OS400:*:*)
|
||||||
echo powerpc-ibm-os400
|
echo powerpc-ibm-os400
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||||
|
|
@ -419,23 +419,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||||
# MiNT. But MiNT is downward compatible to TOS, so this should
|
# MiNT. But MiNT is downward compatible to TOS, so this should
|
||||||
# be no problem.
|
# be no problem.
|
||||||
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
|
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||||
echo m68k-atari-mint${UNAME_RELEASE}
|
echo m68k-atari-mint${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
|
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||||
echo m68k-atari-mint${UNAME_RELEASE}
|
echo m68k-atari-mint${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
|
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
|
||||||
echo m68k-atari-mint${UNAME_RELEASE}
|
echo m68k-atari-mint${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
|
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
|
||||||
echo m68k-milan-mint${UNAME_RELEASE}
|
echo m68k-milan-mint${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
|
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
|
||||||
echo m68k-hades-mint${UNAME_RELEASE}
|
echo m68k-hades-mint${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
||||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
m68k:machten:*:*)
|
m68k:machten:*:*)
|
||||||
echo m68k-apple-machten${UNAME_RELEASE}
|
echo m68k-apple-machten${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
@ -504,8 +504,8 @@ EOF
|
||||||
echo m88k-motorola-sysv3
|
echo m88k-motorola-sysv3
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
AViiON:dgux:*:*)
|
AViiON:dgux:*:*)
|
||||||
# DG/UX returns AViiON for all architectures
|
# DG/UX returns AViiON for all architectures
|
||||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||||
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
|
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
|
||||||
then
|
then
|
||||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
|
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
|
||||||
|
|
@ -614,52 +614,52 @@ EOF
|
||||||
9000/[678][0-9][0-9])
|
9000/[678][0-9][0-9])
|
||||||
if [ -x /usr/bin/getconf ]; then
|
if [ -x /usr/bin/getconf ]; then
|
||||||
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
||||||
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
||||||
case "${sc_cpu_version}" in
|
case "${sc_cpu_version}" in
|
||||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||||
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
||||||
532) # CPU_PA_RISC2_0
|
532) # CPU_PA_RISC2_0
|
||||||
case "${sc_kernel_bits}" in
|
case "${sc_kernel_bits}" in
|
||||||
32) HP_ARCH="hppa2.0n" ;;
|
32) HP_ARCH="hppa2.0n" ;;
|
||||||
64) HP_ARCH="hppa2.0w" ;;
|
64) HP_ARCH="hppa2.0w" ;;
|
||||||
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
||||||
esac ;;
|
esac ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
if [ "${HP_ARCH}" = "" ]; then
|
if [ "${HP_ARCH}" = "" ]; then
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
|
|
||||||
#define _HPUX_SOURCE
|
#define _HPUX_SOURCE
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
#if defined(_SC_KERNEL_BITS)
|
#if defined(_SC_KERNEL_BITS)
|
||||||
long bits = sysconf(_SC_KERNEL_BITS);
|
long bits = sysconf(_SC_KERNEL_BITS);
|
||||||
#endif
|
#endif
|
||||||
long cpu = sysconf (_SC_CPU_VERSION);
|
long cpu = sysconf (_SC_CPU_VERSION);
|
||||||
|
|
||||||
switch (cpu)
|
switch (cpu)
|
||||||
{
|
{
|
||||||
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
||||||
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
||||||
case CPU_PA_RISC2_0:
|
case CPU_PA_RISC2_0:
|
||||||
#if defined(_SC_KERNEL_BITS)
|
#if defined(_SC_KERNEL_BITS)
|
||||||
switch (bits)
|
switch (bits)
|
||||||
{
|
{
|
||||||
case 64: puts ("hppa2.0w"); break;
|
case 64: puts ("hppa2.0w"); break;
|
||||||
case 32: puts ("hppa2.0n"); break;
|
case 32: puts ("hppa2.0n"); break;
|
||||||
default: puts ("hppa2.0"); break;
|
default: puts ("hppa2.0"); break;
|
||||||
} break;
|
} break;
|
||||||
#else /* !defined(_SC_KERNEL_BITS) */
|
#else /* !defined(_SC_KERNEL_BITS) */
|
||||||
puts ("hppa2.0"); break;
|
puts ("hppa2.0"); break;
|
||||||
#endif
|
#endif
|
||||||
default: puts ("hppa1.0"); break;
|
default: puts ("hppa1.0"); break;
|
||||||
}
|
}
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
||||||
test -z "$HP_ARCH" && HP_ARCH=hppa
|
test -z "$HP_ARCH" && HP_ARCH=hppa
|
||||||
|
|
@ -739,22 +739,22 @@ EOF
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||||
echo c1-convex-bsd
|
echo c1-convex-bsd
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
||||||
if getsysinfo -f scalar_acc
|
if getsysinfo -f scalar_acc
|
||||||
then echo c32-convex-bsd
|
then echo c32-convex-bsd
|
||||||
else echo c2-convex-bsd
|
else echo c2-convex-bsd
|
||||||
fi
|
fi
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
||||||
echo c34-convex-bsd
|
echo c34-convex-bsd
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
||||||
echo c38-convex-bsd
|
echo c38-convex-bsd
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||||
echo c4-convex-bsd
|
echo c4-convex-bsd
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
CRAY*Y-MP:*:*:*)
|
CRAY*Y-MP:*:*:*)
|
||||||
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
@ -778,14 +778,14 @@ EOF
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
||||||
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
5000:UNIX_System_V:4.*:*)
|
5000:UNIX_System_V:4.*:*)
|
||||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
||||||
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||||
|
|
@ -919,7 +919,7 @@ EOF
|
||||||
EV6) UNAME_MACHINE=alphaev6 ;;
|
EV6) UNAME_MACHINE=alphaev6 ;;
|
||||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||||
esac
|
esac
|
||||||
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
|
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
|
||||||
if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi
|
if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi
|
||||||
echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC}
|
echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC}
|
||||||
|
|
@ -961,7 +961,7 @@ EOF
|
||||||
s/.*supported targets: *//
|
s/.*supported targets: *//
|
||||||
s/ .*//
|
s/ .*//
|
||||||
p'`
|
p'`
|
||||||
case "$ld_supported_targets" in
|
case "$ld_supported_targets" in
|
||||||
elf32-i386)
|
elf32-i386)
|
||||||
TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux"
|
TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux"
|
||||||
;;
|
;;
|
||||||
|
|
@ -1013,11 +1013,11 @@ EOF
|
||||||
echo i386-sequent-sysv4
|
echo i386-sequent-sysv4
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
i*86:UNIX_SV:4.2MP:2.*)
|
i*86:UNIX_SV:4.2MP:2.*)
|
||||||
# Unixware is an offshoot of SVR4, but it has its own version
|
# Unixware is an offshoot of SVR4, but it has its own version
|
||||||
# number series starting with 2...
|
# number series starting with 2...
|
||||||
# I am not positive that other SVR4 systems won't match this,
|
# I am not positive that other SVR4 systems won't match this,
|
||||||
# I just have to hope. -- rms.
|
# I just have to hope. -- rms.
|
||||||
# Use sysv4.2uw... so that sysv4* matches it.
|
# Use sysv4.2uw... so that sysv4* matches it.
|
||||||
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
i*86:OS/2:*:*)
|
i*86:OS/2:*:*)
|
||||||
|
|
@ -1076,10 +1076,10 @@ EOF
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
pc:*:*:*)
|
pc:*:*:*)
|
||||||
# Left here for compatibility:
|
# Left here for compatibility:
|
||||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||||
# the processor, so we play safe by assuming i386.
|
# the processor, so we play safe by assuming i386.
|
||||||
echo i386-pc-msdosdjgpp
|
echo i386-pc-msdosdjgpp
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
Intel:Mach:3*:*)
|
Intel:Mach:3*:*)
|
||||||
echo i386-pc-mach3
|
echo i386-pc-mach3
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
@ -1114,8 +1114,8 @@ EOF
|
||||||
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||||
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
|
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
|
||||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||||
&& echo i486-ncr-sysv4 && exit 0 ;;
|
&& echo i486-ncr-sysv4 && exit 0 ;;
|
||||||
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
|
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
|
||||||
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
@ -1149,9 +1149,9 @@ EOF
|
||||||
fi
|
fi
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||||
echo i586-unisys-sysv4
|
echo i586-unisys-sysv4
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:UNIX_System_V:4*:FTX*)
|
*:UNIX_System_V:4*:FTX*)
|
||||||
# From Gerald Hewes <hewes@openmarket.com>.
|
# From Gerald Hewes <hewes@openmarket.com>.
|
||||||
# How about differentiating between stratus architectures? -djm
|
# How about differentiating between stratus architectures? -djm
|
||||||
|
|
@ -1173,11 +1173,11 @@ EOF
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
|
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
|
||||||
if [ -d /usr/nec ]; then
|
if [ -d /usr/nec ]; then
|
||||||
echo mips-nec-sysv${UNAME_RELEASE}
|
echo mips-nec-sysv${UNAME_RELEASE}
|
||||||
else
|
else
|
||||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||||
fi
|
fi
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
|
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
|
||||||
echo powerpc-be-beos
|
echo powerpc-be-beos
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
@ -1262,7 +1262,7 @@ EOF
|
||||||
echo pdp10-unknown-its
|
echo pdp10-unknown-its
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
SEI:*:*:SEIUX)
|
SEI:*:*:SEIUX)
|
||||||
echo mips-sei-seiux${UNAME_RELEASE}
|
echo mips-sei-seiux${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:DragonFly:*:*)
|
*:DragonFly:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||||
|
|
@ -1289,11 +1289,11 @@ main ()
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
printf ("m68k-sony-newsos%s\n",
|
printf ("m68k-sony-newsos%s\n",
|
||||||
#ifdef NEWSOS4
|
#ifdef NEWSOS4
|
||||||
"4"
|
"4"
|
||||||
#else
|
#else
|
||||||
""
|
""
|
||||||
#endif
|
#endif
|
||||||
); exit (0);
|
); exit (0);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,5 +71,3 @@
|
||||||
|
|
||||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||||
#cmakedefine size_t
|
#cmakedefine size_t
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
Marc.Schoenauer@polytechnique.fr
|
Marc.Schoenauer@polytechnique.fr
|
||||||
mak@dhi.dk
|
mak@dhi.dk
|
||||||
*/
|
*/
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,14 +57,3 @@
|
||||||
#include <boost/config/suffix.hpp>
|
#include <boost/config/suffix.hpp>
|
||||||
|
|
||||||
#endif // BOOST_CONFIG_HPP
|
#endif // BOOST_CONFIG_HPP
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,5 +19,3 @@
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
# include BOOST_ABI_SUFFIX
|
# include BOOST_ABI_SUFFIX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,13 @@ USAGE:
|
||||||
Before including this header you must define one or more of define the following macros:
|
Before including this header you must define one or more of define the following macros:
|
||||||
|
|
||||||
BOOST_LIB_NAME: Required: A string containing the basename of the library,
|
BOOST_LIB_NAME: Required: A string containing the basename of the library,
|
||||||
for example boost_regex.
|
for example boost_regex.
|
||||||
BOOST_LIB_TOOLSET: Optional: the base name of the toolset.
|
BOOST_LIB_TOOLSET: Optional: the base name of the toolset.
|
||||||
BOOST_DYN_LINK: Optional: when set link to dll rather than static library.
|
BOOST_DYN_LINK: Optional: when set link to dll rather than static library.
|
||||||
BOOST_LIB_DIAGNOSTIC: Optional: when set the header will print out the name
|
BOOST_LIB_DIAGNOSTIC: Optional: when set the header will print out the name
|
||||||
of the library selected (useful for debugging).
|
of the library selected (useful for debugging).
|
||||||
BOOST_AUTO_LINK_NOMANGLE: Specifies that we should link to BOOST_LIB_NAME.lib,
|
BOOST_AUTO_LINK_NOMANGLE: Specifies that we should link to BOOST_LIB_NAME.lib,
|
||||||
rather than a mangled-name version.
|
rather than a mangled-name version.
|
||||||
|
|
||||||
These macros will be undef'ed at the end of the header, further this header
|
These macros will be undef'ed at the end of the header, further this header
|
||||||
has no include guards - so be sure to include it only once from your library!
|
has no include guards - so be sure to include it only once from your library!
|
||||||
|
|
@ -56,13 +56,13 @@ BOOST_LIB_TOOLSET: The compiler toolset name (vc6, vc7, bcb5 etc).
|
||||||
BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing.
|
BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing.
|
||||||
|
|
||||||
BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used,
|
BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used,
|
||||||
contains one or more of the following letters after
|
contains one or more of the following letters after
|
||||||
a hiphen:
|
a hiphen:
|
||||||
|
|
||||||
s static runtime (dynamic if not present).
|
s static runtime (dynamic if not present).
|
||||||
d debug build (release if not present).
|
d debug build (release if not present).
|
||||||
g debug/diagnostic runtime (release if not present).
|
g debug/diagnostic runtime (release if not present).
|
||||||
p STLPort Build.
|
p STLPort Build.
|
||||||
|
|
||||||
BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
|
BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
|
||||||
|
|
||||||
|
|
@ -342,13 +342,3 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
|
||||||
#if defined(BOOST_AUTO_LINK_NOMANGLE)
|
#if defined(BOOST_AUTO_LINK_NOMANGLE)
|
||||||
# undef BOOST_AUTO_LINK_NOMANGLE
|
# undef BOOST_AUTO_LINK_NOMANGLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// (C) Copyright John maddock 1999.
|
// (C) Copyright John maddock 1999.
|
||||||
// (C) David Abrahams 2002. Distributed under the Boost
|
// (C) David Abrahams 2002. Distributed under the Boost
|
||||||
// Software License, Version 1.0. (See accompanying file
|
// Software License, Version 1.0. (See accompanying file
|
||||||
|
|
|
||||||
|
|
@ -106,4 +106,3 @@ class eoAged: public Object
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif EOAGE_H
|
#endif EOAGE_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ using namespace std;
|
||||||
// eoDrawable
|
// eoDrawable
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
/** eoDrawable is a template class that adds a drawing interface to an object.\\
|
/** eoDrawable is a template class that adds a drawing interface to an object.
|
||||||
Requisites for template instantiation are that the object must admit a default ctor
|
Requisites for template instantiation are that the object must admit a default ctor
|
||||||
and a copy ctor. The Object must be an eoObject, thus, it must have its methods: className,
|
and a copy ctor. The Object must be an eoObject, thus, it must have its methods: className,
|
||||||
eoDrawables can be drawn on any two-dimensional surface; it can be added to any
|
eoDrawables can be drawn on any two-dimensional surface; it can be added to any
|
||||||
|
|
@ -61,4 +61,4 @@ class eoDrawable
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif EODRAWABLE_H
|
#endif //! EODRAWABLE_H
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ PREFIX = "/usr"
|
||||||
DATA = {
|
DATA = {
|
||||||
'dirs': [ "%s/share/%s" % (PREFIX, NAME) ],
|
'dirs': [ "%s/share/%s" % (PREFIX, NAME) ],
|
||||||
'links': [ ("%s/src" % SOURCE, "%s/include/%s" % (PREFIX, NAME)),
|
'links': [ ("%s/src" % SOURCE, "%s/include/%s" % (PREFIX, NAME)),
|
||||||
("%s/doc" % BINARY, "%s/share/%s/doc" % (PREFIX, NAME)),
|
("%s/doc" % BINARY, "%s/share/%s/doc" % (PREFIX, NAME)),
|
||||||
("%s/%s.pc" % (BINARY, NAME), "%s/lib/pkgconfig/%s.pc" % (PREFIX, NAME)),
|
("%s/%s.pc" % (BINARY, NAME), "%s/lib/pkgconfig/%s.pc" % (PREFIX, NAME)),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBRARIES = ["libcma.a", "libeo.a", "libeoutils.a", "libes.a", "libga.a"]
|
LIBRARIES = ["libcma.a", "libeo.a", "libeoutils.a", "libes.a", "libga.a"]
|
||||||
|
|
@ -21,8 +21,8 @@ import os, sys
|
||||||
|
|
||||||
def isroot():
|
def isroot():
|
||||||
if os.getuid() != 0:
|
if os.getuid() != 0:
|
||||||
print '[WARNING] you have to be root'
|
print '[WARNING] you have to be root'
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def uninstall():
|
def uninstall():
|
||||||
|
|
@ -41,11 +41,11 @@ def data():
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if not isroot():
|
if not isroot():
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print 'Usage: %s [install|uninstall|data]' % sys.argv[0]
|
print 'Usage: %s [install|uninstall|data]' % sys.argv[0]
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if sys.argv[1] == 'install': install()
|
if sys.argv[1] == 'install': install()
|
||||||
elif sys.argv[1] == 'uninstall': uninstall()
|
elif sys.argv[1] == 'uninstall': uninstall()
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
Marc.Schoenauer@polytechnique.fr
|
Marc.Schoenauer@polytechnique.fr
|
||||||
CVS Info: $Date: 2001-06-21 12:03:17 $ $Header: /home/nojhan/dev/eodev/eodev_cvs/eo/test/RoyalRoad.h,v 1.3 2001-06-21 12:03:17 jmerelo Exp $ $Author: jmerelo $
|
CVS Info: $Date: 2001-06-21 12:03:17 $ $Header: /home/nojhan/dev/eodev/eodev_cvs/eo/test/RoyalRoad.h,v 1.3 2001-06-21 12:03:17 jmerelo Exp $ $Author: jmerelo $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ import sys
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print 'Usage: boxplot.py [Results files, ...]'
|
print 'Usage: boxplot.py [Results files, ...]'
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
for i in range(1, len(sys.argv)):
|
for i in range(1, len(sys.argv)):
|
||||||
pylab.boxplot( [ [ float(value) for value in line.split() ] for line in open( sys.argv[i] ).readlines() ] )
|
pylab.boxplot( [ [ float(value) for value in line.split() ] for line in open( sys.argv[i] ).readlines() ] )
|
||||||
|
|
||||||
pylab.xlabel('iterations')
|
pylab.xlabel('iterations')
|
||||||
pylab.show()
|
pylab.show()
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ public :
|
||||||
{
|
{
|
||||||
if (!fitness_traits::needs_mapping)
|
if (!fitness_traits::needs_mapping)
|
||||||
{
|
{
|
||||||
throw runtime_error("eoPop: no scaling needed, yet a scaling function is defined");
|
throw runtime_error("eoPop: no scaling needed, yet a scaling function is defined");
|
||||||
}
|
}
|
||||||
|
|
||||||
(*p2w)(*this);
|
(*p2w)(*this);
|
||||||
|
|
@ -429,5 +429,3 @@ int main()
|
||||||
std::cout << e.what() << std::endl;
|
std::cout << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,3 @@ double real_value(const std::vector<double>& _ind)
|
||||||
sum += _ind[i] * _ind[i];
|
sum += _ind[i] * _ind[i];
|
||||||
return sum/_ind.size();
|
return sum/_ind.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,7 @@ int main()
|
||||||
|
|
||||||
// EO objects can be printed with stream operators
|
// EO objects can be printed with stream operators
|
||||||
std::cout << "chrom1 = " << chrom1 << std::endl
|
std::cout << "chrom1 = " << chrom1 << std::endl
|
||||||
<< "chrom2 = " << chrom2 << std::endl;
|
<< "chrom2 = " << chrom2 << std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <eoScalarFitness.h>
|
#include <eoScalarFitness.h>
|
||||||
|
|
@ -123,6 +122,3 @@ int main(int argc, char* argv[]) {
|
||||||
cout << "Fitness achieved = " << pop[0].fitness() << endl;
|
cout << "Fitness achieved = " << pop[0].fitness() << endl;
|
||||||
cout << "Function evaluations = " << evals.value() << endl;
|
cout << "Function evaluations = " << evals.value() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// to avoid long name warnings
|
// to avoid long name warnings
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(disable:4786)
|
#pragma warning(disable:4786)
|
||||||
|
|
@ -113,38 +112,38 @@ int the_main(int argc, char **argv)
|
||||||
|
|
||||||
if (parser.userNeedsHelp())
|
if (parser.userNeedsHelp())
|
||||||
{
|
{
|
||||||
parser.printHelp(std::cout);
|
parser.printHelp(std::cout);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Either load or initialize
|
// Either load or initialize
|
||||||
if (load_name.value() != "")
|
if (load_name.value() != "")
|
||||||
{
|
{
|
||||||
state.load(load_name.value()); // load the rest
|
state.load(load_name.value()); // load the rest
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// else
|
// else
|
||||||
|
|
||||||
// initialize rng and population
|
// initialize rng and population
|
||||||
|
|
||||||
rng.reseed(seed.value());
|
rng.reseed(seed.value());
|
||||||
|
|
||||||
pop.resize(2);
|
pop.resize(2);
|
||||||
|
|
||||||
pop[0].fitness(1);
|
pop[0].fitness(1);
|
||||||
pop[1].fitness(2);
|
pop[1].fitness(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
while(checkpoint(pop))
|
while(checkpoint(pop))
|
||||||
{
|
{
|
||||||
pop[0].fitness(pop[0].fitness() + 1);
|
pop[0].fitness(pop[0].fitness() + 1);
|
||||||
|
|
||||||
time_t now = time(0);
|
time_t now = time(0);
|
||||||
|
|
||||||
while (time(0) == now) {} // wait a second to test timed saver
|
while (time(0) == now) {} // wait a second to test timed saver
|
||||||
|
|
||||||
std::cout << "gen " << generationCounter.value() << std::endl;
|
std::cout << "gen " << generationCounter.value() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// run the algorithm
|
// run the algorithm
|
||||||
|
|
@ -152,9 +151,9 @@ int the_main(int argc, char **argv)
|
||||||
// Save when needed
|
// Save when needed
|
||||||
if (save_name.value() != "")
|
if (save_name.value() != "")
|
||||||
{
|
{
|
||||||
std::string file_name = save_name.value();
|
std::string file_name = save_name.value();
|
||||||
save_name.value() = ""; // so that it does not appear in the parser section of the state file
|
save_name.value() = ""; // so that it does not appear in the parser section of the state file
|
||||||
state.save(file_name);
|
state.save(file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -164,11 +163,11 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
the_main(argc, argv);
|
the_main(argc, argv);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "Exception: " << e.what() << std::endl;
|
std::cout << "Exception: " << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <eo>
|
#include <eo>
|
||||||
|
|
@ -13,16 +12,16 @@ class DualSphere : public eoEvalFunc<EOT>
|
||||||
public:
|
public:
|
||||||
virtual void operator()( EOT & x )
|
virtual void operator()( EOT & x )
|
||||||
{
|
{
|
||||||
if( x.invalid() ) { return; }
|
if( x.invalid() ) { return; }
|
||||||
|
|
||||||
double sum = 0;
|
double sum = 0;
|
||||||
int sign = 1;
|
int sign = 1;
|
||||||
for( unsigned int i=0, s=x.size(); i<s; ++i ) {
|
for( unsigned int i=0, s=x.size(); i<s; ++i ) {
|
||||||
sum += x[i] * x[i];
|
sum += x[i] * x[i];
|
||||||
sign *= x[i]<0 ? -1 : 1;
|
sign *= x[i]<0 ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
x.fitness( std::make_pair( sum, sign>0 ? true : false ) );
|
x.fitness( std::make_pair( sum, sign>0 ? true : false ) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -60,7 +59,7 @@ int main()
|
||||||
pop.push_back( sol4 );
|
pop.push_back( sol4 );
|
||||||
// on the sphere function everyone has the same fitness of 1
|
// on the sphere function everyone has the same fitness of 1
|
||||||
if( test(pop, 0) != 0 ) {
|
if( test(pop, 0) != 0 ) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pop.erase(pop.begin(),pop.end());
|
pop.erase(pop.begin(),pop.end());
|
||||||
|
|
@ -75,7 +74,7 @@ int main()
|
||||||
pop.push_back( sol3 );
|
pop.push_back( sol3 );
|
||||||
pop.push_back( sol4 );
|
pop.push_back( sol4 );
|
||||||
if( test(pop, 1) != 1 ) {
|
if( test(pop, 1) != 1 ) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// test on a random normal distribution
|
// test on a random normal distribution
|
||||||
|
|
@ -84,7 +83,6 @@ int main()
|
||||||
pop = eoPop<DualVector>( 1000000, init_N );
|
pop = eoPop<DualVector>( 1000000, init_N );
|
||||||
double iqr = test(pop, 1.09);
|
double iqr = test(pop, 1.09);
|
||||||
if( iqr < 1.08 || iqr > 1.11 ) {
|
if( iqr < 1.08 || iqr > 1.11 ) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,34 +37,34 @@ int main_function(int argc, char *argv[])
|
||||||
eoParser parser(argc, argv); // for user-parameter reading
|
eoParser parser(argc, argv); // for user-parameter reading
|
||||||
eoState state; // keeps all things allocated
|
eoState state; // keeps all things allocated
|
||||||
eoValueParam<bool>& simpleParam = parser.getORcreateParam(true, "Isotropic",
|
eoValueParam<bool>& simpleParam = parser.getORcreateParam(true, "Isotropic",
|
||||||
"Isotropic self-adaptive mutation",
|
"Isotropic self-adaptive mutation",
|
||||||
'i', "ES mutation");
|
'i', "ES mutation");
|
||||||
eoValueParam<bool>& stdevsParam = parser.getORcreateParam(false, "Stdev",
|
eoValueParam<bool>& stdevsParam = parser.getORcreateParam(false, "Stdev",
|
||||||
"One self-adaptive stDev per variable",
|
"One self-adaptive stDev per variable",
|
||||||
's', "ES mutation");
|
's', "ES mutation");
|
||||||
eoValueParam<bool>& corrParam = parser.getORcreateParam(false, "Correl",
|
eoValueParam<bool>& corrParam = parser.getORcreateParam(false, "Correl",
|
||||||
"Use correlated mutations",
|
"Use correlated mutations",
|
||||||
'c', "ES mutation");
|
'c', "ES mutation");
|
||||||
// Run the appropriate algorithm
|
// Run the appropriate algorithm
|
||||||
if (simpleParam.value() == false)
|
if (simpleParam.value() == false)
|
||||||
{
|
{
|
||||||
std::cout << "Using eoReal" << std::endl;
|
std::cout << "Using eoReal" << std::endl;
|
||||||
runAlgorithm(eoReal<FitT>(), parser, state);
|
runAlgorithm(eoReal<FitT>(), parser, state);
|
||||||
}
|
}
|
||||||
else if (stdevsParam.value() == false)
|
else if (stdevsParam.value() == false)
|
||||||
{
|
{
|
||||||
std::cout << "Using eoEsSimple" << std::endl;
|
std::cout << "Using eoEsSimple" << std::endl;
|
||||||
runAlgorithm(eoEsSimple<FitT>(), parser, state);
|
runAlgorithm(eoEsSimple<FitT>(), parser, state);
|
||||||
}
|
}
|
||||||
else if (corrParam.value() == false)
|
else if (corrParam.value() == false)
|
||||||
{
|
{
|
||||||
std::cout << "Using eoEsStdev" << std::endl;
|
std::cout << "Using eoEsStdev" << std::endl;
|
||||||
runAlgorithm(eoEsStdev<FitT>(), parser, state);
|
runAlgorithm(eoEsStdev<FitT>(), parser, state);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Using eoEsFull" << std::endl;
|
std::cout << "Using eoEsFull" << std::endl;
|
||||||
runAlgorithm(eoEsFull<FitT>(), parser, state);
|
runAlgorithm(eoEsFull<FitT>(), parser, state);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -83,11 +83,11 @@ int main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function(argc, argv);
|
main_function(argc, argv);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "Exception: " << e.what() << '\n';
|
std::cout << "Exception: " << e.what() << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ int main_function(int argc, char *argv[])
|
||||||
|
|
||||||
// Define Parameters and load them
|
// Define Parameters and load them
|
||||||
eoValueParam<uint32_t>& seed = parser.createParam(static_cast<uint32_t>(time(0)),
|
eoValueParam<uint32_t>& seed = parser.createParam(static_cast<uint32_t>(time(0)),
|
||||||
"seed", "Random number seed");
|
"seed", "Random number seed");
|
||||||
eoValueParam<string>& load_name = parser.createParam(string(), "Load","Load a state file",'L');
|
eoValueParam<string>& load_name = parser.createParam(string(), "Load","Load a state file",'L');
|
||||||
eoValueParam<string>& save_name = parser.createParam(string(), "Save","Saves a state file",'S');
|
eoValueParam<string>& save_name = parser.createParam(string(), "Save","Saves a state file",'S');
|
||||||
eoValueParam<bool>& stdevs = parser.createParam(false, "Stdev", "Use adaptive mutation rates", 's');
|
eoValueParam<bool>& stdevs = parser.createParam(false, "Stdev", "Use adaptive mutation rates", 's');
|
||||||
|
|
@ -62,23 +62,23 @@ int main_function(int argc, char *argv[])
|
||||||
// Run the appropriate algorithm
|
// Run the appropriate algorithm
|
||||||
if (stdevs.value() == false && corr.value() == false)
|
if (stdevs.value() == false && corr.value() == false)
|
||||||
{
|
{
|
||||||
runAlgorithm(eoEsSimple<FitT>() ,parser, state, bounds, load_name);
|
runAlgorithm(eoEsSimple<FitT>() ,parser, state, bounds, load_name);
|
||||||
}
|
}
|
||||||
else if (corr.value() == true)
|
else if (corr.value() == true)
|
||||||
{
|
{
|
||||||
runAlgorithm(eoEsFull<FitT>(),parser, state, bounds, load_name);
|
runAlgorithm(eoEsFull<FitT>(),parser, state, bounds, load_name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
runAlgorithm(eoEsStdev<FitT>(), parser, state, bounds, load_name);
|
runAlgorithm(eoEsStdev<FitT>(), parser, state, bounds, load_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// and save
|
// and save
|
||||||
if (!save_name.value().empty())
|
if (!save_name.value().empty())
|
||||||
{
|
{
|
||||||
string file_name = save_name.value();
|
string file_name = save_name.value();
|
||||||
save_name.value() = ""; // so that it does not appear in the parser section of the state file
|
save_name.value() = ""; // so that it does not appear in the parser section of the state file
|
||||||
state.save(file_name);
|
state.save(file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -98,11 +98,11 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function(argc, argv);
|
main_function(argc, argv);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "Exception: " << e.what() << '\n';
|
std::cout << "Exception: " << e.what() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -120,7 +120,7 @@ void runAlgorithm(EOT, eoParser& _parser, eoState& _state, eoRealVectorBounds& _
|
||||||
|
|
||||||
if (lambda_rate.value() < 1.0f)
|
if (lambda_rate.value() < 1.0f)
|
||||||
{
|
{
|
||||||
throw logic_error("lambda_rate must be larger than 1 in a comma strategy");
|
throw logic_error("lambda_rate must be larger than 1 in a comma strategy");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
|
|
@ -137,8 +137,8 @@ void runAlgorithm(EOT, eoParser& _parser, eoState& _state, eoRealVectorBounds& _
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// evaluate initial population
|
// evaluate initial population
|
||||||
apply<EOT>(eval, pop);
|
apply<EOT>(eval, pop);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ok, time to set up the algorithm
|
// Ok, time to set up the algorithm
|
||||||
|
|
|
||||||
|
|
@ -72,4 +72,3 @@ main()
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ double real_value (const Particle & _particle)
|
||||||
{
|
{
|
||||||
double sum = 0;
|
double sum = 0;
|
||||||
for (unsigned i = 0; i < _particle.size ()-1; i++)
|
for (unsigned i = 0; i < _particle.size ()-1; i++)
|
||||||
sum += pow(_particle[i],2);
|
sum += pow(_particle[i],2);
|
||||||
return (sum);
|
return (sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,24 +80,23 @@ int main()
|
||||||
// flight
|
// flight
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pso1(pop);
|
pso1(pop);
|
||||||
std::cout << "FINAL POPULATION AFTER PSO n°1:" << std::endl;
|
std::cout << "FINAL POPULATION AFTER PSO n°1:" << std::endl;
|
||||||
for (i = 0; i < pop.size(); ++i)
|
for (i = 0; i < pop.size(); ++i)
|
||||||
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
|
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
|
||||||
|
|
||||||
pso2(pop);
|
pso2(pop);
|
||||||
std::cout << "FINAL POPULATION AFTER PSO n°2:" << std::endl;
|
std::cout << "FINAL POPULATION AFTER PSO n°2:" << std::endl;
|
||||||
for (i = 0; i < pop.size(); ++i)
|
for (i = 0; i < pop.size(); ++i)
|
||||||
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
|
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "exception: " << e.what() << std::endl;;
|
std::cout << "exception: " << e.what() << std::endl;;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,11 +66,11 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function(argc, argv);
|
main_function(argc, argv);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "Exception: " << e.what() << " in t-eoExtendedVelocity" << std::endl;
|
std::cout << "Exception: " << e.what() << " in t-eoExtendedVelocity" << std::endl;
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,9 +61,9 @@ bool UserDefMutate(UserDefStruct& a)
|
||||||
a = RandomStruct(); // just for testing
|
a = RandomStruct(); // just for testing
|
||||||
|
|
||||||
if (rng.flip(0.1f))
|
if (rng.flip(0.1f))
|
||||||
a.d = UserDefStruct::test;
|
a.d = UserDefStruct::test;
|
||||||
else
|
else
|
||||||
a.d = UserDefStruct::another;
|
a.d = UserDefStruct::another;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,13 +72,13 @@ bool UserDefBinCrossover(UserDefStruct& a, const UserDefStruct& b)
|
||||||
std::cout << "UserDefBinCrossover\n";
|
std::cout << "UserDefBinCrossover\n";
|
||||||
|
|
||||||
if (rng.flip(0.5))
|
if (rng.flip(0.5))
|
||||||
a.a = b.a;
|
a.a = b.a;
|
||||||
if (rng.flip(0.5))
|
if (rng.flip(0.5))
|
||||||
a.b = b.b;
|
a.b = b.b;
|
||||||
if (rng.flip(0.5))
|
if (rng.flip(0.5))
|
||||||
a.c = b.c;
|
a.c = b.c;
|
||||||
if (rng.flip(0.5))
|
if (rng.flip(0.5))
|
||||||
a.d = b.d;
|
a.d = b.d;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -86,13 +86,13 @@ bool UserDefQuadCrossover(UserDefStruct& a, UserDefStruct& b)
|
||||||
{
|
{
|
||||||
std::cout << "UserDefQuadCrossover\n";
|
std::cout << "UserDefQuadCrossover\n";
|
||||||
if (rng.flip(0.5))
|
if (rng.flip(0.5))
|
||||||
swap(a.a, b.a);
|
swap(a.a, b.a);
|
||||||
if (rng.flip(0.5))
|
if (rng.flip(0.5))
|
||||||
swap(a.b, b.b);
|
swap(a.b, b.b);
|
||||||
if (rng.flip(0.5))
|
if (rng.flip(0.5))
|
||||||
swap(a.c, b.c);
|
swap(a.c, b.c);
|
||||||
if (rng.flip(0.5))
|
if (rng.flip(0.5))
|
||||||
swap(a.d, b.d);
|
swap(a.d, b.d);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
Marc.Schoenauer@inria.fr
|
Marc.Schoenauer@inria.fr
|
||||||
mak@dhi.dk
|
mak@dhi.dk
|
||||||
*/
|
*/
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
@ -102,4 +102,3 @@ int main(){
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
Marc.Schoenauer@inria.fr
|
Marc.Schoenauer@inria.fr
|
||||||
mak@dhi.dk
|
mak@dhi.dk
|
||||||
*/
|
*/
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
#include <es/eoReal.h> // Definition of representation
|
#include <es/eoReal.h> // Definition of representation
|
||||||
#include <es/eoRealInitBounded.h> // Uniformly initializes real vector in bounds
|
#include <es/eoRealInitBounded.h> // Uniformly initializes real vector in bounds
|
||||||
#include <es/make_genotype_real.h> // Initialization of a genotype
|
#include <es/make_genotype_real.h> // Initialization of a genotype
|
||||||
#include <eoEvalFunc.h> // Base class for fitness evaluation
|
#include <eoEvalFunc.h> // Base class for fitness evaluation
|
||||||
#include <es/make_op_real.h> // Variation operators using standard Real operators
|
#include <es/make_op_real.h> // Variation operators using standard Real operators
|
||||||
#include <eoScalarFitnessAssembled.h> // The fitness class
|
#include <eoScalarFitnessAssembled.h> // The fitness class
|
||||||
typedef eoReal<eoAssembledMinimizingFitness> Indi;
|
typedef eoReal<eoAssembledMinimizingFitness> Indi;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#include <eoInit.h>
|
#include <eoInit.h>
|
||||||
#include <eoCounter.h>
|
#include <eoCounter.h>
|
||||||
|
|
||||||
|
|
@ -13,7 +12,7 @@ class Tester : public eoInit<int>
|
||||||
public :
|
public :
|
||||||
void operator()(int& i)
|
void operator()(int& i)
|
||||||
{
|
{
|
||||||
i=1;
|
i=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
Contact: mkeijzer@dhi.dk
|
Contact: mkeijzer@dhi.dk
|
||||||
Marc.Schoenauer@polytechnique.fr
|
Marc.Schoenauer@polytechnique.fr
|
||||||
*/
|
*/
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -38,10 +38,10 @@ struct Dummy : public EO<double>
|
||||||
Dummy(std::string _s="") : s(_s) {}
|
Dummy(std::string _s="") : s(_s) {}
|
||||||
|
|
||||||
void printOn(std::ostream & _os) const
|
void printOn(std::ostream & _os) const
|
||||||
{
|
{
|
||||||
EO<double>::printOn(_os);
|
EO<double>::printOn(_os);
|
||||||
_os << " - " << s ;
|
_os << " - " << s ;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string s;
|
std::string s;
|
||||||
};
|
};
|
||||||
|
|
@ -179,9 +179,9 @@ void init(eoPop<Dummy> & _pop, unsigned _pSize)
|
||||||
for (unsigned i=0; i<_pSize; i++)
|
for (unsigned i=0; i<_pSize; i++)
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << i;
|
os << i;
|
||||||
_pop[i] = Dummy(os.str());
|
_pop[i] = Dummy(os.str());
|
||||||
_pop[i].fitness(i);
|
_pop[i].fitness(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -190,7 +190,7 @@ int the_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
eoParser parser(argc, argv);
|
eoParser parser(argc, argv);
|
||||||
eoValueParam<unsigned int> parentSizeParam(
|
eoValueParam<unsigned int> parentSizeParam(
|
||||||
parser.createParam(unsigned(10), "parentSize", "Parent size",'P'));
|
parser.createParam(unsigned(10), "parentSize", "Parent size",'P'));
|
||||||
pSize = parentSizeParam.value(); // global variable
|
pSize = parentSizeParam.value(); // global variable
|
||||||
|
|
||||||
eoValueParam<uint32_t> seedParam(time(0), "seed", "Random number seed", 'S');
|
eoValueParam<uint32_t> seedParam(time(0), "seed", "Random number seed", 'S');
|
||||||
|
|
@ -201,8 +201,8 @@ int the_main(int argc, char **argv)
|
||||||
// i.e. in case you need parameters somewhere else, postpone these
|
// i.e. in case you need parameters somewhere else, postpone these
|
||||||
if (parser.userNeedsHelp())
|
if (parser.userNeedsHelp())
|
||||||
{
|
{
|
||||||
parser.printHelp(std::cout);
|
parser.printHelp(std::cout);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////// define operators
|
////////////////////////////////// define operators
|
||||||
|
|
@ -379,11 +379,11 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
the_main(argc, argv);
|
the_main(argc, argv);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "Exception: " << e.what() << std::endl;
|
std::cout << "Exception: " << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#include <eo>
|
#include <eo>
|
||||||
#include <es.h>
|
#include <es.h>
|
||||||
#include <utils/eoStat.h>
|
#include <utils/eoStat.h>
|
||||||
|
|
@ -39,7 +38,7 @@ int main()
|
||||||
pop.push_back( sol4 );
|
pop.push_back( sol4 );
|
||||||
// on the sphere function everyone has the same fitness of 1
|
// on the sphere function everyone has the same fitness of 1
|
||||||
if( test(pop, 0) != 0 ) {
|
if( test(pop, 0) != 0 ) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pop.erase(pop.begin(),pop.end());
|
pop.erase(pop.begin(),pop.end());
|
||||||
|
|
@ -54,7 +53,7 @@ int main()
|
||||||
pop.push_back( sol3 );
|
pop.push_back( sol3 );
|
||||||
pop.push_back( sol4 );
|
pop.push_back( sol4 );
|
||||||
if( test(pop, 1) != 1 ) {
|
if( test(pop, 1) != 1 ) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// test on a random normal distribution
|
// test on a random normal distribution
|
||||||
|
|
@ -63,7 +62,6 @@ int main()
|
||||||
pop = eoPop<realVec>( 1000000, init_N );
|
pop = eoPop<realVec>( 1000000, init_N );
|
||||||
double iqr = test(pop, 1.09);
|
double iqr = test(pop, 1.09);
|
||||||
if( iqr < 1.08 || iqr > 1.11 ) {
|
if( iqr < 1.08 || iqr > 1.11 ) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,14 +98,14 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
// now create the snapshot monitor
|
// now create the snapshot monitor
|
||||||
eoValueParam<bool>& plotDistribParam = parser.getORcreateParam(false, "plotDistrib",
|
eoValueParam<bool>& plotDistribParam = parser.getORcreateParam(false, "plotDistrib",
|
||||||
"Plot Distribution", '\0',
|
"Plot Distribution", '\0',
|
||||||
"Output - Graphical");
|
"Output - Graphical");
|
||||||
if (plotDistribParam.value())
|
if (plotDistribParam.value())
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GNUPLOT
|
#ifdef HAVE_GNUPLOT
|
||||||
unsigned frequency=1; // frequency of plots updates
|
unsigned frequency=1; // frequency of plots updates
|
||||||
eoGnuplot1DSnapshot *distribSnapshot = new eoGnuplot1DSnapshot(ptDirNameParam->value(),
|
eoGnuplot1DSnapshot *distribSnapshot = new eoGnuplot1DSnapshot(ptDirNameParam->value(),
|
||||||
frequency, "distrib");
|
frequency, "distrib");
|
||||||
state.storeFunctor(distribSnapshot);
|
state.storeFunctor(distribSnapshot);
|
||||||
// add the distribution (it is an eoValueParam<vector<double> >)
|
// add the distribution (it is an eoValueParam<vector<double> >)
|
||||||
distribSnapshot->add(distrib);
|
distribSnapshot->add(distrib);
|
||||||
|
|
@ -117,7 +117,7 @@ int main(int argc, char* argv[])
|
||||||
// the algorithm: EDA
|
// the algorithm: EDA
|
||||||
// don't know where else to put the population size!
|
// don't know where else to put the population size!
|
||||||
unsigned popSize = parser.getORcreateParam(unsigned(100), "popSize",
|
unsigned popSize = parser.getORcreateParam(unsigned(100), "popSize",
|
||||||
"Population Size", 'P', "Algorithm").value();
|
"Population Size", 'P', "Algorithm").value();
|
||||||
eoSimpleEDA<Indi> eda(update, eval, popSize, checkpoint);
|
eoSimpleEDA<Indi> eda(update, eval, popSize, checkpoint);
|
||||||
|
|
||||||
///// End of construction of the algorith
|
///// End of construction of the algorith
|
||||||
|
|
|
||||||
|
|
@ -24,21 +24,21 @@ int main()
|
||||||
double sigma(5.);
|
double sigma(5.);
|
||||||
double sum(0.);
|
double sum(0.);
|
||||||
for(size_t i=0; i<num; ++i)
|
for(size_t i=0; i<num; ++i)
|
||||||
sum += abs(rng.normal(sigma));
|
sum += abs(rng.normal(sigma));
|
||||||
sum /= double(num);
|
sum /= double(num);
|
||||||
if(sum > sigma / 0.68) {
|
if(sum > sigma / 0.68) {
|
||||||
cerr << "Normal distribution seems out of bounds; "
|
cerr << "Normal distribution seems out of bounds; "
|
||||||
<< "rerun to make sure it wasn't a statistical outlier" << endl;
|
<< "rerun to make sure it wasn't a statistical outlier" << endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
sum = 0.;
|
sum = 0.;
|
||||||
for(size_t i=0; i<num; ++i)
|
for(size_t i=0; i<num; ++i)
|
||||||
sum += abs(rng.normal(mean, sigma) - mean);
|
sum += abs(rng.normal(mean, sigma) - mean);
|
||||||
sum /= double(num);
|
sum /= double(num);
|
||||||
if(sum > sigma / 0.68) {
|
if(sum > sigma / 0.68) {
|
||||||
cerr << "Normal distribution seems out of bounds; "
|
cerr << "Normal distribution seems out of bounds; "
|
||||||
<< "rerun to make sure it wasn't a statistical outlier" << endl;
|
<< "rerun to make sure it wasn't a statistical outlier" << endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
// The evaluation fn - encapsulated into an eval counter for output
|
// The evaluation fn - encapsulated into an eval counter for output
|
||||||
eoEvalFuncPtr<EOT, double, const std::vector<double>&>
|
eoEvalFuncPtr<EOT, double, const std::vector<double>&>
|
||||||
mainEval( real_value );
|
mainEval( real_value );
|
||||||
eoEvalFuncCounter<EOT> eval(mainEval);
|
eoEvalFuncCounter<EOT> eval(mainEval);
|
||||||
|
|
||||||
// the genotype - through a genotype initializer
|
// the genotype - through a genotype initializer
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,8 @@ int the_main(int argc, char **argv)
|
||||||
|
|
||||||
if (parser.userNeedsHelp())
|
if (parser.userNeedsHelp())
|
||||||
{
|
{
|
||||||
parser.printHelp(std::cout);
|
parser.printHelp(std::cout);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
@ -213,11 +213,11 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
the_main(argc, argv);
|
the_main(argc, argv);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "Exception: " << e.what() << std::endl;
|
std::cout << "Exception: " << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,11 +57,11 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function(argc, argv);
|
main_function(argc, argv);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "Exception: " << e.what() << " in t-eoRingTopology" << std::endl;
|
std::cout << "Exception: " << e.what() << " in t-eoRingTopology" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#include <eoPop.h>
|
#include <eoPop.h>
|
||||||
#include <EO.h>
|
#include <EO.h>
|
||||||
#include <eoProportionalSelect.h>
|
#include <eoProportionalSelect.h>
|
||||||
|
|
@ -65,4 +64,3 @@ int main()
|
||||||
|
|
||||||
return test_select<eoStochasticUniversalSelect<TestEO> >();
|
return test_select<eoStochasticUniversalSelect<TestEO> >();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -29,5 +28,3 @@ int main() {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,8 +121,8 @@ eoValueParam<unsigned> tournamentSizeParam = parser.createParam(unsigned(2), "to
|
||||||
|
|
||||||
if (parser.userNeedsHelp())
|
if (parser.userNeedsHelp())
|
||||||
{
|
{
|
||||||
parser.printHelp(std::cout);
|
parser.printHelp(std::cout);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// hard-coded directory name ...
|
// hard-coded directory name ...
|
||||||
|
|
@ -155,7 +155,7 @@ eoValueParam<unsigned> tournamentSizeParam = parser.createParam(unsigned(2), "to
|
||||||
|
|
||||||
// random seed
|
// random seed
|
||||||
eoValueParam<uint32_t>& seedParam = parser.createParam(uint32_t(0), "seed",
|
eoValueParam<uint32_t>& seedParam = parser.createParam(uint32_t(0), "seed",
|
||||||
"Random number seed", 'S');
|
"Random number seed", 'S');
|
||||||
if (seedParam.value() == 0)
|
if (seedParam.value() == 0)
|
||||||
seedParam.value() = time(0);
|
seedParam.value() = time(0);
|
||||||
rng.reseed(seedParam.value());
|
rng.reseed(seedParam.value());
|
||||||
|
|
@ -212,11 +212,11 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
the_main(argc, argv);
|
the_main(argc, argv);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "Exception: " << e.what() << std::endl;
|
std::cout << "Exception: " << e.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -230,11 +230,11 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
the_main(argc, argv);
|
the_main(argc, argv);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "Exception: " << e.what() << std::endl;
|
std::cout << "Exception: " << e.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,22 +89,22 @@ int the_main(int argc, char **argv)
|
||||||
|
|
||||||
if (parser.userNeedsHelp())
|
if (parser.userNeedsHelp())
|
||||||
{
|
{
|
||||||
parser.printHelp(std::cout);
|
parser.printHelp(std::cout);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Either load or initialize
|
// Either load or initialize
|
||||||
if (load_name.value() != "")
|
if (load_name.value() != "")
|
||||||
{
|
{
|
||||||
state.load(load_name.value()); // load the rest
|
state.load(load_name.value()); // load the rest
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// else
|
// else
|
||||||
|
|
||||||
// initialize rng and population
|
// initialize rng and population
|
||||||
|
|
||||||
rng.reseed(seed.value());
|
rng.reseed(seed.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
// run the algorithm
|
// run the algorithm
|
||||||
|
|
@ -112,13 +112,13 @@ int the_main(int argc, char **argv)
|
||||||
// Save when needed
|
// Save when needed
|
||||||
if (save_name.value() != "")
|
if (save_name.value() != "")
|
||||||
{
|
{
|
||||||
std::string file_name = save_name.value();
|
std::string file_name = save_name.value();
|
||||||
save_name.value() = ""; // so that it does not appear in the parser section of the state file
|
save_name.value() = ""; // so that it does not appear in the parser section of the state file
|
||||||
state.save(file_name);
|
state.save(file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 100; ++i)
|
for (int i = 0; i < 100; ++i)
|
||||||
rng.rand();
|
rng.rand();
|
||||||
|
|
||||||
std::cout << "a random number is " << rng.random(1024) << std::endl;;
|
std::cout << "a random number is " << rng.random(1024) << std::endl;;
|
||||||
|
|
||||||
|
|
@ -129,11 +129,11 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
the_main(argc, argv);
|
the_main(argc, argv);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "Exception: " << e.what() << std::endl;
|
std::cout << "Exception: " << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,57 +23,57 @@ public :
|
||||||
// arity function, need this function!
|
// arity function, need this function!
|
||||||
int arity() const { return op == X? 0 : 2; }
|
int arity() const { return op == X? 0 : 2; }
|
||||||
|
|
||||||
void randomize() {}
|
void randomize() {}
|
||||||
|
|
||||||
// evaluation function, single case, using first argument to give value of variable
|
// evaluation function, single case, using first argument to give value of variable
|
||||||
template <class Children>
|
template <class Children>
|
||||||
void operator()(double& result, Children args, double var) const
|
void operator()(double& result, Children args, double var) const
|
||||||
{
|
{
|
||||||
double r1(0.), r2(0.);
|
double r1(0.), r2(0.);
|
||||||
if (arity() == 2)
|
if (arity() == 2)
|
||||||
{
|
{
|
||||||
args[0].apply(r1, var);
|
args[0].apply(r1, var);
|
||||||
args[1].apply(r2, var);
|
args[1].apply(r2, var);
|
||||||
}
|
}
|
||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
case Plus : result = r1 + r2; break;
|
case Plus : result = r1 + r2; break;
|
||||||
case Min : result = r1 - r2; break;
|
case Min : result = r1 - r2; break;
|
||||||
case Mult : result = r1 * r2; break;
|
case Mult : result = r1 * r2; break;
|
||||||
case PDiv : {
|
case PDiv : {
|
||||||
if (r2 == 0.0)
|
if (r2 == 0.0)
|
||||||
// protection a la Koza, realistic implementations
|
// protection a la Koza, realistic implementations
|
||||||
// should maybe throw an exception
|
// should maybe throw an exception
|
||||||
result = 1.0;
|
result = 1.0;
|
||||||
else
|
else
|
||||||
result = r1 / r2;
|
result = r1 / r2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case X : result = var; break;
|
case X : result = var; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 'Pretty' print to ostream function
|
/// 'Pretty' print to ostream function
|
||||||
template <class Children>
|
template <class Children>
|
||||||
void operator()(string& result, Children args) const
|
void operator()(string& result, Children args) const
|
||||||
{
|
{
|
||||||
static const string lb = "(";
|
static const string lb = "(";
|
||||||
static const string rb = ")";
|
static const string rb = ")";
|
||||||
char opStr[4] = " ";
|
char opStr[4] = " ";
|
||||||
opStr[1] = op;
|
opStr[1] = op;
|
||||||
|
|
||||||
if (arity() == 0)
|
if (arity() == 0)
|
||||||
{
|
{
|
||||||
result = "x";
|
result = "x";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
string r1;
|
string r1;
|
||||||
args[0].apply(r1);
|
args[0].apply(r1);
|
||||||
result = lb + r1;
|
result = lb + r1;
|
||||||
result += opStr;
|
result += opStr;
|
||||||
args[1].apply(r1);
|
args[1].apply(r1);
|
||||||
result += r1 + rb;
|
result += r1 + rb;
|
||||||
}
|
}
|
||||||
|
|
||||||
Operator getOp() const { return op; }
|
Operator getOp() const { return op; }
|
||||||
|
|
@ -99,7 +99,7 @@ static SymregNode init_sequence[5] = {SymregNode::X, SymregNode::Plus, SymregNod
|
||||||
// template <>
|
// template <>
|
||||||
// bool lt_arity(const SymregNode &node1, const SymregNode &node2)
|
// bool lt_arity(const SymregNode &node1, const SymregNode &node2)
|
||||||
// {
|
// {
|
||||||
// return (node1.arity() < node2.arity());
|
// return (node1.arity() < node2.arity());
|
||||||
// }
|
// }
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
@ -166,16 +166,16 @@ public :
|
||||||
vector<double> outputs;
|
vector<double> outputs;
|
||||||
outputs.resize(inputs.size());
|
outputs.resize(inputs.size());
|
||||||
|
|
||||||
double fitness = 0.0;
|
double fitness = 0.0;
|
||||||
|
|
||||||
for (unsigned i = 0; i < inputs.size(); ++i)
|
for (unsigned i = 0; i < inputs.size(); ++i)
|
||||||
{
|
{
|
||||||
_eo.apply(outputs[i], inputs[i]);
|
_eo.apply(outputs[i], inputs[i]);
|
||||||
fitness += (outputs[i] - target[i]) * (outputs[i] - target[i]);
|
fitness += (outputs[i] - target[i]) * (outputs[i] - target[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fitness /= (double) target.size();
|
fitness /= (double) target.size();
|
||||||
fitness = sqrt(fitness);
|
fitness = sqrt(fitness);
|
||||||
|
|
||||||
if (fitness > 1e+20)
|
if (fitness > 1e+20)
|
||||||
fitness = 1e+20;
|
fitness = 1e+20;
|
||||||
|
|
@ -197,11 +197,11 @@ void print_best(eoPop<EOT>& pop)
|
||||||
|
|
||||||
for (unsigned i = 1; i < pop.size(); ++i)
|
for (unsigned i = 1; i < pop.size(); ++i)
|
||||||
{
|
{
|
||||||
if (best < pop[i].fitness())
|
if (best < pop[i].fitness())
|
||||||
{
|
{
|
||||||
best = pop[i].fitness();
|
best = pop[i].fitness();
|
||||||
index = i;
|
index = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "\t";
|
std::cout << "\t";
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ double real_value (const Particle & _particle)
|
||||||
{
|
{
|
||||||
double sum = 0;
|
double sum = 0;
|
||||||
for (unsigned i = 0; i < _particle.size ()-1; i++)
|
for (unsigned i = 0; i < _particle.size ()-1; i++)
|
||||||
sum += pow(_particle[i],2);
|
sum += pow(_particle[i],2);
|
||||||
return (sum);
|
return (sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,20 +80,20 @@ int main()
|
||||||
// flight
|
// flight
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pso1(pop);
|
pso1(pop);
|
||||||
std::cout << "FINAL POPULATION AFTER SYNC PSO n°1:" << std::endl;
|
std::cout << "FINAL POPULATION AFTER SYNC PSO n°1:" << std::endl;
|
||||||
for (i = 0; i < pop.size(); ++i)
|
for (i = 0; i < pop.size(); ++i)
|
||||||
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
|
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
|
||||||
|
|
||||||
pso2(pop);
|
pso2(pop);
|
||||||
std::cout << "FINAL POPULATION AFTER SYNC PSO n°2:" << std::endl;
|
std::cout << "FINAL POPULATION AFTER SYNC PSO n°2:" << std::endl;
|
||||||
for (i = 0; i < pop.size(); ++i)
|
for (i = 0; i < pop.size(); ++i)
|
||||||
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
|
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "exception: " << e.what() << std::endl;;
|
std::cout << "exception: " << e.what() << std::endl;;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,4 +74,3 @@ int main()
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -208,11 +208,11 @@ int main()
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function();
|
main_function();
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << "Exception: " << e.what() << '\n';
|
std::cout << "Exception: " << e.what() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,4 +87,3 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ import optparse, logging, sys, os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
LEVELS = {'debug': logging.DEBUG,
|
LEVELS = {'debug': logging.DEBUG,
|
||||||
'info': logging.INFO,
|
'info': logging.INFO,
|
||||||
'warning': logging.WARNING,
|
'warning': logging.WARNING,
|
||||||
'error': logging.ERROR,
|
'error': logging.ERROR,
|
||||||
'critical': logging.CRITICAL}
|
'critical': logging.CRITICAL}
|
||||||
|
|
||||||
LOG_DEFAULT_FILENAME='notitle.log'
|
LOG_DEFAULT_FILENAME='notitle.log'
|
||||||
|
|
||||||
|
|
@ -68,10 +68,10 @@ def parser(parser=optparse.OptionParser()):
|
||||||
|
|
||||||
def logger(level_name, filename=LOG_DEFAULT_FILENAME):
|
def logger(level_name, filename=LOG_DEFAULT_FILENAME):
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.DEBUG,
|
level=logging.DEBUG,
|
||||||
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
|
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
|
||||||
filename=filename, filemode='a'
|
filename=filename, filemode='a'
|
||||||
)
|
)
|
||||||
|
|
||||||
console = logging.StreamHandler()
|
console = logging.StreamHandler()
|
||||||
console.setLevel(LEVELS.get(level_name, logging.NOTSET))
|
console.setLevel(LEVELS.get(level_name, logging.NOTSET))
|
||||||
|
|
@ -85,45 +85,45 @@ if not options.onlyexecute:
|
||||||
|
|
||||||
def get_boxplot_data( filename ):
|
def get_boxplot_data( filename ):
|
||||||
try:
|
try:
|
||||||
f = open( filename )
|
f = open( filename )
|
||||||
return [ [ float(value) for value in line.split() ] for line in f.readlines() ]
|
return [ [ float(value) for value in line.split() ] for line in f.readlines() ]
|
||||||
except:
|
except:
|
||||||
raise ValueError('got an issue during the reading of file %s' % filename)
|
raise ValueError('got an issue during the reading of file %s' % filename)
|
||||||
|
|
||||||
def do_measure( name, p, ps, P, d, ds, D, r=options.nRun, s=options.seed, v='logging' ):
|
def do_measure( name, p, ps, P, d, ds, D, r=options.nRun, s=options.seed, v='logging' ):
|
||||||
OPENMP_EXEC_FORMAT='./test/t-openmp -p=%d --popStep=%d -P=%d -d=%d --dimStep=%d -D=%d -r=%d --seed=%d -v=%s -H=%s -C=%d -V=%d'
|
OPENMP_EXEC_FORMAT='./test/t-openmp -p=%d --popStep=%d -P=%d -d=%d --dimStep=%d -D=%d -r=%d --seed=%d -v=%s -H=%s -C=%d -V=%d'
|
||||||
|
|
||||||
pwd = options.topic + name + '_'
|
pwd = options.topic + name + '_'
|
||||||
cmd = OPENMP_EXEC_FORMAT % (p, ps, P, d, ds, D, r, s, v, pwd,
|
cmd = OPENMP_EXEC_FORMAT % (p, ps, P, d, ds, D, r, s, v, pwd,
|
||||||
0 if options.onlyVarTime else 1,
|
0 if options.onlyVarTime else 1,
|
||||||
0 if options.onlyConstTime else 1)
|
0 if options.onlyConstTime else 1)
|
||||||
logging.info( cmd )
|
logging.info( cmd )
|
||||||
if not options.onlyprint:
|
if not options.onlyprint:
|
||||||
os.system( cmd )
|
os.system( cmd )
|
||||||
|
|
||||||
if not options.onlyexecute:
|
if not options.onlyexecute:
|
||||||
def generate( filenames ):
|
def generate( filenames ):
|
||||||
for cur in filenames:
|
for cur in filenames:
|
||||||
filename = RESULT_FILE_FORMAT % (pwd, cur, p, ps, P, d, ds, D, r, s)
|
filename = RESULT_FILE_FORMAT % (pwd, cur, p, ps, P, d, ds, D, r, s)
|
||||||
pylab.boxplot( get_boxplot_data( filename ) )
|
pylab.boxplot( get_boxplot_data( filename ) )
|
||||||
nonzero = lambda x: x if x > 0 else 1
|
nonzero = lambda x: x if x > 0 else 1
|
||||||
iters = ( nonzero( P - p ) / ps ) * ( nonzero( D - d ) / ds )
|
iters = ( nonzero( P - p ) / ps ) * ( nonzero( D - d ) / ds )
|
||||||
pylab.xlabel('%d iterations from %d,%d to %d,%d' % ( iters, p, d, P, D) )
|
pylab.xlabel('%d iterations from %d,%d to %d,%d' % ( iters, p, d, P, D) )
|
||||||
pylab.ylabel('%s - %s' % (cur, name))
|
pylab.ylabel('%s - %s' % (cur, name))
|
||||||
pylab.savefig( filename + '.pdf', format='pdf' )
|
pylab.savefig( filename + '.pdf', format='pdf' )
|
||||||
pylab.savefig( filename + '.png', format='png' )
|
pylab.savefig( filename + '.png', format='png' )
|
||||||
pylab.cla()
|
pylab.cla()
|
||||||
pylab.clf()
|
pylab.clf()
|
||||||
|
|
||||||
if not options.onlyVarTime:
|
if not options.onlyVarTime:
|
||||||
generate( ['speedup', 'efficiency', 'dynamicity'] )
|
generate( ['speedup', 'efficiency', 'dynamicity'] )
|
||||||
if not options.onlyConstTime:
|
if not options.onlyConstTime:
|
||||||
generate( ['variable_speedup', 'variable_efficiency', 'variable_dynamicity'] )
|
generate( ['variable_speedup', 'variable_efficiency', 'variable_dynamicity'] )
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if not options.onlyprint:
|
if not options.onlyprint:
|
||||||
logging.info('creates first the new topic repository %s', options.topic)
|
logging.info('creates first the new topic repository %s', options.topic)
|
||||||
os.mkdir( options.topic )
|
os.mkdir( options.topic )
|
||||||
|
|
||||||
logging.info('do all tests with r = %d and a common seed value = %d' % (options.nRun, options.seed))
|
logging.info('do all tests with r = %d and a common seed value = %d' % (options.nRun, options.seed))
|
||||||
|
|
||||||
|
|
@ -133,24 +133,24 @@ def main():
|
||||||
F = options.fixedBound
|
F = options.fixedBound
|
||||||
|
|
||||||
if options.measure is None or 1 in options.measure:
|
if options.measure is None or 1 in options.measure:
|
||||||
logging.info('(1) measure for all combinaisons of P n D')
|
logging.info('(1) measure for all combinaisons of P n D')
|
||||||
do_measure( '1', 1*n, 10*n, 101*n, 1*n, 10*n, 101*n )
|
do_measure( '1', 1*n, 10*n, 101*n, 1*n, 10*n, 101*n )
|
||||||
|
|
||||||
if options.measure is None or 2 in options.measure:
|
if options.measure is None or 2 in options.measure:
|
||||||
logging.info('(2) measure for P \in [%d, %d[ with D fixed to %d' % (1*n, 101*n, F))
|
logging.info('(2) measure for P \in [%d, %d[ with D fixed to %d' % (1*n, 101*n, F))
|
||||||
do_measure( '2', 1*n, 1*n, 101*n, F, 1, F )
|
do_measure( '2', 1*n, 1*n, 101*n, F, 1, F )
|
||||||
|
|
||||||
if options.measure is None or 3 in options.measure:
|
if options.measure is None or 3 in options.measure:
|
||||||
logging.info('(3) measure for P \in [%d, %d[ with ps = %d and D fixed to %d' % (1*n, 1001*n, 10*n, F))
|
logging.info('(3) measure for P \in [%d, %d[ with ps = %d and D fixed to %d' % (1*n, 1001*n, 10*n, F))
|
||||||
do_measure( '3', 1*n, 10*n, 1001*n, F, 1, F )
|
do_measure( '3', 1*n, 10*n, 1001*n, F, 1, F )
|
||||||
|
|
||||||
if options.measure is None or 4 in options.measure:
|
if options.measure is None or 4 in options.measure:
|
||||||
logging.info('(4) measure for D \in [%d, %d[ with P fixed to %d' % (1*n, 101*n, F))
|
logging.info('(4) measure for D \in [%d, %d[ with P fixed to %d' % (1*n, 101*n, F))
|
||||||
do_measure( '4', F, 1, F, 1*n, 1*n, 101*n )
|
do_measure( '4', F, 1, F, 1*n, 1*n, 101*n )
|
||||||
|
|
||||||
if options.measure is None or 5 in options.measure:
|
if options.measure is None or 5 in options.measure:
|
||||||
logging.info('(5) measure for D \in [%d, %d[ with ds = %d and P fixed to %d' % (1*n, 1001*n, 10*n, F))
|
logging.info('(5) measure for D \in [%d, %d[ with ds = %d and P fixed to %d' % (1*n, 1001*n, 10*n, F))
|
||||||
do_measure( '5', F, 1, F, 1*n, 10*n, 1001*n )
|
do_measure( '5', F, 1, F, 1*n, 10*n, 1001*n )
|
||||||
|
|
||||||
# when executed, just run main():
|
# when executed, just run main():
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
|
|
@ -78,10 +78,10 @@ void main_function(int argc, char **argv)
|
||||||
{
|
{
|
||||||
Indi v; // void individual, to be filled
|
Indi v; // void individual, to be filled
|
||||||
for (unsigned ivar=0; ivar<VEC_SIZE; ivar++)
|
for (unsigned ivar=0; ivar<VEC_SIZE; ivar++)
|
||||||
{
|
{
|
||||||
bool r = rng.flip(); // new value, random in {0,1}
|
bool r = rng.flip(); // new value, random in {0,1}
|
||||||
v.push_back(r); // append that random value to v
|
v.push_back(r); // append that random value to v
|
||||||
}
|
}
|
||||||
eval(v); // evaluate it
|
eval(v); // evaluate it
|
||||||
pop.push_back(v); // and put it in the population
|
pop.push_back(v); // and put it in the population
|
||||||
}
|
}
|
||||||
|
|
@ -138,7 +138,7 @@ void main_function(int argc, char **argv)
|
||||||
|
|
||||||
|
|
||||||
eoSGA<Indi> gga(select, xover, CROSS_RATE, mutation, MUT_RATE,
|
eoSGA<Indi> gga(select, xover, CROSS_RATE, mutation, MUT_RATE,
|
||||||
eval, continuator);
|
eval, continuator);
|
||||||
|
|
||||||
// Apply algo to pop - that's it!
|
// Apply algo to pop - that's it!
|
||||||
gga(pop);
|
gga(pop);
|
||||||
|
|
@ -156,11 +156,11 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function(argc, argv);
|
main_function(argc, argv);
|
||||||
}
|
}
|
||||||
catch(exception& e)
|
catch(exception& e)
|
||||||
{
|
{
|
||||||
cout << "Exception: " << e.what() << '\n';
|
cout << "Exception: " << e.what() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -78,10 +78,10 @@ void main_function(int argc, char **argv)
|
||||||
{
|
{
|
||||||
Indi v; // void individual, to be filled
|
Indi v; // void individual, to be filled
|
||||||
for (unsigned ivar=0; ivar<VEC_SIZE; ivar++)
|
for (unsigned ivar=0; ivar<VEC_SIZE; ivar++)
|
||||||
{
|
{
|
||||||
double r = 2*rng.uniform() - 1; // new value, random in [-1,1)
|
double r = 2*rng.uniform() - 1; // new value, random in [-1,1)
|
||||||
v.push_back(r); // append that random value to v
|
v.push_back(r); // append that random value to v
|
||||||
}
|
}
|
||||||
eval(v); // evaluate it
|
eval(v); // evaluate it
|
||||||
pop.push_back(v); // and put it in the population
|
pop.push_back(v); // and put it in the population
|
||||||
}
|
}
|
||||||
|
|
@ -133,7 +133,7 @@ void main_function(int argc, char **argv)
|
||||||
|
|
||||||
|
|
||||||
eoSGA<Indi> gga(select, xover, CROSS_RATE, mutation, MUT_RATE,
|
eoSGA<Indi> gga(select, xover, CROSS_RATE, mutation, MUT_RATE,
|
||||||
eval, continuator);
|
eval, continuator);
|
||||||
|
|
||||||
// Apply algo to pop - that's it!
|
// Apply algo to pop - that's it!
|
||||||
gga(pop);
|
gga(pop);
|
||||||
|
|
@ -151,11 +151,11 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function(argc, argv);
|
main_function(argc, argv);
|
||||||
}
|
}
|
||||||
catch(exception& e)
|
catch(exception& e)
|
||||||
{
|
{
|
||||||
cout << "Exception: " << e.what() << '\n';
|
cout << "Exception: " << e.what() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Include the corresponding file
|
// Include the corresponding file
|
||||||
#include <ga.h> // bitstring representation & operators
|
#include <ga.h> // bitstring representation & operators
|
||||||
// define your individuals
|
// define your individuals
|
||||||
typedef eoBit<double> Indi; // A bitstring with fitness double
|
typedef eoBit<double> Indi; // A bitstring with fitness double
|
||||||
|
|
||||||
|
|
@ -151,11 +151,11 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function(argc, argv);
|
main_function(argc, argv);
|
||||||
}
|
}
|
||||||
catch(exception& e)
|
catch(exception& e)
|
||||||
{
|
{
|
||||||
cout << "Exception: " << e.what() << '\n';
|
cout << "Exception: " << e.what() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -182,11 +182,11 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function(argc, argv);
|
main_function(argc, argv);
|
||||||
}
|
}
|
||||||
catch(exception& e)
|
catch(exception& e)
|
||||||
{
|
{
|
||||||
cout << "Exception: " << e.what() << '\n';
|
cout << "Exception: " << e.what() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ void main_function(int argc, char **argv)
|
||||||
const float P_MUT = 0.5; // mutation probability
|
const float P_MUT = 0.5; // mutation probability
|
||||||
|
|
||||||
const double EPSILON = 0.01; // range for real uniform mutation
|
const double EPSILON = 0.01; // range for real uniform mutation
|
||||||
double SIGMA = 0.3; // std dev. for normal mutation
|
double SIGMA = 0.3; // std dev. for normal mutation
|
||||||
// some parameters for chosing among different operators
|
// some parameters for chosing among different operators
|
||||||
const double hypercubeRate = 0.5; // relative weight for hypercube Xover
|
const double hypercubeRate = 0.5; // relative weight for hypercube Xover
|
||||||
const double segmentRate = 0.5; // relative weight for segment Xover
|
const double segmentRate = 0.5; // relative weight for segment Xover
|
||||||
|
|
@ -181,11 +181,11 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function(argc, argv);
|
main_function(argc, argv);
|
||||||
}
|
}
|
||||||
catch(exception& e)
|
catch(exception& e)
|
||||||
{
|
{
|
||||||
cout << "Exception: " << e.what() << '\n';
|
cout << "Exception: " << e.what() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,3 @@ double binary_value(const std::vector<bool>& _chrom)
|
||||||
sum += _chrom[i];
|
sum += _chrom[i];
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
// REPRESENTATION
|
// REPRESENTATION
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Include the corresponding file
|
// Include the corresponding file
|
||||||
#include <ga.h> // bitstring representation & operators
|
#include <ga.h> // bitstring representation & operators
|
||||||
// define your individuals
|
// define your individuals
|
||||||
typedef eoBit<double> Indi; // A bitstring with fitness double
|
typedef eoBit<double> Indi; // A bitstring with fitness double
|
||||||
|
|
||||||
|
|
@ -186,11 +186,11 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function(argc, argv);
|
main_function(argc, argv);
|
||||||
}
|
}
|
||||||
catch(exception& e)
|
catch(exception& e)
|
||||||
{
|
{
|
||||||
cout << "Exception: " << e.what() << '\n';
|
cout << "Exception: " << e.what() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,3 @@ double real_value(const std::vector<double>& _ind)
|
||||||
}
|
}
|
||||||
return -sum;
|
return -sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,4 +62,3 @@ INSTALL(TARGETS SecondRealEA RUNTIME DESTINATION share/eo/examples/Lesson3 COMPO
|
||||||
INSTALL(TARGETS exercise3.1 RUNTIME DESTINATION share/eo/examples/Lesson3 COMPONENT examples)
|
INSTALL(TARGETS exercise3.1 RUNTIME DESTINATION share/eo/examples/Lesson3 COMPONENT examples)
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,8 +126,8 @@ void main_function(int argc, char **argv)
|
||||||
// i.e. in case you need parameters somewhere else, postpone these
|
// i.e. in case you need parameters somewhere else, postpone these
|
||||||
if (parser.userNeedsHelp())
|
if (parser.userNeedsHelp())
|
||||||
{
|
{
|
||||||
parser.printHelp(cout);
|
parser.printHelp(cout);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (statusParam.value() != "")
|
if (statusParam.value() != "")
|
||||||
{
|
{
|
||||||
|
|
@ -337,11 +337,11 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function(argc, argv);
|
main_function(argc, argv);
|
||||||
}
|
}
|
||||||
catch(exception& e)
|
catch(exception& e)
|
||||||
{
|
{
|
||||||
cout << "Exception: " << e.what() << '\n';
|
cout << "Exception: " << e.what() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,8 @@ void main_function(int argc, char **argv)
|
||||||
// i.e. in case you need parameters somewhere else, postpone these
|
// i.e. in case you need parameters somewhere else, postpone these
|
||||||
if (parser.userNeedsHelp())
|
if (parser.userNeedsHelp())
|
||||||
{
|
{
|
||||||
parser.printHelp(cout);
|
parser.printHelp(cout);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (statusName != "")
|
if (statusName != "")
|
||||||
{
|
{
|
||||||
|
|
@ -318,11 +318,11 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function(argc, argv);
|
main_function(argc, argv);
|
||||||
}
|
}
|
||||||
catch(exception& e)
|
catch(exception& e)
|
||||||
{
|
{
|
||||||
cout << "Exception: " << e.what() << '\n';
|
cout << "Exception: " << e.what() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,3 @@ double binary_value(const std::vector<bool>& _chrom)
|
||||||
sum += _chrom[i];
|
sum += _chrom[i];
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
// REPRESENTATION
|
// REPRESENTATION
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Include the corresponding file
|
// Include the corresponding file
|
||||||
#include <ga.h> // bitstring representation & operators
|
#include <ga.h> // bitstring representation & operators
|
||||||
// define your genotype and fitness types
|
// define your genotype and fitness types
|
||||||
typedef eoBit<eoMinimizingFitness> Indi;
|
typedef eoBit<eoMinimizingFitness> Indi;
|
||||||
|
|
||||||
|
|
@ -126,8 +126,8 @@ void main_function(int argc, char **argv)
|
||||||
// i.e. in case you need parameters somewhere else, postpone these
|
// i.e. in case you need parameters somewhere else, postpone these
|
||||||
if (parser.userNeedsHelp())
|
if (parser.userNeedsHelp())
|
||||||
{
|
{
|
||||||
parser.printHelp(cout);
|
parser.printHelp(cout);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (statusParam.value() != "")
|
if (statusParam.value() != "")
|
||||||
{
|
{
|
||||||
|
|
@ -393,11 +393,11 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function(argc, argv);
|
main_function(argc, argv);
|
||||||
}
|
}
|
||||||
catch(exception& e)
|
catch(exception& e)
|
||||||
{
|
{
|
||||||
cout << "Exception: " << e.what() << '\n';
|
cout << "Exception: " << e.what() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,3 @@ double real_value(const std::vector<double>& _ind)
|
||||||
}
|
}
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,4 +96,3 @@ INSTALL(TARGETS RealEA RUNTIME DESTINATION share/eo/examples/Lesson4 COMPONENT e
|
||||||
INSTALL(TARGETS ESEA RUNTIME DESTINATION share/eo/examples/Lesson4 COMPONENT examples)
|
INSTALL(TARGETS ESEA RUNTIME DESTINATION share/eo/examples/Lesson4 COMPONENT examples)
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,11 +70,11 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
main_function(argc, argv);
|
main_function(argc, argv);
|
||||||
}
|
}
|
||||||
catch(exception& e)
|
catch(exception& e)
|
||||||
{
|
{
|
||||||
cout << "Exception: " << e.what() << '\n';
|
cout << "Exception: " << e.what() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -94,7 +94,7 @@ void runAlgorithm(EOT, eoParser& _parser, eoState& _state)
|
||||||
|
|
||||||
// The evaluation fn - encapsulated into an eval counter for output
|
// The evaluation fn - encapsulated into an eval counter for output
|
||||||
eoEvalFuncPtr<EOT, double, const std::vector<double>&>
|
eoEvalFuncPtr<EOT, double, const std::vector<double>&>
|
||||||
mainEval( real_value );
|
mainEval( real_value );
|
||||||
eoEvalFuncCounter<EOT> eval(mainEval);
|
eoEvalFuncCounter<EOT> eval(mainEval);
|
||||||
|
|
||||||
// the genotype - through a genotype initializer
|
// the genotype - through a genotype initializer
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
###### General ######
|
###### General ######
|
||||||
# --help=0 # -h : Prints this message
|
# --help=0 # -h : Prints this message
|
||||||
# --stopOnUnknownParam=1 # Stop if unkown param entered
|
# --stopOnUnknownParam=1 # Stop if unkown param entered
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
// The evaluation fn - encapsulated into an eval counter for output
|
// The evaluation fn - encapsulated into an eval counter for output
|
||||||
eoEvalFuncPtr<EOT, double, const std::vector<double>&>
|
eoEvalFuncPtr<EOT, double, const std::vector<double>&>
|
||||||
mainEval( real_value );
|
mainEval( real_value );
|
||||||
eoEvalFuncCounter<EOT> eval(mainEval);
|
eoEvalFuncCounter<EOT> eval(mainEval);
|
||||||
|
|
||||||
// the genotype - through a genotype initializer
|
// the genotype - through a genotype initializer
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
###### General ######
|
###### General ######
|
||||||
# --help=0 # -h : Prints this message
|
# --help=0 # -h : Prints this message
|
||||||
# --stopOnUnknownParam=1 # Stop if unkown param entered
|
# --stopOnUnknownParam=1 # Stop if unkown param entered
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,3 @@ double real_value(const std::vector<double>& _ind)
|
||||||
sum += _ind[i] * _ind[i];
|
sum += _ind[i] * _ind[i];
|
||||||
return sqrt(sum);
|
return sqrt(sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,4 +108,3 @@ private: // put all data here
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,4 +60,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue