@@ -120,7 +120,7 @@ int CDemandOptimizer::GetDemandIndexFromName(const string demand_tag) const
120120 return DOESNT_EXIST;
121121}
122122// ////////////////////////////////////////////////////////////////
123- // / \brief gets demand from index
123+ // / \brief gets demand from index
124124//
125125CDemand* CDemandOptimizer::GetWaterDemand (const int d) {
126126 return _pDemands[d];
@@ -132,16 +132,16 @@ int CDemandOptimizer::GetNumWaterDemands() const {
132132 return _nDemands;
133133}
134134// ////////////////////////////////////////////////////////////////
135- // / \brief gets demand group from index
135+ // / \brief gets demand group from index
136136//
137- CDemandGroup* CDemandOptimizer::GetDemandGroup (const int ii)
137+ CDemandGroup* CDemandOptimizer::GetDemandGroup (const int ii)
138138{
139139 return _pDemandGroups[ii];
140140}
141141// ////////////////////////////////////////////////////////////////
142- // / \brief gets demand group from name, or NULL if invalid name
142+ // / \brief gets demand group from name, or NULL if invalid name
143143//
144- CDemandGroup* CDemandOptimizer::GetDemandGroupFromName (const string name)
144+ CDemandGroup* CDemandOptimizer::GetDemandGroupFromName (const string name)
145145{
146146 for (int ii=0 ;ii<_nDemandGroups;ii++){
147147 if (_pDemandGroups[ii]->GetName () == name) {
@@ -151,14 +151,14 @@ CDemandGroup* CDemandOptimizer::GetDemandGroupFromName(const string name)
151151 return NULL ;
152152}
153153// ////////////////////////////////////////////////////////////////
154- // / \brief gets demand group from index
154+ // / \brief gets demand group from index
155155//
156- int CDemandOptimizer::GetNumDemandGroups () const
156+ int CDemandOptimizer::GetNumDemandGroups () const
157157{
158158 return _nDemandGroups;
159159}
160160// ////////////////////////////////////////////////////////////////
161- // / \brief returns true if demands have been initialized
161+ // / \brief returns true if demands have been initialized
162162//
163163bool CDemandOptimizer::DemandsAreInitialized () const
164164{
@@ -206,15 +206,15 @@ void CDemandOptimizer::SetDebugLevel(const int val)
206206// / \brief assigns a demand 'unrestricted' status, meaning it wont be considered when applying environmental min flow constraints
207207// / \params dname [in] - name of demand
208208//
209- void CDemandOptimizer::SetDemandAsUnrestricted (const string dname)
209+ void CDemandOptimizer::SetDemandAsUnrestricted (const string dname)
210210{
211211 int d = GetDemandIndexFromName (dname);
212212 if (d!=DOESNT_EXIST){
213213 _pDemands[d]->SetAsUnrestricted ();
214214 }
215215 else {
216216 string warn = " CDemandOptimizer::SetDemandAsUnrestricted: invalid or disabled demand name " + dname +" provided in : DemandIsUnrestricted command. This will be ignored " ;
217- WriteWarning (warn,true );
217+ WriteWarning (warn,true );
218218 }
219219}
220220// ////////////////////////////////////////////////////////////////
@@ -229,7 +229,7 @@ void CDemandOptimizer::SetDemandPenalty(const string dname, const double& pen)
229229 }
230230 else {
231231 string warn = " CDemandOptimizer::SetDemandPenalty: invalid or disabled demand name " + dname +" provided in : DemandPenalty command. This will be ignored " ;
232- WriteWarning (warn,true );
232+ WriteWarning (warn,true );
233233 }
234234}
235235// ////////////////////////////////////////////////////////////////
@@ -253,7 +253,7 @@ void CDemandOptimizer::SetCumulativeDate(const int julian_date, const string dem
253253// / \brief adds demand group to array of demand groups
254254// / \params groupname [in] - user-specified demand group name
255255//
256- void CDemandOptimizer::AddDemandGroup (const string groupname)
256+ void CDemandOptimizer::AddDemandGroup (const string groupname)
257257{
258258 CDemandGroup *pDG=new CDemandGroup (groupname,_nDemandGroups);
259259
@@ -265,7 +265,7 @@ void CDemandOptimizer::AddDemandGroup(const string groupname)
265265// / \brief adds demand ONLY if subbasin associated with demand is enabled, otherwise tosses out.
266266// / \params pDem [in] - pointer to demand object
267267//
268- void CDemandOptimizer::AddWaterDemand (CDemand* pDem)
268+ void CDemandOptimizer::AddWaterDemand (CDemand* pDem)
269269{
270270 long SBID=pDem->GetSubBasinID ();
271271 if (_pModel->GetSubBasinByID (SBID)->IsEnabled ())
@@ -548,7 +548,7 @@ void CDemandOptimizer::InitializeDemands(CModel* pModel, const optStruct& Option
548548
549549 if (Options.noisy ){cout<<" CDemandOptimizer: Demand initialization..." <<endl;}
550550
551- // reserve memory for delivery arrays
551+ // reserve memory for delivery arrays
552552 // ------------------------------------------------------------------
553553 _aDelivery = new double [_nDemands];
554554 _aCumDelivery = new double [_nDemands];
@@ -560,14 +560,14 @@ void CDemandOptimizer::InitializeDemands(CModel* pModel, const optStruct& Option
560560
561561 // determine upstream demand connectivity
562562 // ------------------------------------------------------------------
563- IdentifyUpstreamDemands ();
563+ IdentifyUpstreamDemands ();
564564
565565 int p;
566566 decision_var *pDV;
567567
568- // add delivered demand decision vars
568+ // add delivered demand decision vars
569569 // ------------------------------------------------------------------
570- for (int d = 0 ; d < _nDemands; d++)
570+ for (int d = 0 ; d < _nDemands; d++)
571571 {
572572 p=pModel->GetSubBasinByID (_pDemands[d]->GetSubBasinID ())->GetGlobalIndex ();
573573 pDV=new decision_var (_pDemands[d]->GetName (), p, DV_DELIVERY, d);
@@ -613,7 +613,7 @@ void CDemandOptimizer::InitializePostRVMRead(CModel* pModel, const optStruct& Op
613613 _aDhist[pp][i]=0.0 ;
614614 }
615615 }
616-
616+
617617 int p;
618618 _nSlackVars = 0 ;
619619 CSubBasin *pSB;
@@ -854,7 +854,7 @@ void CDemandOptimizer::AddReservoirConstraints()
854854
855855 TokenizeString (expString, s, Len);
856856 exp = ParseExpression ((const char **)(s), Len, 0 , " internal" );
857-
857+
858858 pConst=new manConstraint ();
859859 pConst->name =TSname;
860860 pConst->is_goal =true ;
@@ -1116,7 +1116,7 @@ void CDemandOptimizer::SolveDemandProblem(CModel *pModel, const optStruct &Optio
11161116 for (int d = 0 ; d < _nDemands; d++) {
11171117 _pDemands[d]->UpdateDemand (Options,tt);
11181118 }
1119-
1119+
11201120 // instantiate linear programming solver
11211121 // ----------------------------------------------------------------
11221122 lp_lib::lprec *pLinProg;
@@ -1217,7 +1217,7 @@ void CDemandOptimizer::SolveDemandProblem(CModel *pModel, const optStruct &Optio
12171217 d=0 ;
12181218 // penalties for unmet demand
12191219 // ----------------------------------------------------------------
1220- for (int d = 0 ; d < _nDemands; d++)
1220+ for (int d = 0 ; d < _nDemands; d++)
12211221 {
12221222 demand_penalty_sum+=(_pDemands[d]->GetPenalty ()*_pDemands[d]->GetDemand ());
12231223
@@ -1637,7 +1637,7 @@ void CDemandOptimizer::SolveDemandProblem(CModel *pModel, const optStruct &Optio
16371637 retval = lp_lib::solve (pLinProg);
16381638
16391639 if (retval!=OPTIMAL){
1640- cout<<" code: " <<retval<<endl;
1640+ cout<<" code: " <<retval<<endl;
16411641 string filename=Options.output_dir +" /lp_bad_matrix.txt" ;
16421642 lp_lib::set_outputfile (pLinProg,&filename[0 ]);
16431643 lp_lib::print_lp (pLinProg);
@@ -1796,7 +1796,7 @@ void CDemandOptimizer::SolveDemandProblem(CModel *pModel, const optStruct &Optio
17961796 _aCumDelivery[d]+=value*(Options.timestep *SEC_PER_DAY);
17971797
17981798 if (tt.julian_day ==_pDemands[d]->GetCumulDeliveryDate ()){
1799- _aCumDelivery[d]=0.0 ;
1799+ _aCumDelivery[d]=0.0 ;
18001800 }
18011801
18021802 if (!_pDemands[d]->IsReservoirDemand ()){
@@ -1913,7 +1913,7 @@ void CDemandOptimizer::WriteMinorOutput(const optStruct &Options,const time_stru
19131913 int ii;
19141914 _GOALSAT<<tt.model_time <<" ," <<usedate<<" ," <<usehour;
19151915
1916- for (int d = 0 ; d < _nDemands; d++)
1916+ for (int d = 0 ; d < _nDemands; d++)
19171917 {
19181918 if (include_pen){mult=_pDemands[d]->GetPenalty ();}
19191919 ii =_pDemands[d]->GetLocalIndex ();
@@ -1922,18 +1922,18 @@ void CDemandOptimizer::WriteMinorOutput(const optStruct &Options,const time_stru
19221922 }
19231923
19241924 int k=_nDemands+2 *_nReservoirs; // first slack terms are due to environmental flow constraints (nDemands) and reservoir outflow targets (2*nReservoirs)
1925- for (int i = 0 ; i < _nConstraints; i++)
1925+ for (int i = 0 ; i < _nConstraints; i++)
19261926 {
19271927 if (_pConstraints[i]->is_goal ) {
1928- if (_pConstraints[i]->pOperRegimes [0 ]->pExpression ->compare != COMPARE_IS_EQUAL)
1928+ if (_pConstraints[i]->pOperRegimes [0 ]->pExpression ->compare != COMPARE_IS_EQUAL)
19291929 {
19301930 if (include_pen){mult=_pConstraints[i]->penalty_over ;}
19311931
19321932 pen = mult*_aSlackValues[k];
19331933 _GOALSAT<<" ," <<pen;
19341934 k++;
19351935 }
1936- else
1936+ else
19371937 {
19381938 if (include_pen){mult=_pConstraints[i]->penalty_over ;}
19391939 pen =mult*_aSlackValues[k];
0 commit comments