Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
James Craig authored and James Craig committed Oct 8, 2024
2 parents a64719c + 6b6e4cf commit 897626c
Show file tree
Hide file tree
Showing 24 changed files with 229 additions and 231 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_language_version:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-json
- id: pretty-format-json
Expand All @@ -26,7 +26,7 @@ repos:
# - id: include-what-you-use

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.6
rev: 0.29.3
hooks:
- id: check-github-workflows
- repo: meta
Expand Down
2 changes: 1 addition & 1 deletion src/CommonFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,7 @@ void quickSort(double arr[], int left, int right)
}
//////////////////////////////////////////////////////////////////
/// \brief adds value v to end of integer array a[] of original size n, expands a[] to size n+1
//
//
void pushIntoIntArray(int*&a, const int &v, int &n)
{
int *tmp=new int [n+1];
Expand Down
12 changes: 6 additions & 6 deletions src/DemandExpressionHandling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ bool CDemandOptimizer::ConvertToExpressionTerm(const string s, expressionTerm* t
return true;

}
}
}
else {
warn="ConvertToExpression:: Unparseable term in history expression starting with !/$ - only !Q, !I, !D, !h, $B, or $E currently supported. "+warnstring;
ExitGracefully(warn.c_str(), BAD_DATA_WARN);
Expand Down Expand Up @@ -393,7 +393,7 @@ bool CDemandOptimizer::ConvertToExpressionTerm(const string s, expressionTerm* t
return true;
}
//----------------------------------------------------------------------
else if (s[0] == '$')
else if (s[0] == '$')
{
if ((s[1] == 'B') || (s[1] == 'E')) //Subbasin-indexed
{
Expand Down Expand Up @@ -1115,7 +1115,7 @@ void CDemandOptimizer::AddConstraintToLP(const int ii, const int kk, lp_lib::lpr
pE= pC->pOperRegimes[0]->pExpression; //inactive expression
}

if ((kk==DOESNT_EXIST) || (!constraint_valid)) // INACTIVE/INVALID GOAL/CONSTRAINT
if ((kk==DOESNT_EXIST) || (!constraint_valid)) // INACTIVE/INVALID GOAL/CONSTRAINT
{
if (!pC->is_goal) {
col_ind[i]=1;
Expand Down Expand Up @@ -1150,7 +1150,7 @@ void CDemandOptimizer::AddConstraintToLP(const int ii, const int kk, lp_lib::lpr
#endif

//////////////////////////////////////////////////////////////////
/// evaluates difference between right hand side and left hand side of expression, or value of RHS if RHS_only==true and statement only has one term left of (in)equality
/// evaluates difference between right hand side and left hand side of expression, or value of RHS if RHS_only==true and statement only has one term left of (in)equality
/// does not support active decision variables in expression (only to be used for conditionals and demand/return expressions)
/// \params pE [in] - conditional expression
/// \param t [in] - current model time
Expand Down Expand Up @@ -1192,7 +1192,7 @@ double CDemandOptimizer::EvaluateExpression(const expressionStruct* pE,const dou
}
}
}

RHS-=coeff; //term group goes on right hand side
}
}
Expand All @@ -1207,7 +1207,7 @@ double CDemandOptimizer::EvaluateExpression(const expressionStruct* pE,const dou
//
bool CDemandOptimizer::EvaluateConditionExp(const expressionStruct* pE,const double &t) const
{

double RHSminusLHS=EvaluateExpression(pE,t,false);

if (fabs(RHSminusLHS-RAV_BLANK_DATA)<REAL_SMALL) {return true;}//condition assumed satisfied if no data in conditional
Expand Down
3 changes: 1 addition & 2 deletions src/DemandGroups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
CDemandGroup::CDemandGroup(string tag, int global_ind)
{
_name=tag;
_nDemands=0;
_nDemands=0;
_pDemands=NULL;
_global_ii=global_ind;
}
Expand Down Expand Up @@ -91,4 +91,3 @@ void CDemandGroup::AddDemand(CDemand *pDem)
void CDemandGroup::Initialize()
{
}

Loading

0 comments on commit 897626c

Please sign in to comment.