Skip to content
Snippets Groups Projects
Commit 1359c0cd authored by chsieh16's avatar chsieh16
Browse files

Add code to validate candidate DNF with teacher

parent 8d310c51
No related branches found
No related tags found
No related merge requests found
import pickle
import gurobipy as gp
import numpy as np
from gem_stanley_teacher import GEMStanleyTeacher
......@@ -28,6 +31,9 @@ class DTreeTeacherGEMStanley(GEMStanleyTeacher):
cons = m.addMConstr(coeff_mat, z_diff, '<', cut_vec)
self._prev_candidate_constr.append(cons)
# L2-norm objective
m.setObjective(z_diff @ z_diff, gp.GRB.MINIMIZE)
def test_dtree_gem_stanley_teacher():
a_mat = np.array([[0., -1., 0.],
......@@ -47,5 +53,18 @@ def test_dtree_gem_stanley_teacher():
teacher.dump_model()
def test_verified_candidate():
with open("winnerDnf.pickle", "rb") as dnf_pkl:
winner_dnf = pickle.load(dnf_pkl)
print(winner_dnf)
teacher = DTreeTeacherGEMStanley()
teacher.set_old_state_bound(lb=[0.0, -1.0, 0.2], ub=[30.0, -0.9, 0.22])
for cand in winner_dnf:
print(teacher.check(cand))
print(teacher.reason_unknown())
if __name__ == "__main__":
test_dtree_gem_stanley_teacher()
# test_dtree_gem_stanley_teacher()
test_verified_candidate()
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