Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs598mp-fall2021-proj
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
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
chsieh16
cs598mp-fall2021-proj
Commits
a2f19d65
Commit
a2f19d65
authored
2 years ago
by
chsieh16
Browse files
Options
Downloads
Patches
Plain Diff
Ask teacher to check positive examples
parent
bb5a5877
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gem_stanley_teacher.py
+23
-0
23 additions, 0 deletions
gem_stanley_teacher.py
teacher_base.py
+4
-0
4 additions, 0 deletions
teacher_base.py
with
27 additions
and
0 deletions
gem_stanley_teacher.py
+
23
−
0
View file @
a2f19d65
...
...
@@ -87,6 +87,29 @@ class GEMStanleyGurobiTeacher(GurobiTeacherBase):
super
().
__init__
(
name
=
name
,
state_dim
=
3
,
perc_dim
=
2
,
ctrl_dim
=
1
,
norm_ord
=
norm_ord
)
def
is_positive_example
(
self
,
ex
)
->
bool
:
assert
len
(
ex
)
==
self
.
state_dim
+
self
.
perc_dim
def
g
(
cte
,
phi
):
error
=
phi
+
np
.
arctan
(
K_P
*
cte
/
FORWARD_VEL
)
steer
=
np
.
clip
(
error
,
-
STEERING_LIM
,
STEERING_LIM
)
return
(
steer
,)
def
f
(
x
,
y
,
theta
,
steer
):
new_x
=
x
+
FORWARD_VEL
*
np
.
cos
(
theta
+
steer
)
*
CYCLE_TIME
new_y
=
y
+
FORWARD_VEL
*
np
.
sin
(
theta
+
steer
)
*
CYCLE_TIME
new_theta
=
theta
+
FORWARD_VEL
*
np
.
sin
(
steer
)
/
WHEEL_BASE
*
CYCLE_TIME
return
new_x
,
new_y
,
new_theta
def
v
(
x
,
y
,
theta
)
->
float
:
return
np
.
linalg
.
norm
([
y
,
theta
],
ord
=
float
(
self
.
_norm_ord
))
def
spec
(
x
,
y
,
theta
,
d
,
phi
)
->
bool
:
v_old
=
v
(
x
,
y
,
theta
)
v_new
=
v
(
*
f
(
x
,
y
,
theta
,
*
g
(
d
,
phi
)))
return
v_new
<=
v_old
return
spec
(
*
ex
)
def
_add_system
(
self
)
->
None
:
# Bounds on all domains
self
.
_old_state
.
lb
=
(
-
np
.
inf
,
-
CTE_LIM
,
-
ANG_LIM
)
...
...
This diff is collapsed.
Click to expand it.
teacher_base.py
+
4
−
0
View file @
a2f19d65
...
...
@@ -13,6 +13,10 @@ class TeacherBase(abc.ABC):
def
__init__
(
self
)
->
None
:
pass
@abc.abstractmethod
def
is_positive_example
(
self
,
ex
)
->
bool
:
raise
NotImplementedError
@abc.abstractmethod
def
check
(
self
,
candidate
:
sympy
.
logic
.
boolalg
.
Boolean
)
->
z3
.
CheckSatResult
:
raise
NotImplementedError
...
...
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