Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProjetZZ1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marc BERET
ProjetZZ1
Commits
0a42530f
Commit
0a42530f
authored
2 years ago
by
maberet
Browse files
Options
Downloads
Patches
Plain Diff
commit pour récup des fonctions lagrange
parent
b275e90e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
travail_de_groupe/jeu_appren_par_renfo/src/qlearn.c
+25
-3
25 additions, 3 deletions
travail_de_groupe/jeu_appren_par_renfo/src/qlearn.c
travail_de_groupe/jeu_appren_par_renfo/src/qlearn.h
+6
-0
6 additions, 0 deletions
travail_de_groupe/jeu_appren_par_renfo/src/qlearn.h
with
31 additions
and
3 deletions
travail_de_groupe/jeu_appren_par_renfo/src/qlearn.c
+
25
−
3
View file @
0a42530f
...
@@ -6,7 +6,7 @@ agent_t * initAgent (){
...
@@ -6,7 +6,7 @@ agent_t * initAgent (){
printf
(
"erreur alloc
\n
"
);
printf
(
"erreur alloc
\n
"
);
exit
(
1
);
exit
(
1
);
}
}
agent
->
x
=
(
16
+
rand
()
%
1
6
)
*
BLOCK_SIZE
;
agent
->
x
=
(
16
+
rand
()
%
1
4
)
*
BLOCK_SIZE
;
agent
->
y
=
(
1
+
rand
()
%
14
)
*
BLOCK_SIZE
;
agent
->
y
=
(
1
+
rand
()
%
14
)
*
BLOCK_SIZE
;
agent
->
high
=
2
*
BLOCK_SIZE
;
agent
->
high
=
2
*
BLOCK_SIZE
;
agent
->
weight
=
2
*
BLOCK_SIZE
;
agent
->
weight
=
2
*
BLOCK_SIZE
;
...
@@ -92,7 +92,6 @@ float ***** allocateAndInitiateQ(){
...
@@ -92,7 +92,6 @@ float ***** allocateAndInitiateQ(){
return
q
;
return
q
;
}
}
// attention il manque 3 lignes
void
writeQ
(
float
*****
Q
){
void
writeQ
(
float
*****
Q
){
int
i
,
j
,
k
,
l
,
m
;
int
i
,
j
,
k
,
l
,
m
;
FILE
*
fp
=
fopen
(
"q.txt"
,
"w+"
);
FILE
*
fp
=
fopen
(
"q.txt"
,
"w+"
);
...
@@ -247,6 +246,29 @@ int setReward(int xAgent, int yAgent, int dropZone){
...
@@ -247,6 +246,29 @@ int setReward(int xAgent, int yAgent, int dropZone){
reward
=
1
;
reward
=
1
;
}
}
return
(
reward
);
return
(
reward
);
}
}
float
defineAngle
(
int
xCanon
,
int
yCanon
,
int
xDropPoint
,
int
yDropPoint
){
float
distance
;
float
angleSin
;
distance
=
sqrtf
(
powf
((
float
)(
xDropPoint
-
xCanon
),
2
)
+
powf
((
float
)(
yDropPoint
-
yCanon
),
2
));
angleSin
=
asinf
(
distance
/
(
xDropPoint
-
xCanon
));
return
angleSin
;
}
void
traningAgent
(
int
numberRun
,
int
numberStep
,
float
*****
Q
)
{
int
i
;
int
action
;
point_t
canon
;
point_t
dropPoint
;
while
(
numberRun
>
0
){
canon
=
initPoint
(
0
);
dropPoint
=
initPoint
(
1
);
for
(
i
=
0
;
i
<
numberStep
;
i
++
){
}
}
}
This diff is collapsed.
Click to expand it.
travail_de_groupe/jeu_appren_par_renfo/src/qlearn.h
+
6
−
0
View file @
0a42530f
...
@@ -37,6 +37,12 @@ typedef struct line {
...
@@ -37,6 +37,12 @@ typedef struct line {
}
line_t
,
*
ptline_t
;
}
line_t
,
*
ptline_t
;
typedef
struct
point
{
int
x
;
int
y
;
}
point_t
;
agent_t
*
initAgent
(
);
agent_t
*
initAgent
(
);
void
moveAgent
(
agent_t
*
agent
,
int
choice
);
void
moveAgent
(
agent_t
*
agent
,
int
choice
);
float
*****
allocateAndInitiateQ
();
float
*****
allocateAndInitiateQ
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment