-
Notifications
You must be signed in to change notification settings - Fork 0
/
maze_markov_bellman.h
73 lines (50 loc) · 3.11 KB
/
maze_markov_bellman.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef _MAZE_MARKOV_BELLMAN_H
#define _MAZE_MARKOV_BELLMAN_H
#include "maze_markov.h"
#define MAZE_MARKOV_BELLMAN_GAMMA 0.99f
struct maze_markov_bellman_vlist
{
struct maze_markov_state *state;
float cost;
struct maze_markov_bellman_vlist *next;
};
struct maze_markov_bellman_node
{
enum maze_markov_action action;
float cost;
struct maze_markov_bellman_node *next;
};
struct maze_markov_bellman_list
{
struct maze_markov_state *state;
struct maze_markov_bellman_node *list;
struct maze_markov_bellman_list *next;
};
struct maze_markov_bellman_policy
{
struct maze_markov_state *state;
enum maze_markov_action action;
float cost;
struct maze_markov_bellman_policy *next;
};
struct maze_markov_bellman_vlist *maze_markov_bellman_vlist_create(struct maze_markov_state *s,float c,struct maze_markov_bellman_vlist *l);
void maze_markov_bellman_vlist_destroy(struct maze_markov_bellman_vlist *l);
__inline__ float maze_markov_bellman_get_action_cost(struct maze_markov_transition_list *l,struct maze_markov_bellman_vlist *prec);
struct maze_markov_bellman_node *maze_markov_bellman_node_create(struct maze_markov_state *s,enum maze_markov_action a,struct maze_markov_bellman_vlist *vstar,struct maze_markov_bellman_node *n);
struct maze_markov_bellman_node *maze_markov_bellman_node_default_create(struct maze_markov_state *s,enum maze_markov_action a,float cost,struct maze_markov_bellman_node *n);
void maze_markov_bellman_node_destroy(struct maze_markov_bellman_node *v);
struct maze_markov_bellman_list *maze_markov_bellman_list_create(struct maze_markov_state *s,struct maze_markov_bellman_node *l,struct maze_markov_bellman_list *n);
void maze_markov_bellman_list_destroy(struct maze_markov_bellman_list *l);
struct maze_markov_bellman_policy *maze_markov_bellman_policy_create(struct maze_markov_state *s,enum maze_markov_action a,float c,struct maze_markov_bellman_policy *n);
void maze_markov_bellman_policy_destroy(struct maze_markov_bellman_policy *l);
int maze_markov_bellman_policy_compare(struct maze_markov_bellman_policy *p1,struct maze_markov_bellman_policy *p2);
enum maze_markov_action maze_markov_bellman_policy_get_action(struct maze_markov_state *s,struct maze_markov_bellman_policy *p);
struct maze_markov_bellman_vlist *maze_markov_bellman_policy_vlist_wrapper(struct maze_markov_bellman_policy *p);
void maze_markov_bellman_qlist_set_cost(struct maze_markov_bellman_list *l,struct maze_markov_state *s,enum maze_markov_action a,float val);
float maze_markov_bellman_qlist_get_cost(struct maze_markov_bellman_list *l,struct maze_markov_state *s,enum maze_markov_action a);
struct maze_markov_bellman_list *maze_markov_bellman_default_qlist_create(struct maze_markov_decision_process *mdp, float defcost);
struct maze_markov_bellman_list *maze_markov_bellman_qlist_create(struct maze_markov_decision_process *mdp,struct maze_markov_bellman_vlist *vstar);
struct maze_markov_bellman_policy *maze_markov_bellman_optimal_policy_create(struct maze_markov_bellman_list *qlist);
void maze_markov_bellman_list_display(struct maze_markov_bellman_list *l);
void maze_markov_bellman_policy_display(struct maze_markov_bellman_policy *l);
#endif