Skip to content

Commit 57cc5bb

Browse files
preparing for version 0.2
1 parent b7f0773 commit 57cc5bb

File tree

8 files changed

+30
-49
lines changed

8 files changed

+30
-49
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ else ()
6060
message ( STATUS "Google C++ Testing Framework not found in \"${GTEST_ROOT}\" tests will be disabled !" )
6161
endif ()
6262

63-
message ( STATUS " get googlemock/googletest by: svn checkout http://googlemock.googlecode.com/svn/tags/release-1.7.0/ \"${THIRDPARTY_ROOT}/gmock\"" )
63+
message ( STATUS "get googlemock/googletest by: svn checkout http://googlemock.googlecode.com/svn/tags/release-1.7.0/ \"${THIRDPARTY_ROOT}/gmock\"" )
6464

6565
endif ()

doc/tutorial_artificial_ant.qbk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
[section Artificial ant]
22
[import ../examples/artificial_ant/nodes.hpp]
33
[import ../examples/artificial_ant/simulation.hpp]
4-
[import ../examples/artificial_ant/main.cpp]
5-
[import ../examples/artificial_ant/detail/artificial_ant_tests.cpp]
4+
[import ../examples/artificial_ant/artificial_ant.cpp]
65
[import ../examples/artificial_ant/board.hpp]
76
[import ../examples/artificial_ant/santa_fe_trail.hpp]
87

examples/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Date: 2013-01-25
22
# Author: Karsten Ahnert ([email protected])
33

4-
#add_subdirectory ( symb_reg )
4+
add_subdirectory ( symb_reg )
55
add_subdirectory ( artificial_ant )
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Date: 2014-07-18
22
# Author: Gerard Choinka ([email protected])
33

4-
add_executable ( artificial_ant main.cpp )
5-
add_subdirectory ( detail )
4+
add_executable ( artificial_ant artificial_ant.cpp )
5+
6+
# add_subdirectory ( detail )

examples/artificial_ant/main.cpp renamed to examples/artificial_ant/artificial_ant.cpp

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,26 @@
2929
#include <chrono>
3030

3131

32-
template<typename T>
33-
std::string tree_to_string(T const & t)
32+
33+
34+
//[ant_move_test
35+
bool ant_move_test()
3436
{
35-
std::ostringstream oss;
36-
oss << gpcxx::simple(t) ;
37-
return oss.str();
38-
}
37+
size_t const board_size_x { 32 };
38+
size_t const board_size_y { 32 };
39+
ant_example::board const the_board { board_size_x , board_size_y };
40+
ant_example::ant an_ant { the_board.pos_2d_to_1d( { 0, 0 } ), ant_example::east };
41+
42+
43+
an_ant.move(the_board);
44+
45+
bool position_is_valid = an_ant.pos() == the_board.pos_2d_to_1d( { 1, 0 } );
46+
bool step_count_is_valid = an_ant.steps_done() == 1;
47+
48+
49+
return position_is_valid && step_count_is_valid ;
50+
}
51+
//]
3952

4053

4154
int main( int argc , char *argv[] )
@@ -100,20 +113,6 @@ int main( int argc , char *argv[] )
100113
init_tree_generator( individum );
101114
//]
102115

103-
/*
104-
auto tree_hasher = [](tree_type const & t){ return std::hash<std::string>{}(tree_to_string(t));};
105-
106-
107-
std::unordered_set<std::size_t> test ;
108-
109-
for(tree_type const t : population)
110-
{
111-
test.insert(tree_hasher(t));
112-
std::cout << tree_hasher(t) << "\t" << tree_to_string(t) << std::endl;
113-
}
114-
std::cout << test.size() << std::endl;
115-
if(true) return 1;
116-
*/
117116
//[evolver_definition
118117
using evolver_type = gpcxx::static_pipeline< population_type , fitness_type , rng_type > ;
119118
evolver_type evolver( number_elite , mutation_rate , crossover_rate , reproduction_rate , rng );
@@ -171,7 +170,6 @@ int main( int argc , char *argv[] )
171170
auto fittest_individual_position = std::distance( fitness.begin(), std::min_element( fitness.begin(), fitness.end() ) );
172171
tree_type const & fittest_individual = population[fittest_individual_position];
173172

174-
// std::cout << std::hash<std::string>{}(tree_to_string(fittest_individual)) << std::endl;
175173
// cat artificial_ant_fittest_individual.dot | dot -Tsvg | display -
176174
std::ofstream("artificial_ant_fittest_individual.dot") << gpcxx::graphviz( fittest_individual , false );
177175

examples/artificial_ant/detail/artificial_ant_tests.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,7 @@
1818

1919
char const newl = '\n';
2020

21-
//[ant_move_test
22-
bool ant_move_test()
23-
{
24-
size_t const board_size_x { 32 };
25-
size_t const board_size_y { 32 };
26-
ant_example::board const the_board { board_size_x , board_size_y };
27-
ant_example::ant an_ant { the_board.pos_2d_to_1d( { 0, 0 } ), ant_example::east };
28-
29-
30-
an_ant.move(the_board);
31-
32-
bool position_is_valid = an_ant.pos() == the_board.pos_2d_to_1d( { 1, 0 } );
33-
bool step_count_is_valid = an_ant.steps_done() == 1;
34-
35-
36-
return position_is_valid && step_count_is_valid ;
37-
}
38-
//]
21+
3922

4023
void paper_tree()
4124
{

examples/symb_reg/symb_reg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ int main( int argc , char *argv[] )
5959
{
6060
//[ create_training_data
6161
using rng_type = std::mt19937;
62-
rng_type rng;
62+
rng_type rng;
63+
6364
gpcxx::regression_training_data< double , 3 > c;
6465
gpcxx::generate_regression_test_data( c , 1024 , rng , []( double x1 , double x2 , double x3 )
6566
{ return x1 * x1 * x1 + 1.0 / 10.0 * x2 * x2 - 3.0 / 4.0 * x3 + 1.0 ; } );
@@ -129,7 +130,6 @@ int main( int argc , char *argv[] )
129130

130131
fitness_type fitness( population_size , 0.0 );
131132
population_type population( population_size );
132-
rng_type rng;
133133
//]
134134

135135
//[ define_evolution

include/gpcxx/config_version.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#define GPCXX_VERSION_MAJOR 0
1616
#define GPCXX_VERSION_MINOR 1
17-
#define GPCXX_VERSION_PATCH 178
18-
#define GPCXX_VERSION_SHA1 gd69f
17+
#define GPCXX_VERSION_PATCH 186
18+
#define GPCXX_VERSION_SHA1 gb7f0
1919

2020
#endif // GPCXX_CONFIG_VERSION_HPP_DEFINED

0 commit comments

Comments
 (0)