Loading...
Searching...
No Matches
ClpNonLinearCost Class Reference

`#include <ClpNonLinearCost.hpp>`

Collaboration diagram for ClpNonLinearCost:
[legend]

## 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 &)
ClpNonLinearCost & | operator= (const ClpNonLinearCost &)
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.
void | refresh ()
| Refresh - assuming regions OK.
void | refresh (int iSequence)
| Refresh one- assuming regions OK.
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
double | changeDownInCost (int sequence) const
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.
int | fullStatus (int sequence) const
| Returns full status.
bool | changed (int sequence) const
| Returns if changed from beginning of iteration.
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)
void | setChangeInCost (double value)
void | setMethod (int value)
bool | lookBothWays () const
| See if may want to look both ways.
Private functions to deal with infeasible regions
bool | infeasible (int i) const
void | setInfeasible (int i, bool trueFalse)
unsigned char * | statusArray () const
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_
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.

## Detailed Description

Definition at line 77 of file ClpNonLinearCost.hpp.

## Constructor & Destructor Documentation

## ClpNonLinearCost() [1/4]

ClpNonLinearCost::ClpNonLinearCost | ( |  | ) |

Default constructor.

## ClpNonLinearCost() [2/4]

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() [3/4]

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::~ClpNonLinearCost | ( |  | ) |

Destructor.

## ClpNonLinearCost() [4/4]

ClpNonLinearCost::ClpNonLinearCost | ( | const ClpNonLinearCost & |  | ) |

## Member Function Documentation

## operator=()

ClpNonLinearCost & ClpNonLinearCost::operator= | ( | const ClpNonLinearCost & |  | ) |

## checkInfeasibilities() [1/2]

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.

- but does not move those <= oldTolerance away

## checkInfeasibilities() [2/2]

void ClpNonLinearCost::checkInfeasibilities | ( | int | numberInArray,
|  | const int * | index )

Changes infeasible costs for each variable The indices are row indices and need converting to sequences.

## checkChanged()

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

## goThru()

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

## goBack()

void ClpNonLinearCost::goBack | ( | int | numberInArray,
|  | const int * | index,
|  | double * | rhs )

Takes off last iteration (i.e.

offsets closer to 0)

## goBackAll()

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

## zapCosts()

void ClpNonLinearCost::zapCosts | ( |  | ) |

Temporary zeroing of feasible costs.

## refreshCosts()

void ClpNonLinearCost::refreshCosts | ( | const double * | columnCosts | ) |

Refreshes costs always makes row costs zero.

## feasibleBounds()

void ClpNonLinearCost::feasibleBounds | ( |  | ) |

Puts feasible bounds into lower and upper.

## refresh() [1/2]

void ClpNonLinearCost::refresh | ( |  | ) |

Refresh - assuming regions OK.

## refresh() [2/2]

void ClpNonLinearCost::refresh | ( | int | iSequence | ) |

Refresh one- assuming regions OK.

## setOne() [1/2]

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.

## setOne() [2/2]

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.

## setOneOutgoing()

int ClpNonLinearCost::setOneOutgoing | ( | int | sequence,
|  | double & | solutionValue )

Sets bounds and cost for outgoing variable may change value Returns direction.

## nearest()

double ClpNonLinearCost::nearest | ( | int | sequence,
|  | double | solutionValue )

Returns nearest bound.

## changeInCost() [1/3]

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 169 of file ClpNonLinearCost.hpp.

## changeUpInCost()

double ClpNonLinearCost::changeUpInCost | ( | int | sequence | ) | const

inline

Definition at line 184 of file ClpNonLinearCost.hpp.

## changeDownInCost()

double ClpNonLinearCost::changeDownInCost | ( | int | sequence | ) | const

inline

Definition at line 199 of file ClpNonLinearCost.hpp.

## changeInCost() [2/3]

double ClpNonLinearCost::changeInCost | ( | int | sequence,
|  | double | alpha,
|  | double & | rhs )

inline

This also updates next bound.

Definition at line 215 of file ClpNonLinearCost.hpp.

## lower()

double ClpNonLinearCost::lower | ( | int | sequence | ) | const

inline

Returns current lower bound.

Definition at line 275 of file ClpNonLinearCost.hpp.

## upper()

double ClpNonLinearCost::upper | ( | int | sequence | ) | const

inline

Returns current upper bound.

Definition at line 280 of file ClpNonLinearCost.hpp.

## cost()

double ClpNonLinearCost::cost | ( | int | sequence | ) | const

inline

Returns current cost.

Definition at line 285 of file ClpNonLinearCost.hpp.

## fullStatus()

int ClpNonLinearCost::fullStatus | ( | int | sequence | ) | const

inline

Returns full status.

Definition at line 290 of file ClpNonLinearCost.hpp.

## changed()

bool ClpNonLinearCost::changed | ( | int | sequence | ) | const

inline

Returns if changed from beginning of iteration.

Definition at line 295 of file ClpNonLinearCost.hpp.

## numberInfeasibilities()

int ClpNonLinearCost::numberInfeasibilities | ( |  | ) | const

inline

Number of infeasibilities.

Definition at line 305 of file ClpNonLinearCost.hpp.

## changeInCost() [3/3]

double ClpNonLinearCost::changeInCost | ( |  | ) | const

inline

Change in cost.

Definition at line 310 of file ClpNonLinearCost.hpp.

## feasibleCost()

double ClpNonLinearCost::feasibleCost | ( |  | ) | const

inline

Feasible cost.

Definition at line 315 of file ClpNonLinearCost.hpp.

## feasibleReportCost()

double ClpNonLinearCost::feasibleReportCost | ( |  | ) | const

Feasible cost with offset and direction (i.e. for reporting).

## sumInfeasibilities()

double ClpNonLinearCost::sumInfeasibilities | ( |  | ) | const

inline

Sum of infeasibilities.

Definition at line 322 of file ClpNonLinearCost.hpp.

## largestInfeasibility()

double ClpNonLinearCost::largestInfeasibility | ( |  | ) | const

inline

Largest infeasibility.

Definition at line 327 of file ClpNonLinearCost.hpp.

## averageTheta()

double ClpNonLinearCost::averageTheta | ( |  | ) | const

inline

Average theta.

Definition at line 332 of file ClpNonLinearCost.hpp.

## setAverageTheta()

void ClpNonLinearCost::setAverageTheta | ( | double | value | ) |

inline

Definition at line 336 of file ClpNonLinearCost.hpp.

## setChangeInCost()

void ClpNonLinearCost::setChangeInCost | ( | double | value | ) |

inline

Definition at line 340 of file ClpNonLinearCost.hpp.

## setMethod()

void ClpNonLinearCost::setMethod | ( | int | value | ) |

inline

Definition at line 344 of file ClpNonLinearCost.hpp.

## lookBothWays()

bool ClpNonLinearCost::lookBothWays | ( |  | ) | const

inline

See if may want to look both ways.

Definition at line 349 of file ClpNonLinearCost.hpp.

## infeasible()

bool ClpNonLinearCost::infeasible | ( | int | i | ) | const

inline

Definition at line 355 of file ClpNonLinearCost.hpp.

## setInfeasible()

void ClpNonLinearCost::setInfeasible | ( | int | i,
|  | bool | trueFalse )

inline

Definition at line 359 of file ClpNonLinearCost.hpp.

## statusArray()

unsigned char * ClpNonLinearCost::statusArray | ( |  | ) | const

inline

Definition at line 368 of file ClpNonLinearCost.hpp.

## validate()

void ClpNonLinearCost::validate | ( |  | ) |

For debug.

## Member Data Documentation

## changeCost_

double ClpNonLinearCost::changeCost_

private

Change in cost because of infeasibilities.

Definition at line 380 of file ClpNonLinearCost.hpp.

## feasibleCost_

double ClpNonLinearCost::feasibleCost_

private

Feasible cost.

Definition at line 382 of file ClpNonLinearCost.hpp.

## infeasibilityWeight_

double ClpNonLinearCost::infeasibilityWeight_

private

Current infeasibility weight.

Definition at line 384 of file ClpNonLinearCost.hpp.

## largestInfeasibility_

double ClpNonLinearCost::largestInfeasibility_

private

Largest infeasibility.

Definition at line 386 of file ClpNonLinearCost.hpp.

## sumInfeasibilities_

double ClpNonLinearCost::sumInfeasibilities_

private

Sum of infeasibilities.

Definition at line 388 of file ClpNonLinearCost.hpp.

## averageTheta_

double ClpNonLinearCost::averageTheta_

private

Average theta - kept here as only for primal.

Definition at line 390 of file ClpNonLinearCost.hpp.

## numberRows_

int ClpNonLinearCost::numberRows_

private

Number of rows (mainly for checking and copy).

Definition at line 392 of file ClpNonLinearCost.hpp.

## numberColumns_

int ClpNonLinearCost::numberColumns_

private

Number of columns (mainly for checking and copy).

Definition at line 394 of file ClpNonLinearCost.hpp.

## start_

int* ClpNonLinearCost::start_

private

Starts for each entry (columns then rows).

Definition at line 396 of file ClpNonLinearCost.hpp.

## whichRange_

int* ClpNonLinearCost::whichRange_

private

Range for each entry (columns then rows).

Definition at line 398 of file ClpNonLinearCost.hpp.

## offset_

int* ClpNonLinearCost::offset_

private

Temporary range offset for each entry (columns then rows).

Definition at line 400 of file ClpNonLinearCost.hpp.

## lower_

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 404 of file ClpNonLinearCost.hpp.

## cost_

double* ClpNonLinearCost::cost_

private

Cost for each range.

Definition at line 406 of file ClpNonLinearCost.hpp.

## model_

ClpSimplex* ClpNonLinearCost::model_

private

Model.

Definition at line 408 of file ClpNonLinearCost.hpp.

## infeasible_

unsigned int* ClpNonLinearCost::infeasible_

private

Definition at line 410 of file ClpNonLinearCost.hpp.

## numberInfeasibilities_

int ClpNonLinearCost::numberInfeasibilities_

private

Number of infeasibilities found.

Definition at line 412 of file ClpNonLinearCost.hpp.

## status_

unsigned char* ClpNonLinearCost::status_

private

Contains status at beginning and current.

Definition at line 415 of file ClpNonLinearCost.hpp.

## bound_

double* ClpNonLinearCost::bound_

private

Bound which has been replaced in lower_ or upper_.

Definition at line 417 of file ClpNonLinearCost.hpp.

## cost2_

double* ClpNonLinearCost::cost2_

private

Feasible cost array.

Definition at line 419 of file ClpNonLinearCost.hpp.

## method_

int ClpNonLinearCost::method_

private

Method 1 old, 2 new, 3 both!

Definition at line 421 of file ClpNonLinearCost.hpp.

## convex_

bool ClpNonLinearCost::convex_

private

If all non-linear costs convex.

Definition at line 423 of file ClpNonLinearCost.hpp.

## bothWays_

bool ClpNonLinearCost::bothWays_

private

If we should look both ways for djs.

Definition at line 425 of file ClpNonLinearCost.hpp.

The documentation for this class was generated from the following file:

- Clp/src/ClpNonLinearCost.hpp