From 976867268abf83f0cf9a1192d640b2486ad60e1c Mon Sep 17 00:00:00 2001 From: Hassan Date: Tue, 13 Mar 2018 17:03:05 -0600 Subject: [PATCH] fixing reverse parallel arcs --- examples/MINLP/Power/PowerNet.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/examples/MINLP/Power/PowerNet.cpp b/examples/MINLP/Power/PowerNet.cpp index d3fcbe199..53503f724 100755 --- a/examples/MINLP/Power/PowerNet.cpp +++ b/examples/MINLP/Power/PowerNet.cpp @@ -375,13 +375,16 @@ int PowerNet::readgrid(const char* fname) { string src,dest,key; file >> word; index = 0; + bool reversed = false; while(word.compare("];")) { src = word; file >> dest; key = dest+","+src;//Taking care of reversed direction arcs + reversed = false; if(arcID.find(key)!=arcID.end()) {//Reverse arc direction DebugOn("Adding arc linking " +src+" and "+dest); DebugOn(" with reversed direction, reversing source and destination.\n"); + reversed = true; key = src; src = dest; dest = key; @@ -438,6 +441,13 @@ int PowerNet::readgrid(const char* fname) { arc->tbound.max = 60*pi/180; } + if (reversed) { + arc->tr /= 1; + arc->as *= -1; + auto temp = arc->tbound.max; + arc->tbound.max = -1*arc->tbound.min; + arc->tbound.min = -1*temp; + } // arc->tbound.max = 30*pi/180; m_theta_ub += arc->tbound.max;