6 #ifndef AbcNonLinearCost_H 7 #define AbcNonLinearCost_H 10 #include "CoinPragma.hpp" 14 class CoinIndexedVector;
39 #define CLP_BELOW_LOWER 0 40 #define CLP_FEASIBLE 1 41 #define CLP_ABOVE_UPPER 2 53 status =
static_cast<unsigned char>(status & ~15);
54 status =
static_cast<unsigned char>(status | value);
58 status =
static_cast<unsigned char>(status & ~(15 << 4));
59 status =
static_cast<unsigned char>(status | (value << 4));
67 status =
static_cast<unsigned char>(status & ~(15 << 4));
68 status =
static_cast<unsigned char>(status | (
CLP_SAME << 4));
109 void checkChanged(
int numberInArray, CoinIndexedVector * update);
116 void goThru(
int numberInArray,
double multiplier,
117 const int * index,
const double * work,
121 void goBack(
int numberInArray,
const int * index,
128 void goBackAll(
const CoinIndexedVector * update);
142 double setOne(
int sequence,
double solutionValue);
146 double setOneBasic(
int iRow,
double solutionValue);
152 double nearest(
int iRow,
double solutionValue);
157 return (alpha > 0.0) ? infeasibilityWeight_ : -infeasibilityWeight_;
160 return -infeasibilityWeight_;
163 return infeasibilityWeight_;
168 double returnValue = 0.0;
169 unsigned char iStatus = status_[sequence];
188 rhs += bound_[sequence] - model_->
upperRegion()[sequence];
193 rhs += model_->
lowerRegion()[sequence] - bound_[sequence];
196 returnValue = fabs(alpha) * infeasibilityWeight_;
206 return numberInfeasibilities_;
214 return feasibleCost_;
220 return sumInfeasibilities_;
224 return largestInfeasibility_;
228 return averageTheta_;
231 averageTheta_ = value;
242 {
return (status_[sequence] >> 4);}
253 double feasibleCost_;
255 double infeasibilityWeight_;
257 double largestInfeasibility_;
259 double sumInfeasibilities_;
261 double averageTheta_;
269 int numberInfeasibilities_;
272 unsigned char * status_;
void setAverageTheta(double value)
void validate()
For debug.
double changeInCost(int, double alpha) const
Returns change in cost - one down if alpha >0.0, up if <0.0 Value is current - new.
double largestInfeasibility() const
Largest infeasibility.
AbcNonLinearCost()
Default constructor.
double feasibleCost() const
Feasible cost.
int numberInfeasibilities() const
Number of infeasibilities.
AbcNonLinearCost & operator=(const AbcNonLinearCost &)
void goBack(int numberInArray, const int *index, double *rhs)
Takes off last iteration (i.e.
double * upperRegion() const
void refresh()
Refresh - assuming regions OK.
double averageTheta() const
Average theta.
void setCurrentStatus(unsigned char &status, int value)
void feasibleBounds()
Puts feasible bounds into lower and upper.
void goThru(int numberInArray, double multiplier, const int *index, const double *work, double *rhs)
Goes through one bound for each variable.
unsigned char * statusArray() const
~AbcNonLinearCost()
Destructor.
void refreshFromPerturbed(double tolerance)
Refresh - from original.
double changeUpInCost(int) const
double setOneBasic(int iRow, double solutionValue)
Sets bounds and cost for one variable Returns change in cost May need to be inline for speed...
double setOne(int sequence, double solutionValue)
Sets bounds and cost for one variable Returns change in cost May need to be inline for speed...
double feasibleReportCost() const
Feasible cost with offset and direction (i.e. for reporting)
void zapCosts()
Temporary zeroing of feasible costs.
void setChangeInCost(double value)
int currentStatus(unsigned char status)
int setOneOutgoing(int sequence, double &solutionValue)
Sets bounds and cost for outgoing variable may change value Returns direction.
int originalStatus(unsigned char status)
void refreshCosts(const double *columnCosts)
Refreshes costs always makes row costs zero.
void setSameStatus(unsigned char &status)
int getCurrentStatus(int sequence)
void setOriginalStatus(unsigned char &status, int value)
void goBackAll(const CoinIndexedVector *update)
Puts back correct infeasible costs for each variable The input indices are row indices and need conve...
int * pivotVariable() const
Basic variables pivoting on which rows may be same as toExternal but may be as at invert...
double * lowerRegion() const
double sumInfeasibilities() const
Sum of infeasibilities.
void setInitialStatus(unsigned char &status)
void checkInfeasibilities(double oldTolerance=0.0)
Changes infeasible costs and computes number and cost of infeas Puts all non-basic (non free) variabl...
void checkChanged(int numberInArray, CoinIndexedVector *update)
Puts back correct infeasible costs for each variable The input indices are row indices and need conve...
double changeInCost(int iRow, double alpha, double &rhs)
This also updates next bound.
#define CLP_BELOW_LOWER
Trivial class to deal with non linear costs.
double changeDownInCost(int) const
double nearest(int iRow, double solutionValue)
Returns nearest bound.
double changeInCost() const
Change in cost.