def test_cut_is_correct_facet_fme(self): m = models.grossmann_oneDisj() TransformationFactory('gdp.cuttingplane').apply_to( m, create_cuts=create_cuts_fme, post_process_cut=None) cuts = m._pyomo_gdp_cuttingplane_transformation.cuts # ESJ: Again, for FME, we don't mind getting both the possible facets, # as long as they are beautiful. self.assertEqual(len(cuts), 2) # similar to the two boxes example, this is on the line where two facets # intersect facet2_extreme_points = [ (1,0,2,10), (1,0,2,7), (0,1,10,0), (0,1,10,3) ] facet_extreme_points = [ (1,0,2,10), (1,0,0,10), (0,1,8,3), (0,1,10,3) ] for pt in facet_extreme_points: m.x.fix(pt[2]) m.y.fix(pt[3]) m.disjunct1.indicator_var.fix(pt[0]) m.disjunct2.indicator_var.fix(pt[1]) self.assertEqual(value(cuts[0].lower), value(cuts[0].body)) for pt in facet2_extreme_points: m.x.fix(pt[2]) m.y.fix(pt[3]) m.disjunct1.indicator_var.fix(pt[0]) m.disjunct2.indicator_var.fix(pt[1]) self.assertEqual(value(cuts[1].lower), value(cuts[1].body))
def test_cut_is_correct_facet_inf_norm(self): m = models.grossmann_oneDisj() # without the increase of cut_filtering_threshold, we get a third cut, # whcih is also tight where cut 2 is. It doesn't improve the objective # by much at all, so it's redundant. TransformationFactory('gdp.cuttingplane').apply_to( m, norm=float('inf'), cut_filtering_threshold=0.2) self.check_cut_is_correct_facet(m)
def test_cut_is_correct_facet_projection(self): m = models.grossmann_oneDisj() TransformationFactory('gdp.cuttingplane').apply_to(m) self.check_cut_is_correct_facet(m)
def test_cut_valid_at_extreme_pts_inf_norm(self): m = models.grossmann_oneDisj() TransformationFactory('gdp.cuttingplane').apply_to(m, norm=float('inf')) self.check_cuts_valid_at_extreme_pts(m)
def test_cut_valid_at_extreme_pts_projection(self): m = models.grossmann_oneDisj() TransformationFactory('gdp.cuttingplane').apply_to(m) self.check_cuts_valid_at_extreme_pts(m)
def test_cut_valid_at_extreme_pts_fme(self): m = models.grossmann_oneDisj() TransformationFactory('gdp.cuttingplane').apply_to( m, create_cuts=create_cuts_fme, post_process_cut=None) self.check_cuts_valid_at_extreme_pts(m)