From 4b9976b224438550bdc3bfa43d8f092438c90225 Mon Sep 17 00:00:00 2001 From: Michael Bynum Date: Thu, 25 Mar 2021 10:08:11 -0600 Subject: [PATCH] renaming soc edge cuts class --- egret/models/ac_relaxations.py | 14 +++++++------- egret/models/tests/test_relaxations.py | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/egret/models/ac_relaxations.py b/egret/models/ac_relaxations.py index 3548a8c2..faf269e1 100644 --- a/egret/models/ac_relaxations.py +++ b/egret/models/ac_relaxations.py @@ -57,8 +57,8 @@ def _get_bounds(v): return lb, ub -@declare_custom_block(name='KocukSOCOverestimator') -class KocukSOCOverestimatorData(BaseRelaxationData): +@declare_custom_block(name='SOCEdgeCuts') +class SOCEdgeCutsData(BaseRelaxationData): """ Relaxation for @@ -210,7 +210,7 @@ def use_linear_relaxation(self): @use_linear_relaxation.setter def use_linear_relaxation(self, val): if val is not True: - raise ValueError('The KocukSOCOverestimator class can only produce linear relaxations') + raise ValueError('The SOCEdgeCuts class can only produce linear relaxations') self._use_linear_relaxation = True @@ -228,20 +228,20 @@ def create_soc_relaxation(model_data, use_linear_relaxation=True, include_feasib def create_atan_relaxation(model_data, use_linear_relaxation=True, include_feasibility_slack=False, - use_kocuk_soc_overestimators=False): + use_soc_edge_cuts=False): model, md = create_atan_acopf_model(model_data=model_data, include_feasibility_slack=include_feasibility_slack) del model.ineq_soc del model._con_ineq_soc - if use_kocuk_soc_overestimators: + if use_soc_edge_cuts: del model.ineq_soc_ub del model._con_ineq_soc_ub _relaxation_helper(model=model, md=md, include_soc=True, use_linear_relaxation=use_linear_relaxation) - if use_kocuk_soc_overestimators: + if use_soc_edge_cuts: branch_attrs = md.attributes(element_type='branch') bus_pairs = zip_items(branch_attrs['from_bus'], branch_attrs['to_bus']) unique_bus_pairs = OrderedSet(val for val in bus_pairs.values()) model.ineq_soc_ub_set = pe.Set(initialize=list(unique_bus_pairs)) - model.ineq_soc_ub = KocukSOCOverestimator(model.ineq_soc_ub_set) + model.ineq_soc_ub = SOCEdgeCuts(model.ineq_soc_ub_set) for from_bus, to_bus in model.ineq_soc_ub_set: model.ineq_soc_ub[from_bus, to_bus].build(c=model.c[from_bus, to_bus], s=model.s[from_bus, to_bus], diff --git a/egret/models/tests/test_relaxations.py b/egret/models/tests/test_relaxations.py index fc6c2629..2dbe7fc4 100644 --- a/egret/models/tests/test_relaxations.py +++ b/egret/models/tests/test_relaxations.py @@ -24,7 +24,7 @@ import numpy as np try: import coramin - from egret.models.ac_relaxations import KocukSOCOverestimator + from egret.models.ac_relaxations import SOCEdgeCuts coramin_available = True except ImportError: coramin_available = False @@ -139,11 +139,11 @@ def test_atan_relaxation(self, case_name): self.assertTrue(comparison) @parameterized.expand(case_names) - def test_atan_relaxation_with_kocuk_overestimators(self, case_name): + def test_atan_relaxation_with_soc_edge_cuts(self, case_name): test_case = os.path.join(current_dir, 'transmission_test_instances', 'pglib-opf-master', '{}.m'.format(case_name)) upper_bound_soln = upper_bounds[case_name] md = create_ModelData(test_case) - nlp, scaled_md = create_atan_relaxation(md, use_linear_relaxation=True, use_kocuk_soc_overestimators=True) + nlp, scaled_md = create_atan_relaxation(md, use_linear_relaxation=True, use_soc_edge_cuts=True) for b in coramin.relaxations.relaxation_data_objects(nlp, descend_into=True, active=True, sort=True): b.rebuild(build_nonlinear_constraint=True) @@ -176,14 +176,14 @@ def test_rectangular_relaxation(self, case_name): @unittest.skipIf(not coramin_available, "coramin is not available") -class TestKocukSOCOverestimator(unittest.TestCase): - def test_kocuk_soc_overestimator(self): +class TestSOCEdgeCuts(unittest.TestCase): + def test_soc_edge_cuts(self): m = pe.ConcreteModel() m.c = pe.Var() m.s = pe.Var() m.w1 = pe.Var() m.w2 = pe.Var() - m.rel = KocukSOCOverestimator() + m.rel = SOCEdgeCuts() m.rel.set_input(c=m.c, s=m.s, vmsq_1=m.w1, vmsq_2=m.w2) c_bounds = [(0.5, 1.5), (0.8, 1.5), (0.5, 1.2), (0.95, 0.95)]