COIN-OR::LEMON - Graph Library

Changeset 1145:99c1aa395a58 in lemon-0.x


Ignore:
Timestamp:
02/11/05 15:56:40 (15 years ago)
Author:
Akos Ladanyi
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1546
Message:

more docs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/akos/simann.h

    r1142 r1145  
    181181    max_iter(_max_iter), max_no_impr(_max_no_impr), temp(_temp),
    182182    ann_fact(_ann_fact) {}
     183    /*! \brief This is called when a neighbouring state gets accepted. */
    183184    void acceptEvent() {
    184185      iter++;
     
    216217  /*! \brief A controller with preset running time for the simulated annealing
    217218   *  class.
     219   *
     220   *  With this controller you can set the running time of the annealing
     221   *  process in advance. It works the following way: the controller measures
     222   *  a kind of divergence. The divergence is the difference of the average
     223   *  cost of the recently found solutions the cost of the best found one. In
     224   *  case this divergence is greater than a given threshold, then we decrease
     225   *  the annealing factor, that is we cool the system faster. In case the
     226   *  divergence is lower than the threshold, then we increase the temperature.
     227   *  The threshold is a function of the elapsed time which reaches zero at the
     228   *  desired end time.
    218229   */
    219230  class AdvancedController : public SimAnnBase::Controller {
     
    228239    double beta;
    229240    double gamma;
     241    /*! \brief The time at the end of the algorithm. */
    230242    double end_time;
     243    /*! \brief The time at the start of the algorithm. */
    231244    double start_time;
     245    /*! \brief Starting threshold. */
    232246    double start_threshold;
     247    /*! \brief Average cost of recent solutions. */
    233248    double avg_cost;
     249    /*! \brief Temperature. */
    234250    double temp;
     251    /*! \brief Annealing factor. */
    235252    double ann_fact;
     253    /*! \brief Initial annealing factor. */
     254    double init_ann_fact;
    236255    bool warmup;
    237256    /*! \brief Constructor.
     
    240259     *  \param _beta parameter used to decrease the annealing factor
    241260     *  \param _gamma parameter used to increase the temperature
     261     *  \param _ann_fact initial annealing factor
    242262     */
    243263    AdvancedController(double _end_time, double _alpha = 0.2,
    244     double _beta = 0.9, double _gamma = 1.6) : alpha(_alpha), beta(_beta),
    245     gamma(_gamma), end_time(_end_time), ann_fact(0.99999999), warmup(true) {}
     264    double _beta = 0.9, double _gamma = 1.6, double _ann_fact = 0.9999) :
     265    alpha(_alpha), beta(_beta), gamma(_gamma), end_time(_end_time),
     266    ann_fact(_ann_fact), init_ann_fact(_ann_fact), warmup(true) {}
    246267    void init() {
    247268      avg_cost = base->getCurrCost();
     
    276297          // increase the temperature
    277298          temp *= gamma;
    278           ann_fact = 0.99999999; // !!!!!!!!!!!
     299          // reset the annealing factor
     300          ann_fact = init_ann_fact;
    279301        }
    280302        temp *= ann_fact;
Note: See TracChangeset for help on using the changeset viewer.