imm-reward.h
Go to the documentation of this file.
00001 /*  imm-reward.h
00002 
00003   *****
00004   Copyright 1994-1997, Brown University
00005   Copyright 1998, 1999, Anthony R. Cassandra
00006 
00007                            All Rights Reserved
00008                            
00009   Permission to use, copy, modify, and distribute this software and its
00010   documentation for any purpose other than its incorporation into a
00011   commercial product is hereby granted without fee, provided that the
00012   above copyright notice appear in all copies and that both that
00013   copyright notice and this permission notice appear in supporting
00014   documentation.
00015   
00016   ANTHONY CASSANDRA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
00017   INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ANY
00018   PARTICULAR PURPOSE.  IN NO EVENT SHALL ANTHONY CASSANDRA BE LIABLE FOR
00019   ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00020   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00021   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00022   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00023   *****
00024 
00025     Header file for imm-reward.c
00026 */
00027 #ifndef IMM_REWARD_H
00028 
00029 #define IMM_REWARD_H
00030 
00031 #include "sparse-matrix.h"
00032 
00033 
00034 /*
00035    We will represent the general immediate reward structure as a
00036 linked list, where each node of the list will correspond to a single
00037 R: * : ... entry.  The entry from the file could specify a single
00038 value, a row of values, or an entire matrix.  Thus we need three
00039 different representations depending on the situation.  Additionally,
00040 all of the components could have a wildcard character indicating 
00041 that it is a specification for a family of values.  This is indicated
00042 with special characters.
00043 
00044 */
00045 
00046 /* Each of the action, states and obs could have a state index number,
00047   or one of these two values.  Since states cannot be negative we use
00048   negative values for the special characters.  The observation cannot
00049   be present when the next_state is present, but this should be
00050   enforced by the parser.  When both the next state and obs are not
00051   present, we will use a sparse matrix representation.  When only the
00052   obs is not present we will use a single dimensional, non-sparse
00053   matrix.  When both are specified we use a single value.  Note that
00054   it does not matter if the indivdual elements are specific indices or
00055   a wildcard, either way we will store a single value.
00056 
00057 */
00058 
00059 #define WILDCARD_SPEC                -1
00060 #define NOT_PRESENT                  -99
00061 
00062 /* This allows us to easily check what type of entry it is, since */
00063 /* there are three possibilities. */
00064 typedef enum { ir_none, ir_value, ir_vector, ir_matrix } IR_Type;
00065 
00066 typedef struct Imm_Reward_Node_Struct *Imm_Reward_List;
00067 struct Imm_Reward_Node_Struct {
00068 
00069   IR_Type type;
00070 
00071   int action;
00072   int cur_state;
00073   int next_state;
00074   int obs;
00075 
00076   union rep_tag {
00077      REAL_VALUE value;
00078      REAL_VALUE *vector;
00079      Matrix matrix;
00080   } rep;
00081 
00082   Imm_Reward_List next;
00083 };
00084 
00085 #ifdef __cplusplus
00086 extern "C" {
00087 #endif
00088 
00089 extern void destroyImmRewards();
00090 extern void newImmReward( int action, int cur_state, int next_state, int obs );
00091 extern void enterImmReward( int cur_state, int next_state, int obs, 
00092                            REAL_VALUE value );
00093 extern void doneImmReward();
00094 extern REAL_VALUE getImmediateReward( int action, int cur_state, int
00095                                  next_state, int obs );
00096                                  
00097 #ifdef __cplusplus
00098 }  /* extern "C" */
00099 #endif
00100 
00101 #endif


appl
Author(s): petercai
autogenerated on Tue Jan 7 2014 11:02:29