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
5b70ef42
Commit
5b70ef42
authored
2 years ago
by
chsieh16
Browse files
Options
Downloads
Patches
Plain Diff
Clean up print messages
parent
0f06ebb9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dtree_learner.py
+0
-3
0 additions, 3 deletions
dtree_learner.py
dtree_synth.py
+3
-2
3 additions, 2 deletions
dtree_synth.py
dtree_teacher_gem_stanley.py
+0
-2
0 additions, 2 deletions
dtree_teacher_gem_stanley.py
with
3 additions
and
7 deletions
dtree_learner.py
+
0
−
3
View file @
5b70ef42
...
...
@@ -124,8 +124,6 @@ class DTreeLearner(LearnerBase):
def
add_positive_examples
(
self
,
*
args
)
->
None
:
feature_vec_list
=
[
self
.
_s2f_func
(
sample
)
for
sample
in
args
]
print
(
"
Positive feature vectors:
"
,
feature_vec_list
)
self
.
_append_to_data_file
(
feature_vec_list
,
"
true
"
)
def
add_negative_examples
(
self
,
*
args
)
->
None
:
...
...
@@ -134,7 +132,6 @@ class DTreeLearner(LearnerBase):
self
.
count_neg_dup
+=
1
raise
ValueError
(
"
repeated negative example:
"
+
str
(
samp
))
perc_samp
=
tuple
(
self
.
_s2f_func
(
samp
))
print
(
tuple
(
perc_samp
))
if
perc_samp
in
self
.
debug_neg_perc
:
raise
ValueError
(
"
repeated negative example:
"
+
str
(
perc_samp
))
self
.
debug_neg_perc
.
add
(
perc_samp
)
...
...
This diff is collapsed.
Click to expand it.
dtree_synth.py
+
3
−
2
View file @
5b70ef42
...
...
@@ -45,7 +45,7 @@ def test_synth_dtree():
# 0.0 <= x <= 30.0 and -1.0 <= y <= 0.9 and 0.2 <= theta <= 0.22
teacher
.
set_old_state_bound
(
lb
=
[
0.0
,
-
1.0
,
0.2
],
ub
=
[
30.0
,
-
0.9
,
0.22
])
synth_dtree
(
positive_examples
,
teacher
,
num_max_iterations
=
5
0
)
synth_dtree
(
positive_examples
,
teacher
,
num_max_iterations
=
1
0
)
def
synth_dtree
(
positive_examples
,
teacher
,
num_max_iterations
:
int
=
10
):
...
...
@@ -60,6 +60,7 @@ def synth_dtree(positive_examples, teacher, num_max_iterations: int = 10):
past_candidate_list
=
[]
for
k
in
range
(
num_max_iterations
):
print
(
"
=
"
*
80
)
print
(
f
"
Iteration
{
k
}
:
"
,
sep
=
''
)
print
(
"
learning ....
"
)
...
...
@@ -71,7 +72,7 @@ def synth_dtree(positive_examples, teacher, num_max_iterations: int = 10):
# QUERYING TEACHER IF THERE ARE NEGATIVE EXAMPLES
result
=
teacher
.
check
(
candidate
)
print
(
result
)
print
(
f
"
Satisfiability:
{
result
}
"
)
if
result
==
z3
.
sat
:
negative_examples
=
teacher
.
model
()
assert
len
(
negative_examples
)
>
0
...
...
This diff is collapsed.
Click to expand it.
dtree_teacher_gem_stanley.py
+
0
−
2
View file @
5b70ef42
...
...
@@ -34,7 +34,6 @@ class DTreeGEMStanleyGurobiTeacher(GEMStanleyGurobiTeacher):
raise
RuntimeError
(
"
Only support affine expressions.
"
)
def
_set_candidate
(
self
,
conjunct
:
sympy
.
logic
.
boolalg
.
Boolean
)
->
None
:
print
(
conjunct
)
# Variable Aliases
m
=
self
.
_gp_model
...
...
@@ -95,7 +94,6 @@ class DTreeGEMStanleyGurobiTeacher(GEMStanleyGurobiTeacher):
self
.
_gp_model
.
optimize
()
if
self
.
_gp_model
.
status
in
[
gp
.
GRB
.
OPTIMAL
,
gp
.
GRB
.
SUBOPTIMAL
]:
print
(
f
"
ObjValue:
{
self
.
_gp_model
.
getObjective
().
getValue
()
}
"
)
cex
=
tuple
(
self
.
_old_state
.
x
)
+
tuple
(
self
.
_percept
.
x
)
self
.
_cexs
.
append
(
cex
)
elif
self
.
_gp_model
.
status
==
gp
.
GRB
.
INFEASIBLE
:
...
...
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