SimAnnBase Class Reference


Detailed Description

Can be used to derive a custom simulated annealing class if SimAnn doesn't fit your needs. #include <lemon/simann.h>

Inheritance diagram for SimAnnBase:

Inheritance graph
[legend]

List of all members.

Public Member Functions

void setController (ControllerBase &_controller)
 Sets the controller class to use.
double getCurrCost () const
 Returns the cost of the current solution.
double getPrevCost () const
 Returns the cost of the previous solution.
double getBestCost () const
 Returns the cost of the best solution.
long getIter () const
 Returns the number of iterations done.
long getLastImpr () const
 Returns the ordinal number of the last iteration when the solution was improved.
bool step ()
 Performs one iteration.
bool step (int n)
 Performs a given number of iterations.
void run ()
 Starts the annealing process.
virtual ~SimAnnBase ()
 Destructor.

Protected Member Functions

virtual double mutate ()=0
 Step to a neighbouring state.
virtual void revert ()=0
 Reverts the last mutate().
virtual void saveAsBest ()=0
 Saves the current solution as the best one.
virtual void init ()
 Does initializations before each run.

Private Attributes

ControllerBasecontroller
 Pointer to the controller.
double curr_cost
 Cost of the current solution.
double best_cost
 Cost of the best solution.
double prev_cost
 Cost of the previous solution.
double prev_prev_cost
 Cost of the solution preceding the previous one.
long iter
 Number of iterations.
long last_impr
 Number of iterations which did not improve the solution since the last improvement.


Member Function Documentation

bool step ( int  n  )  [inline]

Parameters:
n the number of iterations


Generated on Thu Jun 4 04:06:40 2009 for LEMON by  doxygen 1.5.9