00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <iostream>
00027 #include <eo>
00028 #include "MGE/VirusOp.h"
00029 #include "MGE/eoVirus.h"
00030 #include "MGE/eoInitVirus.h"
00031 #include <utils/eoRndGenerators.h>
00032
00033 #include "binary_value.h"
00034
00035
00036
00037 typedef eoVirus<float> Chrom;
00038
00039
00040
00041 int main()
00042 {
00043 const unsigned SIZE = 8;
00044 eoBooleanGenerator gen;
00045 eo::rng.reseed( time( 0 ) );
00046
00047 Chrom chrom(SIZE), chrom2(SIZE);
00048 chrom.fitness(binary_value(chrom)); chrom2.fitness(binary_value(chrom2));
00049 std::cout << chrom << std::endl;
00050 std::cout << chrom2 << std::endl;
00051
00052
00053 VirusBitFlip<float> vf;
00054 unsigned i;
00055 for ( i = 0; i < 10; i++ ) {
00056 vf( chrom );
00057 std::cout << chrom << std::endl;
00058 }
00059
00060
00061 std::cout << "Chrom mutation--------" << std::endl;
00062 VirusMutation<float> vm;
00063 for ( i = 0; i < 10; i++ ) {
00064 vm( chrom );
00065 std::cout << chrom << std::endl;
00066 }
00067
00068
00069 std::cout << "Chrom transmission--------" << std::endl;
00070 VirusTransmission<float> vt;
00071 vt( chrom2, chrom );
00072 std::cout << chrom2 << std::endl;
00073
00074 return 0;
00075
00076 }
00077