Skip to content
Snippets Groups Projects
Commit 5b70ef42 authored by chsieh16's avatar chsieh16
Browse files

Clean up print messages

parent 0f06ebb9
No related branches found
No related tags found
No related merge requests found
...@@ -124,8 +124,6 @@ class DTreeLearner(LearnerBase): ...@@ -124,8 +124,6 @@ class DTreeLearner(LearnerBase):
def add_positive_examples(self, *args) -> None: def add_positive_examples(self, *args) -> None:
feature_vec_list = [self._s2f_func(sample) for sample in args] 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") self._append_to_data_file(feature_vec_list, "true")
def add_negative_examples(self, *args) -> None: def add_negative_examples(self, *args) -> None:
...@@ -134,7 +132,6 @@ class DTreeLearner(LearnerBase): ...@@ -134,7 +132,6 @@ class DTreeLearner(LearnerBase):
self.count_neg_dup += 1 self.count_neg_dup += 1
raise ValueError("repeated negative example: " + str(samp)) raise ValueError("repeated negative example: " + str(samp))
perc_samp = tuple(self._s2f_func(samp)) perc_samp = tuple(self._s2f_func(samp))
print(tuple(perc_samp))
if perc_samp in self.debug_neg_perc: if perc_samp in self.debug_neg_perc:
raise ValueError("repeated negative example: " + str(perc_samp)) raise ValueError("repeated negative example: " + str(perc_samp))
self.debug_neg_perc.add(perc_samp) self.debug_neg_perc.add(perc_samp)
......
...@@ -45,7 +45,7 @@ def test_synth_dtree(): ...@@ -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 # 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]) 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=50) synth_dtree(positive_examples, teacher, num_max_iterations=10)
def synth_dtree(positive_examples, teacher, num_max_iterations: int = 10): 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): ...@@ -60,6 +60,7 @@ def synth_dtree(positive_examples, teacher, num_max_iterations: int = 10):
past_candidate_list = [] past_candidate_list = []
for k in range(num_max_iterations): for k in range(num_max_iterations):
print("="*80)
print(f"Iteration {k}:", sep='') print(f"Iteration {k}:", sep='')
print("learning ....") print("learning ....")
...@@ -71,7 +72,7 @@ def synth_dtree(positive_examples, teacher, num_max_iterations: int = 10): ...@@ -71,7 +72,7 @@ def synth_dtree(positive_examples, teacher, num_max_iterations: int = 10):
# QUERYING TEACHER IF THERE ARE NEGATIVE EXAMPLES # QUERYING TEACHER IF THERE ARE NEGATIVE EXAMPLES
result = teacher.check(candidate) result = teacher.check(candidate)
print(result) print(f"Satisfiability: {result}")
if result == z3.sat: if result == z3.sat:
negative_examples = teacher.model() negative_examples = teacher.model()
assert len(negative_examples) > 0 assert len(negative_examples) > 0
......
...@@ -34,7 +34,6 @@ class DTreeGEMStanleyGurobiTeacher(GEMStanleyGurobiTeacher): ...@@ -34,7 +34,6 @@ class DTreeGEMStanleyGurobiTeacher(GEMStanleyGurobiTeacher):
raise RuntimeError("Only support affine expressions.") raise RuntimeError("Only support affine expressions.")
def _set_candidate(self, conjunct: sympy.logic.boolalg.Boolean) -> None: def _set_candidate(self, conjunct: sympy.logic.boolalg.Boolean) -> None:
print(conjunct)
# Variable Aliases # Variable Aliases
m = self._gp_model m = self._gp_model
...@@ -95,7 +94,6 @@ class DTreeGEMStanleyGurobiTeacher(GEMStanleyGurobiTeacher): ...@@ -95,7 +94,6 @@ class DTreeGEMStanleyGurobiTeacher(GEMStanleyGurobiTeacher):
self._gp_model.optimize() self._gp_model.optimize()
if self._gp_model.status in [gp.GRB.OPTIMAL, gp.GRB.SUBOPTIMAL]: 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) cex = tuple(self._old_state.x) + tuple(self._percept.x)
self._cexs.append(cex) self._cexs.append(cex)
elif self._gp_model.status == gp.GRB.INFEASIBLE: elif self._gp_model.status == gp.GRB.INFEASIBLE:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment