Skip to content

Commit 6782c52

Browse files
authoredFeb 11, 2021
Merge pull request grid-parity-exchange#199 from michaelbynum/soc
basic soc relaxation should not need coramin
2 parents 2bbb971 + f6e5909 commit 6782c52

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
 

‎egret/models/ac_relaxations.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ def _relaxation_helper(model, md, include_soc, use_linear_relaxation):
3333

3434
def create_soc_relaxation(model_data, use_linear_relaxation=True, include_feasibility_slack=False):
3535
model, md = _create_base_power_ac_model(model_data, include_feasibility_slack=include_feasibility_slack)
36-
_relaxation_helper(model=model, md=md, include_soc=True, use_linear_relaxation=use_linear_relaxation)
36+
if use_linear_relaxation:
37+
_relaxation_helper(model=model, md=md, include_soc=True, use_linear_relaxation=use_linear_relaxation)
38+
else:
39+
branch_attrs = md.attributes(element_type='branch')
40+
bus_pairs = zip_items(branch_attrs['from_bus'], branch_attrs['to_bus'])
41+
unique_bus_pairs = list(OrderedDict((val, None) for idx, val in bus_pairs.items()).keys())
42+
libbranch.declare_ineq_soc(model=model, index_set=unique_bus_pairs,
43+
use_outer_approximation=use_linear_relaxation)
3744
return model, md
3845

3946

0 commit comments

Comments
 (0)
Please sign in to comment.