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

cqetraces.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_ETRACES_H
00033 #define C_ETRACES_H
00034 
00035 #include "cparameters.h"
00036 
00037 class CAbstractQFunction;
00038 class CQFunction;
00039 class CComposedQFunction;
00040 class CGradientQFunction;
00041 
00042 class CAction;
00043 class CActionData;
00044 class CStateCollection;
00045 class CAbstractVETraces;
00046 
00047 class CFeatureList;
00049 
00060 class CAbstractQETraces : virtual public CParameterObject 
00061 {
00062 protected:
00064         CAbstractQFunction *qFunction;
00065 
00066 public:
00067         CAbstractQETraces(CAbstractQFunction *qFunction);
00068         virtual ~CAbstractQETraces() {};
00069 
00071         virtual void resetETraces() = 0;
00073 
00077         virtual void updateETraces(CAction *action, CActionData *data = NULL) = 0;
00079         virtual void addETrace(CStateCollection *State, CAction *action, double factor = 1.0, CActionData *data = NULL) = 0;
00080 
00082         virtual void updateQFunction(double td) = 0;
00083  
00085         virtual void setLambda(double lambda);
00087         virtual double getLambda();
00088 
00090         virtual void setReplacingETraces(bool bReplace);
00092         virtual bool getReplacingETraces();
00093 };
00094 
00096 
00104 class CQETraces : public CAbstractQETraces
00105 {
00106 protected:
00108         std::list<CAbstractVETraces *> *vETraces;
00110         CQFunction *qExFunction;
00111 
00112 public:
00114 
00117         CQETraces(CQFunction *qfunction);
00118         virtual ~CQETraces();
00119 
00121         virtual void resetETraces();
00123         virtual void addETrace(CStateCollection *State, CAction *action, double factor = 1.0, CActionData *data = NULL);
00125 
00130         virtual void updateETraces(CAction *action, CActionData *data = NULL);
00131 
00133 
00136         virtual void updateQFunction(double td);
00137 
00139 
00145         void setVETrace(CAbstractVETraces *vEtrace, int index, bool bDeleteOld = true);
00147         CAbstractVETraces *getVETrace(int index);
00148 
00150         virtual void setReplacingETraces(bool bReplace);
00151 };
00152 
00154 
00157 class CComposedQETraces : public CAbstractQETraces
00158 {
00159 protected:
00161         std::list<CAbstractQETraces *> *qETraces;
00163         CComposedQFunction *qCompFunction;
00164 
00165 public:
00166 
00167         CComposedQETraces(CComposedQFunction *qfunction);
00168         virtual ~CComposedQETraces();
00169 
00170 
00171         virtual void resetETraces();
00172         virtual void addETrace(CStateCollection *State, CAction *action, double factor = 1.0, CActionData *data = NULL);
00173         
00174         virtual void updateETraces(CAction *action, CActionData *data = NULL);
00175         virtual void updateQFunction(double td);
00176 
00177         void setQETrace(CAbstractQETraces *qEtrace, int index, bool bDeleteOld = true);
00178 
00180         CAbstractQETraces *getQETrace(int index);
00181 
00183         virtual void setReplacingETraces(bool bReplace);
00184 };
00185 
00186 
00187 
00189 
00204 class CGradientQETraces : public CAbstractQETraces
00205 {
00206 protected:
00207         CGradientQFunction *gradientQFunction;
00208         CFeatureList *eTrace;
00209         CFeatureList *gradient;
00210 
00211 public:
00212 
00213         CGradientQETraces(CGradientQFunction *qfunction);
00214         virtual ~CGradientQETraces();
00215 
00217         virtual void resetETraces();
00218 
00220         virtual void addETrace(CStateCollection *State, CAction *action, double factor = 1.0, CActionData *data = NULL);
00221 
00223 
00226         virtual void addGradientETrace(CFeatureList *gradient, double factor = 1.0);
00227 
00229         virtual void updateETraces(CAction *action, CActionData *data = NULL);
00231         virtual void updateQFunction(double td);
00232         
00234         CFeatureList *getGradientETraces() {return eTrace;};
00235 };
00236 
00237 #endif
00238