Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tutorial example on symbolic control
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
Container 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
Girard Antoine
Tutorial example on symbolic control
Commits
6982ad85
Commit
6982ad85
authored
1 year ago
by
Girard Antoine
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
ac26ca84
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
symb_synth.m
+99
-0
99 additions, 0 deletions
symb_synth.m
with
99 additions
and
0 deletions
symb_synth.m
0 → 100644
+
99
−
0
View file @
6982ad85
%% Tutorial example on symbolic control
%% Author: Antoine GIRARD, Universit Paris-Saclay, CNRS, CentraleSuplec, Laboratoire des signaux et systmes, 91190, Gif-sur-Yvette, France.
%% Date: 2024
% Synthesis of a controller for the specification defined in specification.m
clear
load
(
'symb_abs.mat'
);
specification
;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Symbolic controller synthesis
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tic
disp
(
'Step 2: Symbolic controller synthesis'
)
% Labeling the states
Lab_xi
=
zeros
(
1
,
n_sigma
);
for
xi
=
1
:
n_xi
c_xi
=
state2coord
(
xi
,
p_x
);
x_c
=
bound_x
(:,
1
)
+
(
c_xi
-
0.5
)
.*
d_x
;
% Coordinates of the center of the cell
Lab_xi
(
xi
)
=
Lab_x
(
x_c
);
end
% Choice of a sucessor sample
g_p
=
zeros
(
n_s
,
n_xi
,
n_sigma
);
for
psi
=
1
:
n_s
g_p
(
psi
,:,:)
=
g
(:,:,
1
);
end
%Initialize the value function
V
=
inf
*
ones
(
n_s
,
n_xi
);
V
(
F_s
,:)
=
0
;
% final states
%Initialize the controller
h1
=@
(
psi
,
xi
)
A_s
(
psi
,
Lab_xi
(
xi
));
h2
=
zeros
(
n_s
,
n_xi
);
iter
=
0
;
fixpoint
=
0
;
while
~
fixpoint
iter
=
iter
+
1
;
fprintf
(
'Fixed point algorithm: iteration %d \n'
,
iter
);
Vp
=
V
;
for
xi
=
1
:
n_xi
for
psi
=
1
:
n_s
psi_succ
=
h1
(
psi
,
xi
);
if
V
(
psi
,
xi
)
==
inf
if
h2
(
psi_succ
,
xi
)
~=
0
V
(
psi
,
xi
)
=
iter
;
else
Vmax
=
zeros
(
1
,
n_sigma
);
for
sigma
=
1
:
n_sigma
xi_succ
=
g
(
xi
,
sigma
,:);
if
all
(
xi_succ
)
% the input is enabled
if
(
Vp
(
psi_succ
,
g_p
(
psi
,
xi
,
sigma
))
~=
inf
)
% the successor sample is controllable
c_min
=
state2coord
(
xi_succ
(
1
),
p_x
);
c_max
=
state2coord
(
xi_succ
(
2
),
p_x
);
if
c_min
(
3
)
<=
c_max
(
3
)
Q_succ
=
coordbox2state
(
c_min
,
c_max
,
grid_xi
)
'
;
else
%Special treatment of the third coordinate (angle)
%not needed in general
Q_succ
=
[
coordbox2state
(
c_min
,[
c_max
(
1
);
c_max
(
2
);
n_x
(
3
)],
grid_xi
)
'
,
...
coordbox2state
([
c_min
(
1
);
c_min
(
2
);
1
],
c_max
,
grid_xi
)
'
];
end
V_succ
=
Vp
(
psi_succ
,
Q_succ
);
% list of all successors
Vmax
(
sigma
)
=
all
(
V_succ
~=
inf
);
% check if all successors are controllable
if
Vmax
(
sigma
)
break
;
else
[
m
,
i_p
]
=
max
(
V_succ
~=
inf
);
g_p
(
psi
,
xi
,
sigma
)
=
Q_succ
(
i_p
);
end
end
end
end
if
any
(
Vmax
)
% controllable if there exists an input such that all sucessors are controllable
V
(
psi
,
xi
)
=
iter
;
[
m
,
sigma
]
=
max
(
Vmax
);
h2
(
psi_succ
,
xi
)
=
sigma
;
end
end
end
end
end
fixpoint
=
isequal
(
Vp
,
V
);
end
disp
(
'Fixed point reached'
)
toc
save
(
'symb_synth.mat'
);
\ No newline at end of file
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