Clp 1.17.5
Loading...
Searching...
No Matches
ClpConstraint.hpp
Go to the documentation of this file.
1/* $Id: ClpConstraint.hpp 2385 2019-01-06 19:43:06Z unxusr $ */
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//#############################################################################
10class ClpSimplex;
11class ClpModel;
12
19
20public:
22
23
30 virtual int gradient(const ClpSimplex *model,
31 const double *solution,
32 double *gradient,
33 double &functionValue,
34 double &offset,
35 bool useScaling = false,
36 bool refresh = true) const = 0;
38 virtual double functionValue(const ClpSimplex *model,
39 const double *solution,
40 bool useScaling = false,
41 bool refresh = true) const;
43 virtual void resize(int newNumberColumns) = 0;
45 virtual void deleteSome(int numberToDelete, const int *which) = 0;
47 virtual void reallyScale(const double *columnScale) = 0;
51 virtual int markNonlinear(char *which) const = 0;
55 virtual int markNonzero(char *which) const = 0;
57
59
60
62
65
68
70 virtual ~ClpConstraint();
71
73 virtual ClpConstraint *clone() const = 0;
74
76
78
79
80 inline int type()
81 {
82 return type_;
83 }
85 inline int rowNumber() const
86 {
87 return rowNumber_;
88 }
89
91 virtual int numberCoefficients() const = 0;
92
94 inline double functionValue() const
95 {
96 return functionValue_;
97 }
98
100 inline double offset() const
101 {
102 return offset_;
103 }
105 virtual void newXValues() {}
107
108 //---------------------------------------------------------------------------
109
110protected:
112
113
114 mutable double *lastGradient_;
116 mutable double functionValue_;
118 mutable double offset_;
120 int type_;
124};
125
126#endif
127
128/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
129*/
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.