#include <ClpNonLinearCost.hpp>
Public Member Functions | |
Constructors, destructor | |
ClpNonLinearCost () | |
Default constructor. | |
ClpNonLinearCost (ClpSimplex *model, int method=1) | |
Constructor from simplex. | |
ClpNonLinearCost (ClpSimplex *model, const int *starts, const double *lower, const double *cost) | |
Constructor from simplex and list of non-linearities (columns only) First lower of each column has to match real lower Last lower has to be <= upper (if == then cost ignored) This could obviously be changed to make more user friendly. | |
~ClpNonLinearCost () | |
Destructor. | |
ClpNonLinearCost (const ClpNonLinearCost &) | |
Default constructor. | |
ClpNonLinearCost & | operator= (const ClpNonLinearCost &) |
Default constructor. | |
Actual work in primal | |
void | checkInfeasibilities (double oldTolerance=0.0) |
Changes infeasible costs and computes number and cost of infeas Puts all non-basic (non free) variables to bounds and all free variables to zero if oldTolerance is non-zero
| |
void | checkInfeasibilities (int numberInArray, const int *index) |
Changes infeasible costs for each variable The indices are row indices and need converting to sequences. | |
void | checkChanged (int numberInArray, CoinIndexedVector *update) |
Puts back correct infeasible costs for each variable The input indices are row indices and need converting to sequences for costs. | |
void | goThru (int numberInArray, double multiplier, const int *index, const double *work, double *rhs) |
Goes through one bound for each variable. | |
void | goBack (int numberInArray, const int *index, double *rhs) |
Takes off last iteration (i.e. | |
void | goBackAll (const CoinIndexedVector *update) |
Puts back correct infeasible costs for each variable The input indices are row indices and need converting to sequences for costs. | |
void | zapCosts () |
Temporary zeroing of feasible costs. | |
void | refreshCosts (const double *columnCosts) |
Refreshes costs always makes row costs zero. | |
void | feasibleBounds () |
Puts feasible bounds into lower and upper. | |
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 | setOne (int sequence, double solutionValue, double lowerValue, double upperValue, double costValue=0.0) |
Sets bounds and infeasible cost and true cost for one variable This is for gub and column generation etc. | |
int | setOneOutgoing (int sequence, double &solutionValue) |
Sets bounds and cost for outgoing variable may change value Returns direction. | |
double | nearest (int sequence, double solutionValue) |
Returns nearest bound. | |
double | changeInCost (int sequence, double alpha) const |
Returns change in cost - one down if alpha >0.0, up if <0.0 Value is current - new. | |
double | changeUpInCost (int sequence) const |
Changes infeasible costs and computes number and cost of infeas Puts all non-basic (non free) variables to bounds and all free variables to zero if oldTolerance is non-zero
| |
double | changeDownInCost (int sequence) const |
Changes infeasible costs and computes number and cost of infeas Puts all non-basic (non free) variables to bounds and all free variables to zero if oldTolerance is non-zero
| |
double | changeInCost (int sequence, double alpha, double &rhs) |
This also updates next bound. | |
double | lower (int sequence) const |
Returns current lower bound. | |
double | upper (int sequence) const |
Returns current upper bound. | |
double | cost (int sequence) const |
Returns current cost. | |
Gets and sets | |
int | numberInfeasibilities () const |
Number of infeasibilities. | |
double | changeInCost () const |
Change in cost. | |
double | feasibleCost () const |
Feasible cost. | |
double | feasibleReportCost () const |
Feasible cost with offset and direction (i.e. for reporting). | |
double | sumInfeasibilities () const |
Sum of infeasibilities. | |
double | largestInfeasibility () const |
Largest infeasibility. | |
double | averageTheta () const |
Average theta. | |
void | setAverageTheta (double value) |
Number of infeasibilities. | |
void | setChangeInCost (double value) |
Number of infeasibilities. | |
void | setMethod (int value) |
Number of infeasibilities. | |
bool | lookBothWays () const |
See if may want to look both ways. | |
Private functions to deal with infeasible regions | |
bool | infeasible (int i) const |
For debug. | |
void | setInfeasible (int i, bool trueFalse) |
For debug. | |
unsigned char * | statusArray () const |
For debug. | |
void | validate () |
For debug. | |
Private Attributes | |
Data members | |
double | changeCost_ |
Change in cost because of infeasibilities. | |
double | feasibleCost_ |
Feasible cost. | |
double | infeasibilityWeight_ |
Current infeasibility weight. | |
double | largestInfeasibility_ |
Largest infeasibility. | |
double | sumInfeasibilities_ |
Sum of infeasibilities. | |
double | averageTheta_ |
Average theta - kept here as only for primal. | |
int | numberRows_ |
Number of rows (mainly for checking and copy). | |
int | numberColumns_ |
Number of columns (mainly for checking and copy). | |
int * | start_ |
Starts for each entry (columns then rows). | |
int * | whichRange_ |
Range for each entry (columns then rows). | |
int * | offset_ |
Temporary range offset for each entry (columns then rows). | |
double * | lower_ |
Lower bound for each range (upper bound is next lower). | |
double * | cost_ |
Cost for each range. | |
ClpSimplex * | model_ |
Model. | |
unsigned int * | infeasible_ |
Change in cost because of infeasibilities. | |
int | numberInfeasibilities_ |
Number of infeasibilities found. | |
unsigned char * | status_ |
Contains status at beginning and current. | |
double * | bound_ |
Bound which has been replaced in lower_ or upper_. | |
double * | cost2_ |
Feasible cost array. | |
int | method_ |
Method 1 old, 2 new, 3 both! | |
bool | convex_ |
If all non-linear costs convex. | |
bool | bothWays_ |
If we should look both ways for djs. |
Definition at line 69 of file ClpNonLinearCost.hpp.
ClpNonLinearCost::ClpNonLinearCost | ( | ) |
Default constructor.
ClpNonLinearCost::ClpNonLinearCost | ( | ClpSimplex * | model, | |
int | method = 1 | |||
) |
Constructor from simplex.
This will just set up wasteful arrays for linear, but later may do dual analysis and even finding duplicate columns .
ClpNonLinearCost::ClpNonLinearCost | ( | ClpSimplex * | model, | |
const int * | starts, | |||
const double * | lower, | |||
const double * | cost | |||
) |
Constructor from simplex and list of non-linearities (columns only) First lower of each column has to match real lower Last lower has to be <= upper (if == then cost ignored) This could obviously be changed to make more user friendly.
ClpNonLinearCost::~ClpNonLinearCost | ( | ) |
Destructor.
ClpNonLinearCost::ClpNonLinearCost | ( | const ClpNonLinearCost & | ) |
Default constructor.
ClpNonLinearCost& ClpNonLinearCost::operator= | ( | const ClpNonLinearCost & | ) |
Default constructor.
void ClpNonLinearCost::checkInfeasibilities | ( | double | oldTolerance = 0.0 |
) |
Changes infeasible costs and computes number and cost of infeas Puts all non-basic (non free) variables to bounds and all free variables to zero if oldTolerance is non-zero
void ClpNonLinearCost::checkInfeasibilities | ( | int | numberInArray, | |
const int * | index | |||
) |
Changes infeasible costs for each variable The indices are row indices and need converting to sequences.
void ClpNonLinearCost::checkChanged | ( | int | numberInArray, | |
CoinIndexedVector * | update | |||
) |
Puts back correct infeasible costs for each variable The input indices are row indices and need converting to sequences for costs.
On input array is empty (but indices exist). On exit just changed costs will be stored as normal CoinIndexedVector
void ClpNonLinearCost::goThru | ( | int | numberInArray, | |
double | multiplier, | |||
const int * | index, | |||
const double * | work, | |||
double * | rhs | |||
) |
Goes through one bound for each variable.
If multiplier*work[iRow]>0 goes down, otherwise up. The indices are row indices and need converting to sequences Temporary offsets may be set Rhs entries are increased
void ClpNonLinearCost::goBack | ( | int | numberInArray, | |
const int * | index, | |||
double * | rhs | |||
) |
Takes off last iteration (i.e.
offsets closer to 0)
void ClpNonLinearCost::goBackAll | ( | const CoinIndexedVector * | update | ) |
Puts back correct infeasible costs for each variable The input indices are row indices and need converting to sequences for costs.
At the end of this all temporary offsets are zero
void ClpNonLinearCost::zapCosts | ( | ) |
Temporary zeroing of feasible costs.
void ClpNonLinearCost::refreshCosts | ( | const double * | columnCosts | ) |
Refreshes costs always makes row costs zero.
void ClpNonLinearCost::feasibleBounds | ( | ) |
Puts feasible bounds into lower and upper.
double ClpNonLinearCost::setOne | ( | int | sequence, | |
double | solutionValue | |||
) |
Sets bounds and cost for one variable Returns change in cost May need to be inline for speed.
void ClpNonLinearCost::setOne | ( | int | sequence, | |
double | solutionValue, | |||
double | lowerValue, | |||
double | upperValue, | |||
double | costValue = 0.0 | |||
) |
Sets bounds and infeasible cost and true cost for one variable This is for gub and column generation etc.
int ClpNonLinearCost::setOneOutgoing | ( | int | sequence, | |
double & | solutionValue | |||
) |
Sets bounds and cost for outgoing variable may change value Returns direction.
double ClpNonLinearCost::nearest | ( | int | sequence, | |
double | solutionValue | |||
) |
Returns nearest bound.
double ClpNonLinearCost::changeInCost | ( | int | sequence, | |
double | alpha | |||
) | const [inline] |
Returns change in cost - one down if alpha >0.0, up if <0.0 Value is current - new.
Definition at line 160 of file ClpNonLinearCost.hpp.
double ClpNonLinearCost::changeUpInCost | ( | int | sequence | ) | const [inline] |
Changes infeasible costs and computes number and cost of infeas Puts all non-basic (non free) variables to bounds and all free variables to zero if oldTolerance is non-zero
Definition at line 175 of file ClpNonLinearCost.hpp.
double ClpNonLinearCost::changeDownInCost | ( | int | sequence | ) | const [inline] |
Changes infeasible costs and computes number and cost of infeas Puts all non-basic (non free) variables to bounds and all free variables to zero if oldTolerance is non-zero
Definition at line 190 of file ClpNonLinearCost.hpp.
double ClpNonLinearCost::changeInCost | ( | int | sequence, | |
double | alpha, | |||
double & | rhs | |||
) | [inline] |
double ClpNonLinearCost::lower | ( | int | sequence | ) | const [inline] |
double ClpNonLinearCost::upper | ( | int | sequence | ) | const [inline] |
double ClpNonLinearCost::cost | ( | int | sequence | ) | const [inline] |
int ClpNonLinearCost::numberInfeasibilities | ( | ) | const [inline] |
double ClpNonLinearCost::changeInCost | ( | ) | const [inline] |
double ClpNonLinearCost::feasibleCost | ( | ) | const [inline] |
double ClpNonLinearCost::feasibleReportCost | ( | ) | const |
Feasible cost with offset and direction (i.e. for reporting).
double ClpNonLinearCost::sumInfeasibilities | ( | ) | const [inline] |
double ClpNonLinearCost::largestInfeasibility | ( | ) | const [inline] |
double ClpNonLinearCost::averageTheta | ( | ) | const [inline] |
void ClpNonLinearCost::setAverageTheta | ( | double | value | ) | [inline] |
void ClpNonLinearCost::setChangeInCost | ( | double | value | ) | [inline] |
void ClpNonLinearCost::setMethod | ( | int | value | ) | [inline] |
bool ClpNonLinearCost::lookBothWays | ( | ) | const [inline] |
bool ClpNonLinearCost::infeasible | ( | int | i | ) | const [inline] |
void ClpNonLinearCost::setInfeasible | ( | int | i, | |
bool | trueFalse | |||
) | [inline] |
unsigned char* ClpNonLinearCost::statusArray | ( | ) | const [inline] |
void ClpNonLinearCost::validate | ( | ) |
For debug.
double ClpNonLinearCost::changeCost_ [private] |
double ClpNonLinearCost::feasibleCost_ [private] |
double ClpNonLinearCost::infeasibilityWeight_ [private] |
double ClpNonLinearCost::largestInfeasibility_ [private] |
double ClpNonLinearCost::sumInfeasibilities_ [private] |
double ClpNonLinearCost::averageTheta_ [private] |
int ClpNonLinearCost::numberRows_ [private] |
int ClpNonLinearCost::numberColumns_ [private] |
Number of columns (mainly for checking and copy).
Definition at line 345 of file ClpNonLinearCost.hpp.
int* ClpNonLinearCost::start_ [private] |
int* ClpNonLinearCost::whichRange_ [private] |
int* ClpNonLinearCost::offset_ [private] |
Temporary range offset for each entry (columns then rows).
Definition at line 351 of file ClpNonLinearCost.hpp.
double* ClpNonLinearCost::lower_ [private] |
Lower bound for each range (upper bound is next lower).
For various reasons there is always an infeasible range at bottom - even if lower bound is - infinity
Definition at line 355 of file ClpNonLinearCost.hpp.
double* ClpNonLinearCost::cost_ [private] |
ClpSimplex* ClpNonLinearCost::model_ [private] |
unsigned int* ClpNonLinearCost::infeasible_ [private] |
int ClpNonLinearCost::numberInfeasibilities_ [private] |
unsigned char* ClpNonLinearCost::status_ [private] |
double* ClpNonLinearCost::bound_ [private] |
Bound which has been replaced in lower_ or upper_.
Definition at line 368 of file ClpNonLinearCost.hpp.
double* ClpNonLinearCost::cost2_ [private] |
int ClpNonLinearCost::method_ [private] |
bool ClpNonLinearCost::convex_ [private] |
bool ClpNonLinearCost::bothWays_ [private] |