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

Move testcase for DReal teacher

parent e1643d10
No related branches found
No related tags found
No related merge requests found
......@@ -51,3 +51,30 @@ class GEMStanleyDRealTeacher(DRealTeacherBase):
self._not_inv_cons.extend([
old_err <= new_err
])
def test_gem_stanley_dreal_teacher():
a_mat = np.asfarray([[0, -1, 0],
[0, 0, -1]])
b_vec = np.zeros(2)
coeff_mat = np.array([
[-1, -1],
[-1, 1],
[1, -1],
[1, 1],
])
cut_vec = np.array([0.05, 0.05, 0.05, 0.05])
teacher = GEMStanleyDRealTeacher(norm_ord=1, delta=0.01)
teacher.set_old_state_bound(
lb=(-np.inf, 0.5, 0.0),
ub=(np.inf, 1.2, np.pi/12)
)
# teacher.dump_model()
res = teacher.check((a_mat, b_vec, coeff_mat, cut_vec))
print(res)
if __name__ == "__main__":
test_gem_stanley_dreal_teacheri()
......@@ -4,7 +4,6 @@ import numpy as np
import sympy
import z3
from gem_stanley_dreal_teacher import GEMStanleyDRealTeacher
from teacher_base import SymPyTeacherBase
from dtree_teacher_base import DTreeGurobiTeacherBase
......@@ -227,28 +226,6 @@ class GEMStanleySymPyTeacher(SymPyTeacherBase):
])
def test_gem_stanley_dreal_teacher():
a_mat = np.asfarray([[0, -1, 0],
[0, 0, -1]])
b_vec = np.zeros(2)
coeff_mat = np.array([
[-1, -1],
[-1, 1],
[1, -1],
[1, 1],
])
cut_vec = np.array([0.05, 0.05, 0.05, 0.05])
teacher = GEMStanleyDRealTeacher(norm_ord=1, delta=0.01)
teacher.set_old_state_bound(
lb=(-np.inf, 0.5, 0.0),
ub=(np.inf, 1.2, np.pi/12)
)
# teacher.dump_model()
res = teacher.check((a_mat, b_vec, coeff_mat, cut_vec))
print(res)
def test_gem_stanley_sympy_teacher():
teacher = GEMStanleySymPyTeacher(norm_ord=2)
teacher.set_old_state_bound(
......
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