6#ifndef AbcNonLinearCost_H
7#define AbcNonLinearCost_H
10#include "CoinPragma.hpp"
14class CoinIndexedVector;
39#define CLP_BELOW_LOWER 0
41#define CLP_ABOVE_UPPER 2
43#ifndef ClpNonLinearCost_H
54 status =
static_cast<unsigned char>(status & ~15);
55 status =
static_cast<unsigned char>(status | value);
59 status =
static_cast<unsigned char>(status & ~(15 << 4));
60 status =
static_cast<unsigned char>(status | (value << 4));
68 status =
static_cast<unsigned char>(status & ~(15 << 4));
69 status =
static_cast<unsigned char>(status | (
CLP_SAME << 4));
118 void goThru(
int numberInArray,
double multiplier,
119 const int * index,
const double * work,
123 void goBack(
int numberInArray,
const int * index,
144 double setOne(
int sequence,
double solutionValue);
154 double nearest(
int iRow,
double solutionValue);
159 return (alpha > 0.0) ? infeasibilityWeight_ : -infeasibilityWeight_;
162 return -infeasibilityWeight_;
165 return infeasibilityWeight_;
170 double returnValue = 0.0;
171 unsigned char iStatus = status_[sequence];
190 rhs += bound_[sequence] - model_->
upperRegion()[sequence];
195 rhs += model_->
lowerRegion()[sequence] - bound_[sequence];
198 returnValue = fabs(alpha) * infeasibilityWeight_;
208 return numberInfeasibilities_;
216 return feasibleCost_;
222 return sumInfeasibilities_;
226 return largestInfeasibility_;
230 return averageTheta_;
233 averageTheta_ = value;
244 {
return (status_[sequence] >> 4);}
255 double feasibleCost_;
257 double infeasibilityWeight_;
259 double largestInfeasibility_;
261 double sumInfeasibilities_;
263 double averageTheta_;
271 int numberInfeasibilities_;
274 unsigned char * status_;
void setOriginalStatus(unsigned char &status, int value)
#define CLP_BELOW_LOWER
Trivial class to deal with non linear costs.
void setCurrentStatus(unsigned char &status, int value)
int currentStatus(unsigned char status)
void setSameStatus(unsigned char &status)
void setInitialStatus(unsigned char &status)
int originalStatus(unsigned char status)
void checkChanged(int numberInArray, CoinIndexedVector *update)
Puts back correct infeasible costs for each variable The input indices are row indices and need conve...
void checkInfeasibilities(int numberInArray, const int *index)
Changes infeasible costs for each variable The indices are row indices and need converting to sequenc...
double feasibleCost() const
Feasible cost.
double changeDownInCost(int) const
AbcNonLinearCost()
Default constructor.
double sumInfeasibilities() const
Sum of infeasibilities.
void refreshCosts(const double *columnCosts)
Refreshes costs always makes row costs zero.
void zapCosts()
Temporary zeroing of feasible costs.
double changeUpInCost(int) const
double feasibleReportCost() const
Feasible cost with offset and direction (i.e. for reporting)
void feasibleBounds()
Puts feasible bounds into lower and upper.
double setOneBasic(int iRow, double solutionValue)
Sets bounds and cost for one variable Returns change in cost May need to be inline for speed.
void setChangeInCost(double value)
double largestInfeasibility() const
Largest infeasibility.
double nearest(int iRow, double solutionValue)
Returns nearest bound.
void checkInfeasibilities(double oldTolerance=0.0)
Changes infeasible costs and computes number and cost of infeas Puts all non-basic (non free) variabl...
void refreshFromPerturbed(double tolerance)
Refresh - from original.
double changeInCost(int, double alpha) const
Returns change in cost - one down if alpha >0.0, up if <0.0 Value is current - new.
int setOneOutgoing(int sequence, double &solutionValue)
Sets bounds and cost for outgoing variable may change value Returns direction.
void validate()
For debug.
AbcNonLinearCost(AbcSimplex *model)
Constructor from simplex.
~AbcNonLinearCost()
Destructor.
double changeInCost(int iRow, double alpha, double &rhs)
This also updates next bound.
double changeInCost() const
Change in cost.
void goBack(int numberInArray, const int *index, double *rhs)
Takes off last iteration (i.e.
int getCurrentStatus(int sequence)
double averageTheta() const
Average theta.
AbcNonLinearCost(const AbcNonLinearCost &)
int numberInfeasibilities() const
Number of infeasibilities.
double setOne(int sequence, double solutionValue)
Sets bounds and cost for one variable Returns change in cost May need to be inline for speed.
void refresh()
Refresh - assuming regions OK.
void goThru(int numberInArray, double multiplier, const int *index, const double *work, double *rhs)
Goes through one bound for each variable.
AbcNonLinearCost & operator=(const AbcNonLinearCost &)
void goBackAll(const CoinIndexedVector *update)
Puts back correct infeasible costs for each variable The input indices are row indices and need conve...
unsigned char * statusArray() const
void setAverageTheta(double value)
double * upperRegion() const
int * pivotVariable() const
Basic variables pivoting on which rows may be same as toExternal but may be as at invert.
double * lowerRegion() const