123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- //////////////////////////////////////////////////////////////////////
- //
- // CombinatorialOptimizer.h: interface of combinatorial optimizers.
- //
- //////////////////////////////////////////////////////////////////////
- #ifndef _COMBINATORIAL_OPTIMIZER_
- #define _COMBINATORIAL_OPTIMIZER_
- #include "core/optimization/blackbox/SimpleOptimizer.h"
- #include "core/optimization/blackbox/Definitions_core_opt.h"
- namespace OPTIMIZATION
- {
- ///
- /// class for the Combinatorial optimizers
- ///
- /// HowToUse:
- ///
- /// * use setMode to specify which algorithm to use (simulated annealing, etc.)
- /// * use setStepLength to set the variance for the random number generation
- /// * use setParameters() to set the start point
- /// * use setFastMode() to let the random number generation contract with the control sequence
- /// * use setControlSeq() to set the parameters for the control sequence
- /// * call init()
- /// * call optimize()
- ///
- ///
- /// Implemented Abort criteria:
- ///
- /// * maximum number of iterations
- /// * time limit
- /// * parameter bounds
- ///
- /// Additional return reason:
- ///
- ///
- ///
- ///
- ///
- class CombinatorialOptimizer : public SimpleOptimizer
- {
- public:
- typedef SimpleOptimizer SuperClass;
- typedef OPTIMIZATION::matrix_type matrix_type;
- ///
- /// Constructor.
- /// @param loger : OptLogBase * to existing log class
- ///
- CombinatorialOptimizer(OptLogBase *loger=NULL);
- ///
- /// Copy constructor
- /// @param opt .. optimizer to copy
- ///
- CombinatorialOptimizer( const CombinatorialOptimizer &opt);
- ///
- /// operator =
- ///
- CombinatorialOptimizer & operator=(const CombinatorialOptimizer &opt);
- ///
- /// Destructor.
- ///
- ~CombinatorialOptimizer();
- /*!
- enumeration for the return reasons of an optimizer,
- has all elements of the SuperClass optimizer
- */
-
- ///
- /// Do internal initializations
- ///
- void init();
-
- ///
- /// start the optmization
- ///
- int optimize();
- ///
- /// set mode:
- ///
- /// 1 = simulated annealing
- /// 2 = threshold acceptance
- /// 3 = great deluge
- /// 4 = stochastic relaxation
- /// 5 = mix of simualted annealing and "constant" great deluge
- /// (that means sa is used but there is a hard acceptance threshold.
- /// function values have to be below that threshold to have the
- /// chance to be accepted. This can be used to do some kind of constraint
- /// handling when they are penalized enough..)
- ///
- ///
- bool setMode(int mode);
-
- ///
- /// set the parameters for the control sequence
- /// where t_k = t_0 * alpha^k
- ///
- /// @param T0 >= 0
- /// @param alpha > 0
- ///
- /// @return true in case of success
- ///
- bool setControlSeqParam(double T0, double alpha);
- ///*!
- // @param steplength double value that is used as variance to generate new points
- //*/
- //bool setSteplength(double steplength);
- ///
- /// set threshold used in mode 5 as constant deluge control sequence
- /// @param thres
- ///
- inline void setThreshold(double thres){m_threshold = thres;};
- ///
- /// use fast contraction mode: the control sequence is used
- /// for the variance to generate new points
- ///
- inline void setFastMode(bool fastmode){m_fast = fastmode;};
- private:
- ///
- /// generate new point
- ///
- matrix_type generatePoint();
- ///
- /// accept point
- ///
- bool accepptPoint(double oldValue, double newValue);
- ///
- /// algorithm mode
- ///
- int m_mode;
- ///
- /// fast mode point generation?
- ///
- bool m_fast;
- ///
- /// control sequence Tk= T_0 * m_alpha^m_numIter
- ///
- double m_T0;
- ///
- /// control sequence Tk= T_0 * m_alpha^m_numIter
- ///
- double m_Tk;
- ///
- /// control sequence Tk= T_0 * m_alpha^m_numIter
- ///
- double m_alpha;
- ///
- /// Threshold for mode nr. 5
- ///
- double m_threshold;
- ///
- /// steplength used as variance to generate new points
- ///
- double m_stepLength;
-
- };//class
- }//namespace
- #endif
|