# HG changeset patch # User ladanyi # Date 1099594351 0 # Node ID 75f7496822405f39f0ae98b20d2a049866124659 # Parent 4dd4eaee28e7003a8cb8c5341f0a66439c8aae5f Updated because of the recent changes in simann.h. diff -r 4dd4eaee28e7 -r 75f749682240 src/work/akos/simann_test.cc --- a/src/work/akos/simann_test.cc Thu Nov 04 18:48:58 2004 +0000 +++ b/src/work/akos/simann_test.cc Thu Nov 04 18:52:31 2004 +0000 @@ -1,48 +1,18 @@ -#include "simann.h" #include #include -#include +#include "simann.h" using namespace lemon; -class MyController : public SimAnnBase::Controller { -public: - long iter, last_impr, max_iter, max_no_impr; - double temp, annealing_factor; - MyController() { - iter = last_impr = 0; - max_iter = 500000; - max_no_impr = 20000; - annealing_factor = 0.9999; - temp = 1000; - } - void acceptEvent() { - iter++; - } - void improveEvent() { - last_impr = iter; - } - void rejectEvent() { - iter++; - } - bool next() { - temp *= annealing_factor; - bool quit = (iter > max_iter) || (iter - last_impr > max_no_impr); - return !quit; - } - bool accept(double cost_diff) { - return (drand48() <= exp(cost_diff / temp)); - } -}; - class MyEntity { public: double mutate() { return 10.0; } + void revert() {} }; int main() { SimAnn simann; - MyController ctrl; + SimpleController ctrl; simann.setController(ctrl); MyEntity ent; simann.setEntity(ent);