Reinforcement Learning Toolbox 2.0
last updated:
General
Documentation
Manual
Tutorial
Class Reference
Master Thesis
Examples
Related Papers
Downloads
Links
News
mailto:webmaster
Main Page     Class Hierarchy   Compound List   File List   Compound Members   File Members

cvetraces.h

Go to the documentation of this file.
00001 // Copyright (C) 2003
00002 // Gerhard Neumann (gneumann@gmx.net)
00003 // Stephan Neumann (sneumann@gmx.net) 
00004 //                
00005 // This file is part of RL Toolbox.
00006 // http://www.igi.tugraz.at/ril_toolbox
00007 //
00008 // All rights reserved.
00009 // 
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions
00012 // are met:
00013 // 1. Redistributions of source code must retain the above copyright
00014 //    notice, this list of conditions and the following disclaimer.
00015 // 2. Redistributions in binary form must reproduce the above copyright
00016 //    notice, this list of conditions and the following disclaimer in the
00017 //    documentation and/or other materials provided with the distribution.
00018 // 3. The name of the author may not be used to endorse or promote products
00019 //    derived from this software without specific prior written permission.
00020 // 
00021 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00022 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00023 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00024 // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00025 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00026 // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00027 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00028 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00029 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00030 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031 
00032 #ifndef C_VETRACES__H
00033 #define C_VETRACES__H
00034 
00035 #include "cparameters.h"
00036 #include <list>
00037 
00038 class CAbstractVFunction;
00039 class CGradientVFunction;
00040 
00041 class CState;
00042 class CStateCollection;
00043 class CFeatureVFunction;
00044 class CFeatureList;
00045 class CStateProperties;
00046 class CStateCollectionList;
00047 class CStateCollectionImpl;
00048 class CStateModifier;
00049 
00051 
00072 class CAbstractVETraces : virtual public CParameterObject
00073 {
00074 protected:
00075 
00077         CAbstractVFunction *vFunction;
00079 public:
00081         CAbstractVETraces(CAbstractVFunction *vFunction);
00082 
00084         virtual void resetETraces() = 0;
00086         virtual void addETrace(CStateCollection *State, double factor = 1.0) = 0;
00088 
00092         virtual void updateETraces(int duration = 1) = 0;
00094 
00098         virtual void updateVFunction(double td) = 0;
00099  
00100         void setLambda(double lambda);
00101         double getLambda();
00102                 
00103         void setTreshold(double treshold);
00104         double getTreshold();
00105 
00107         void setReplacingETraces(bool bReplace);
00108         bool getReplacingETraces();
00109 
00110         CAbstractVFunction *getVFunction();
00111 };
00112 
00114 
00120 class CStateVETraces :  public CAbstractVETraces
00121 {
00122 protected:
00123         CStateCollectionList *eTraceStates;
00124         int eTraceLength;
00125         CStateCollectionImpl *bufState;
00126 
00127         std::list<double> *eTraces;
00128 public:
00129         
00130         CStateVETraces(CAbstractVFunction *vFunction, CStateProperties *modelState, std::list<CStateModifier *> *modifiers = NULL);
00131 
00132         virtual ~CStateVETraces();
00133 
00134         virtual void resetETraces();
00135         virtual void addETrace(CStateCollection *State, double factor = 1.0);
00136         virtual void updateETraces(int duration = 1);
00137         
00138         virtual void updateVFunction(double td);
00139 };
00140 
00142 
00155 class CGradientVETraces : public CAbstractVETraces
00156 {
00157 protected:
00158 
00160         CFeatureList *eFeatures;
00161         CFeatureList *tmpList;
00162 
00163         CGradientVFunction *gradientVFunction;
00164 
00165 public:
00166         CGradientVETraces(CGradientVFunction *gradientVFunction);
00167 
00168         virtual ~CGradientVETraces();
00169 
00171 
00174         virtual void resetETraces();
00176 
00179         virtual void addETrace(CStateCollection *State, double factor = 1.0);
00181 
00184         virtual void updateETraces(int duration = 1);
00185 
00186         virtual void multETraces(double factor);
00187         
00189 
00192         virtual void updateVFunction(double td);
00193 
00194         // Adds the current gradient to the etrace list
00198         virtual void addGradientETrace(CFeatureList *gradient, double factor);
00199 
00200         CFeatureList* getGradientETraces();
00201 
00202 };
00203 
00204 class CFeatureVFunction;
00205 
00206 
00208 
00213 class CFeatureVETraces : public CGradientVETraces
00214 {
00215 protected:
00216         CFeatureVFunction *featureVFunction;
00217         CStateProperties *featureProperties;
00218 
00219 
00220 public:
00221         CFeatureVETraces(CFeatureVFunction *gradientVFunction);
00222         CFeatureVETraces(CFeatureVFunction *gradientVFunction, CStateProperties *featureProperties);
00223 
00224 
00226         virtual void addETrace(CStateCollection *State, double factor = 1.0);
00227 };
00228 
00229 
00230 #endif
00231