Skip to content

Commit

Permalink
Fix ComputeValue(PLConstraint) #200
Browse files Browse the repository at this point in the history
  • Loading branch information
glebbelov committed Aug 24, 2023
1 parent 368e24d commit a42c365
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/mp/flat/constr_eval.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,12 @@ double ComputeValue(const PLConstraint& con, const VarVec& x) {
return plp.y_.back()
+ plp.PostSlope()*(x0 - plp.x_.back());
int i0=0;
for ( ; x0 > plp.x_[i0]; ++i0);
for ( ; x0 > plp.x_[i0]; ++i0) ;
return plp.x_[i0]==x0
? plp.y_[i0]
: plp.y_[i0]
+ (plp.y_[i0+1]-plp.y_[i0])
* (x0-plp.x_[i0]) / (plp.x_[i0+1]-plp.x_[i0]);
: (plp.y_[i0-1]
+ (plp.y_[i0]-plp.y_[i0-1])
* (x0-plp.x_[i0-1]) / (plp.x_[i0]-plp.x_[i0-1]));
}

/// Should be here,
Expand Down

0 comments on commit a42c365

Please sign in to comment.