Loading...
Searching...
No Matches
ClpConstraint.hpp
Go to the documentation of this file.
/* $Id$ */
// Copyright (C) 2007, International Business Machines
// Corporation and others. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
#ifndef ClpConstraint_H
#define ClpConstraint_H
//#############################################################################
class ClpSimplex;
class ClpModel;
class ClpConstraint {
public:
virtual int gradient(const ClpSimplex *model,
const double *solution,
double *gradient,
double &functionValue,
double &offset,
bool useScaling = false,
bool refresh = true) const = 0;
virtual double functionValue(const ClpSimplex *model,
const double *solution,
bool useScaling = false,
bool refresh = true) const;
virtual void resize(int newNumberColumns) = 0;
virtual void deleteSome(int numberToDelete, const int *which) = 0;
virtual void reallyScale(const double *columnScale) = 0;
virtual int markNonlinear(char *which) const = 0;
virtual int markNonzero(char *which) const = 0;
ClpConstraint();
ClpConstraint(const ClpConstraint &);
ClpConstraint &operator=(const ClpConstraint &rhs);
virtual ~ClpConstraint();
virtual ClpConstraint *clone() const = 0;
inline int type()
{
return type_;
}
inline int rowNumber() const
{
return rowNumber_;
}
virtual int numberCoefficients() const = 0;
inline double functionValue() const
{
return functionValue_;
}
inline double offset() const
{
return offset_;
}
virtual void newXValues() {}
//---------------------------------------------------------------------------
protected:
mutable double *lastGradient_;
mutable double functionValue_;
mutable double offset_;
int type_;
int rowNumber_;
};
#endif
/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
*/
ClpConstraint::resize
virtual void resize(int newNumberColumns)=0
Resize constraint.
ClpConstraint::reallyScale
virtual void reallyScale(const double *columnScale)=0
Scale constraint.
ClpConstraint::lastGradient_
double * lastGradient_
Gradient at last evaluation.
Definition ClpConstraint.hpp:114
ClpConstraint::offset_
double offset_
Value of offset for constraint.
Definition ClpConstraint.hpp:118
ClpConstraint::markNonlinear
virtual int markNonlinear(char *which) const =0
Given a zeroed array sets nonlinear columns to 1.
ClpConstraint::operator=
ClpConstraint & operator=(const ClpConstraint &rhs)
Assignment operator.
ClpConstraint::deleteSome
virtual void deleteSome(int numberToDelete, const int *which)=0
Delete columns in constraint.
ClpConstraint::rowNumber_
int rowNumber_
Row number (-1 is objective).
Definition ClpConstraint.hpp:122
ClpConstraint::rowNumber
int rowNumber() const
Row number (-1 is objective).
Definition ClpConstraint.hpp:85
ClpConstraint::functionValue
virtual double functionValue(const ClpSimplex *model, const double *solution, bool useScaling=false, bool refresh=true) const
Constraint function value.
ClpConstraint::offset
double offset() const
Constraint offset.
Definition ClpConstraint.hpp:100
ClpConstraint::gradient
virtual int gradient(const ClpSimplex *model, const double *solution, double *gradient, double &functionValue, double &offset, bool useScaling=false, bool refresh=true) const =0
Fills gradient.
ClpConstraint::functionValue
double functionValue() const
Stored constraint function value.
Definition ClpConstraint.hpp:94
ClpConstraint::ClpConstraint
ClpConstraint(const ClpConstraint &)
Copy constructor.
ClpConstraint::newXValues
virtual void newXValues()
Say we have new primal solution - so may need to recompute.
Definition ClpConstraint.hpp:105
ClpConstraint::type
int type()
Returns type, 0 linear, 1 nonlinear.
Definition ClpConstraint.hpp:80
ClpConstraint::functionValue_
double functionValue_
Value of non-linear part of constraint.
Definition ClpConstraint.hpp:116
ClpConstraint::type_
int type_
Type of constraint - linear is 1.
Definition ClpConstraint.hpp:120
ClpConstraint::ClpConstraint
ClpConstraint()
Default Constructor.
ClpConstraint::clone
virtual ClpConstraint * clone() const =0
Clone.
ClpConstraint::markNonzero
virtual int markNonzero(char *which) const =0
Given a zeroed array sets possible nonzero coefficients to 1.
ClpConstraint::~ClpConstraint
virtual ~ClpConstraint()
Destructor.
ClpConstraint::numberCoefficients
virtual int numberCoefficients() const =0
Number of possible coefficients in gradient.
ClpModel
Definition ClpModel.hpp:38
ClpSimplex
This solves LPs using the simplex method.
Definition ClpSimplex.hpp:106