tptr_schedule.h

00001 /*
00002   -------------------------------------------------------------------
00003   
00004   Copyright (C) 2006, 2007, Andrew W. Steiner
00005   
00006   This file is part of O2scl.
00007   
00008   O2scl is free software; you can redistribute it and/or modify
00009   it under the terms of the GNU General Public License as published by
00010   the Free Software Foundation; either version 3 of the License, or
00011   (at your option) any later version.
00012   
00013   O2scl is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016   GNU General Public License for more details.
00017   
00018   You should have received a copy of the GNU General Public License
00019   along with O2scl. If not, see <http://www.gnu.org/licenses/>.
00020 
00021   -------------------------------------------------------------------
00022 */
00023 #ifndef O2SCL_TPTR_SCHEDULE_H
00024 #define O2SCL_TPTR_SCHEDULE_H
00025 
00026 #include <iostream>
00027 #include <o2scl/collection.h>
00028 #include <o2scl/ovector_tlate.h>
00029 
00030 #ifndef DOXYGENP
00031 namespace o2scl {
00032 #endif
00033 
00034   /** 
00035       \brief Simulated annealing temperature schedule base
00036 
00037       The schedules are designed to be used in the following way
00038 
00039       \code
00040       for(temper=tp->start(fmin,nvar,pb,NULL);
00041       tp->done(fmin,nvar,pb,NULL)==false;
00042       temper=tp->next(fmin,nvar,pb,NULL)) {
00043       }
00044       \endcode
00045 
00046   */
00047   template<class vec_t=ovector_view> class tptr_schedule {
00048 
00049     public:
00050     
00051     virtual ~tptr_schedule() {}
00052     
00053     /// Return the first temperature
00054     virtual double start(double min, int nv, const vec_t &best, void *vp) 
00055     { return 0.0; }
00056     
00057     /// Return the next temperature
00058     virtual double next(double min, int nv, const vec_t &best, void *vp) 
00059     { return 0.0; }
00060     
00061     /// Return true if the last step made the temperature too small
00062     virtual bool done(double min, int nv, const vec_t &best, void *vp) 
00063     { return true; }
00064     
00065     /// Return string denoting type ("tptr_schedule")
00066     virtual const char *type() { return "tptr_schedule"; }
00067   };
00068   
00069 #ifndef DOXYGENP
00070 }
00071 #endif
00072 
00073 #endif
00074 

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page