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

cdiscretizer.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_DISCRETIZER__H
00033 #define C_DISCRETIZER__H
00034 
00035 #include "cstatemodifier.h"
00036 
00037 #include <map>
00038 
00040 
00051 class CAbstractStateDiscretizer : public CStateModifier
00052 {
00053 protected:
00055         std::map<int, std::pair<CStateModifier *, CState *>*> *stateSubstitutions;
00056 
00057 public:
00059         CAbstractStateDiscretizer(unsigned int numStates);
00060         virtual ~CAbstractStateDiscretizer();
00061 
00063         virtual unsigned int getDiscreteStateSize();
00065         virtual unsigned int getDiscreteStateNumber(CStateCollection *state) = 0;       
00066 
00068 
00073         virtual void getModifiedState(CStateCollection *originalState, CState *modifiedState);
00074 
00076         virtual void addStateSubstitution(int discState, CStateModifier *modifier);
00078         virtual void removeStateSubstitution(int discState);
00079 };
00080 
00082 
00086 class CModelStateDiscretizer : public CAbstractStateDiscretizer
00087 {
00088 protected:
00089         CStateProperties *originalState;
00090         unsigned int numDiscStateVar;
00091         int *discreteStates;
00092 
00093         unsigned int calcDiscreteStateSize(CStateProperties *prop, int *discreteStates, unsigned int num);
00094 
00095 public:
00097 
00102         CModelStateDiscretizer(CStateProperties *properties, int *discretStates = NULL, unsigned int numDiscreteStates = 0);
00103         virtual ~CModelStateDiscretizer();
00104 
00106         virtual unsigned int getDiscreteStateNumber(CStateCollection *state);   
00107 };
00108 
00110 
00117 class CSingleStateDiscretizer : public CAbstractStateDiscretizer
00118 {
00119 protected:
00121         int dimension;
00122         int numPartitions;
00123         double *partitions;
00124 
00126         CStateProperties *originalState;
00127 
00128 public:
00129         CSingleStateDiscretizer(int dimension, int numPartitions, double *partitions);
00130         virtual ~CSingleStateDiscretizer();
00132         virtual unsigned int getDiscreteStateNumber(CStateCollection *state);   
00134         virtual void setOriginalState(CStateProperties *originalState);
00135 };
00136 
00138 
00144 class CDiscreteStateOperatorAnd : public CStateMultiModifier, public CAbstractStateDiscretizer
00145 {
00146 public:
00147         CState *stateBuf;
00148 
00149 public:
00150         CDiscreteStateOperatorAnd();
00151         virtual ~CDiscreteStateOperatorAnd();
00153         virtual unsigned int getDiscreteStateNumber(CStateCollection *state);
00154 
00156         virtual void addStateModifier(CAbstractStateDiscretizer *featCalc);
00157 };
00158 
00159 #endif
00160