#include <ClpNonLinearCost.hpp>
Public Member Functions | |
Constructors, destructor | |
ClpNonLinearCost () | |
Default constructor. More... | |
ClpNonLinearCost (ClpSimplex *model, int method=1) | |
Constructor from simplex. More... | |
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. More... | |
~ClpNonLinearCost () | |
Destructor. More... | |
ClpNonLinearCost (const ClpNonLinearCost &) | |
Default constructor. More... | |
ClpNonLinearCost & | operator= (const ClpNonLinearCost &) |
Default constructor. More... | |
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. More... | |
void | checkInfeasibilities (int numberInArray, const int *index) |
Changes infeasible costs for each variable The indices are row indices and need converting to sequences. More... | |
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. More... | |
void | goThru (int numberInArray, double multiplier, const int *index, const double *work, double *rhs) |
Goes through one bound for each variable. More... | |
void | goBack (int numberInArray, const int *index, double *rhs) |
Takes off last iteration (i.e. More... | |
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. More... | |
void | zapCosts () |
Temporary zeroing of feasible costs. More... | |
void | refreshCosts (const double *columnCosts) |
Refreshes costs always makes row costs zero. More... | |
void | feasibleBounds () |
Puts feasible bounds into lower and upper. More... | |
void | refresh () |
Refresh - assuming regions OK. More... | |
double | setOne (int sequence, double solutionValue) |
Sets bounds and cost for one variable Returns change in cost May need to be inline for speed. More... | |
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. More... | |
int | setOneOutgoing (int sequence, double &solutionValue) |
Sets bounds and cost for outgoing variable may change value Returns direction. More... | |
double | nearest (int sequence, double solutionValue) |
Returns nearest bound. More... | |
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. More... | |
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. More... | |
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. More... | |
double | changeInCost (int sequence, double alpha, double &rhs) |
This also updates next bound. More... | |
double | lower (int sequence) const |
Returns current lower bound. More... | |
double | upper (int sequence) const |
Returns current upper bound. More... | |
double | cost (int sequence) const |
Returns current cost. More... | |
Gets and sets | |
int | numberInfeasibilities () const |
Number of infeasibilities. More... | |
double | changeInCost () const |
Change in cost. More... | |
double | feasibleCost () const |
Feasible cost. More... | |
double | feasibleReportCost () const |
Feasible cost with offset and direction (i.e. for reporting) More... | |
double | sumInfeasibilities () const |
Sum of infeasibilities. More... | |
double | largestInfeasibility () const |
Largest infeasibility. More... | |
double | averageTheta () const |
Average theta. More... | |
void | setAverageTheta (double value) |
Number of infeasibilities. More... | |
void | setChangeInCost (double value) |
Number of infeasibilities. More... | |
void | setMethod (int value) |
Number of infeasibilities. More... | |
bool | lookBothWays () const |
See if may want to look both ways. More... | |
Private functions to deal with infeasible regions | |
bool | infeasible (int i) const |
For debug. More... | |
void | setInfeasible (int i, bool trueFalse) |
For debug. More... | |
unsigned char * | statusArray () const |
For debug. More... | |
void | validate () |
For debug. More... | |
Private Attributes | |
Data members | |
double | changeCost_ |
Change in cost because of infeasibilities. More... | |
double | feasibleCost_ |
Feasible cost. More... | |
double | infeasibilityWeight_ |
Current infeasibility weight. More... | |
double | largestInfeasibility_ |
Largest infeasibility. More... | |
double | sumInfeasibilities_ |
Sum of infeasibilities. More... | |
double | averageTheta_ |
Average theta - kept here as only for primal. More... | |
int | numberRows_ |
Number of rows (mainly for checking and copy) More... | |
int | numberColumns_ |
Number of columns (mainly for checking and copy) More... | |
int * | start_ |
Starts for each entry (columns then rows) More... | |
int * | whichRange_ |
Range for each entry (columns then rows) More... | |
int * | offset_ |
Temporary range offset for each entry (columns then rows) More... | |
double * | lower_ |
Lower bound for each range (upper bound is next lower). More... | |
double * | cost_ |
Cost for each range. More... | |
ClpSimplex * | model_ |
Model. More... | |
unsigned int * | infeasible_ |
Change in cost because of infeasibilities. More... | |
int | numberInfeasibilities_ |
Number of infeasibilities found. More... | |
unsigned char * | status_ |
Contains status at beginning and current. More... | |
double * | bound_ |
Bound which has been replaced in lower_ or upper_. More... | |
double * | cost2_ |
Feasible cost array. More... | |
int | method_ |
Method 1 old, 2 new, 3 both! More... | |
bool | convex_ |
If all non-linear costs convex. More... | |
bool | bothWays_ |
If we should look both ways for djs. More... | |
Definition at line 78 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.
void ClpNonLinearCost::refresh | ( | ) |
Refresh - assuming regions OK.
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.
|
inline |
Returns change in cost - one down if alpha >0.0, up if <0.0 Value is current - new.
Definition at line 171 of file ClpNonLinearCost.hpp.
|
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 185 of file ClpNonLinearCost.hpp.
|
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 199 of file ClpNonLinearCost.hpp.
|
inline |
This also updates next bound.
Definition at line 214 of file ClpNonLinearCost.hpp.
|
inline |
Returns current lower bound.
Definition at line 273 of file ClpNonLinearCost.hpp.
|
inline |
Returns current upper bound.
Definition at line 277 of file ClpNonLinearCost.hpp.
|
inline |
Returns current cost.
Definition at line 281 of file ClpNonLinearCost.hpp.
|
inline |
Number of infeasibilities.
Definition at line 290 of file ClpNonLinearCost.hpp.
|
inline |
Change in cost.
Definition at line 294 of file ClpNonLinearCost.hpp.
|
inline |
Feasible cost.
Definition at line 298 of file ClpNonLinearCost.hpp.
double ClpNonLinearCost::feasibleReportCost | ( | ) | const |
Feasible cost with offset and direction (i.e. for reporting)
|
inline |
Sum of infeasibilities.
Definition at line 304 of file ClpNonLinearCost.hpp.
|
inline |
Largest infeasibility.
Definition at line 308 of file ClpNonLinearCost.hpp.
|
inline |
Average theta.
Definition at line 312 of file ClpNonLinearCost.hpp.
|
inline |
Number of infeasibilities.
Definition at line 315 of file ClpNonLinearCost.hpp.
|
inline |
Number of infeasibilities.
Definition at line 318 of file ClpNonLinearCost.hpp.
|
inline |
Number of infeasibilities.
Definition at line 321 of file ClpNonLinearCost.hpp.
|
inline |
See if may want to look both ways.
Definition at line 325 of file ClpNonLinearCost.hpp.
|
inline |
For debug.
Definition at line 330 of file ClpNonLinearCost.hpp.
|
inline |
For debug.
Definition at line 333 of file ClpNonLinearCost.hpp.
|
inline |
For debug.
Definition at line 341 of file ClpNonLinearCost.hpp.
void ClpNonLinearCost::validate | ( | ) |
For debug.
|
private |
Change in cost because of infeasibilities.
Definition at line 352 of file ClpNonLinearCost.hpp.
|
private |
Feasible cost.
Definition at line 354 of file ClpNonLinearCost.hpp.
|
private |
Current infeasibility weight.
Definition at line 356 of file ClpNonLinearCost.hpp.
|
private |
Largest infeasibility.
Definition at line 358 of file ClpNonLinearCost.hpp.
|
private |
Sum of infeasibilities.
Definition at line 360 of file ClpNonLinearCost.hpp.
|
private |
Average theta - kept here as only for primal.
Definition at line 362 of file ClpNonLinearCost.hpp.
|
private |
Number of rows (mainly for checking and copy)
Definition at line 364 of file ClpNonLinearCost.hpp.
|
private |
Number of columns (mainly for checking and copy)
Definition at line 366 of file ClpNonLinearCost.hpp.
|
private |
Starts for each entry (columns then rows)
Definition at line 368 of file ClpNonLinearCost.hpp.
|
private |
Range for each entry (columns then rows)
Definition at line 370 of file ClpNonLinearCost.hpp.
|
private |
Temporary range offset for each entry (columns then rows)
Definition at line 372 of file ClpNonLinearCost.hpp.
|
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 376 of file ClpNonLinearCost.hpp.
|
private |
Cost for each range.
Definition at line 378 of file ClpNonLinearCost.hpp.
|
private |
Model.
Definition at line 380 of file ClpNonLinearCost.hpp.
|
private |
Change in cost because of infeasibilities.
Definition at line 382 of file ClpNonLinearCost.hpp.
|
private |
Number of infeasibilities found.
Definition at line 384 of file ClpNonLinearCost.hpp.
|
private |
Contains status at beginning and current.
Definition at line 387 of file ClpNonLinearCost.hpp.
|
private |
Bound which has been replaced in lower_ or upper_.
Definition at line 389 of file ClpNonLinearCost.hpp.
|
private |
Feasible cost array.
Definition at line 391 of file ClpNonLinearCost.hpp.
|
private |
Method 1 old, 2 new, 3 both!
Definition at line 393 of file ClpNonLinearCost.hpp.
|
private |
If all non-linear costs convex.
Definition at line 395 of file ClpNonLinearCost.hpp.
|
private |
If we should look both ways for djs.
Definition at line 397 of file ClpNonLinearCost.hpp.