Clp 1.16.9
Loading...
Searching...
No Matches
ClpConstraint.hpp
Go to the documentation of this file.
1/* $Id: ClpConstraint.hpp 1665 2011-01-04 17:55:54Z lou $ */
2// Copyright (C) 2007, International Business Machines
3// Corporation and others. All Rights Reserved.
4// This code is licensed under the terms of the Eclipse Public License (EPL).
5
6#ifndef ClpConstraint_H
7#define ClpConstraint_H
8
9
10//#############################################################################
11class ClpSimplex;
12class ClpModel;
13
20
21public:
22
24
25
32 virtual int gradient(const ClpSimplex * model,
33 const double * solution,
34 double * gradient,
35 double & functionValue ,
36 double & offset,
37 bool useScaling = false,
38 bool refresh = true) const = 0;
40 virtual double functionValue (const ClpSimplex * model,
41 const double * solution,
42 bool useScaling = false,
43 bool refresh = true) const ;
45 virtual void resize(int newNumberColumns) = 0;
47 virtual void deleteSome(int numberToDelete, const int * which) = 0;
49 virtual void reallyScale(const double * columnScale) = 0;
53 virtual int markNonlinear(char * which) const = 0;
57 virtual int markNonzero(char * which) const = 0;
59
60
62
63
65
68
71
73 virtual ~ClpConstraint ();
74
76 virtual ClpConstraint * clone() const = 0;
77
79
81
82
83 inline int type() {
84 return type_;
85 }
87 inline int rowNumber() const {
88 return rowNumber_;
89 }
90
92 virtual int numberCoefficients() const = 0;
93
95 inline double functionValue () const {
96 return functionValue_;
97 }
98
100 inline double offset () const {
101 return offset_;
102 }
104 virtual void newXValues() {}
106
107 //---------------------------------------------------------------------------
108
109protected:
111
112
113 mutable double * lastGradient_;
115 mutable double functionValue_;
117 mutable double offset_;
119 int type_;
123};
124
125#endif
Constraint Abstract Base Class.
virtual void resize(int newNumberColumns)=0
Resize constraint.
virtual void reallyScale(const double *columnScale)=0
Scale constraint.
double * lastGradient_
Gradient at last evaluation.
double offset_
Value of offset for constraint.
virtual int markNonlinear(char *which) const =0
Given a zeroed array sets nonlinear columns to 1.
ClpConstraint & operator=(const ClpConstraint &rhs)
Assignment operator.
virtual void deleteSome(int numberToDelete, const int *which)=0
Delete columns in constraint.
int rowNumber_
Row number (-1 is objective)
int rowNumber() const
Row number (-1 is objective)
virtual double functionValue(const ClpSimplex *model, const double *solution, bool useScaling=false, bool refresh=true) const
Constraint function value.
double offset() const
Constraint offset.
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.
double functionValue() const
Stored constraint function value.
ClpConstraint(const ClpConstraint &)
Copy constructor.
virtual void newXValues()
Say we have new primal solution - so may need to recompute.
int type()
Returns type, 0 linear, 1 nonlinear.
double functionValue_
Value of non-linear part of constraint.
int type_
Type of constraint - linear is 1.
ClpConstraint()
Default Constructor.
virtual ClpConstraint * clone() const =0
Clone.
virtual int markNonzero(char *which) const =0
Given a zeroed array sets possible nonzero coefficients to 1.
virtual ~ClpConstraint()
Destructor.
virtual int numberCoefficients() const =0
Number of possible coefficients in gradient.
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70