source: trunk/Clp/src/ClpConstraintQuadratic.hpp @ 1525

Last change on this file since 1525 was 1525, checked in by mjs, 10 years ago

Formatted .cpp, .hpp, .c, .h files with "astyle -A4 -p". This matches the formatting used in the grand CBC reorganization.

  • Property svn:keywords set to Id
File size: 3.4 KB
Line 
1/* $Id: ClpConstraintQuadratic.hpp 1525 2010-02-26 17:27:59Z mjs $ */
2// Copyright (C) 2007, International Business Machines
3// Corporation and others.  All Rights Reserved.
4#ifndef ClpConstraintQuadratic_H
5#define ClpConstraintQuadratic_H
6
7#include "ClpConstraint.hpp"
8
9//#############################################################################
10
11/** Quadratic Constraint Class
12
13*/
14
15class ClpConstraintQuadratic : public ClpConstraint {
16
17public:
18
19     ///@name Stuff
20     //@{
21
22
23     /** Fills gradient.  If Quadratic then solution may be NULL,
24         also returns true value of function and offset so we can use x not deltaX in constraint
25         If refresh is false then uses last solution
26         Uses model for scaling
27         Returns non-zero if gradient udefined at current solution
28     */
29     virtual int gradient(const ClpSimplex * model,
30                          const double * solution,
31                          double * gradient,
32                          double & functionValue ,
33                          double & offset,
34                          bool useScaling = false,
35                          bool refresh = true) const ;
36     /// Resize constraint
37     virtual void resize(int newNumberColumns) ;
38     /// Delete columns in  constraint
39     virtual void deleteSome(int numberToDelete, const int * which) ;
40     /// Scale constraint
41     virtual void reallyScale(const double * columnScale) ;
42     /** Given a zeroed array sets nonquadratic columns to 1.
43         Returns number of nonquadratic columns
44      */
45     virtual int markNonlinear(char * which) const ;
46     /** Given a zeroed array sets possible nonzero coefficients to 1.
47         Returns number of nonzeros
48      */
49     virtual int markNonzero(char * which) const;
50     //@}
51
52
53     ///@name Constructors and destructors
54     //@{
55     /// Default Constructor
56     ClpConstraintQuadratic();
57
58     /// Constructor from quadratic
59     ClpConstraintQuadratic(int row, int numberQuadraticColumns, int numberColumns,
60                            const CoinBigIndex * start,
61                            const int * column, const double * element);
62
63     /** Copy constructor .
64     */
65     ClpConstraintQuadratic(const ClpConstraintQuadratic & rhs);
66
67     /// Assignment operator
68     ClpConstraintQuadratic & operator=(const ClpConstraintQuadratic& rhs);
69
70     /// Destructor
71     virtual ~ClpConstraintQuadratic ();
72
73     /// Clone
74     virtual ClpConstraint * clone() const;
75     //@}
76     ///@name Gets and sets
77     //@{
78     /// Number of coefficients
79     virtual int numberCoefficients() const;
80     /// Number of columns in constraint
81     inline int numberColumns() const {
82          return numberColumns_;
83     }
84     /// Column starts
85     inline CoinBigIndex * start() const {
86          return start_;
87     }
88     /// Columns
89     inline const int * column() const {
90          return column_;
91     }
92     /// Coefficients
93     inline const double * coefficient() const {
94          return coefficient_;
95     }
96     //@}
97
98     //---------------------------------------------------------------------------
99
100private:
101     ///@name Private member data
102     /// Column starts
103     CoinBigIndex * start_;
104     /// Column (if -1 then linear coefficient)
105     int * column_;
106     /// Coefficients
107     double * coefficient_;
108     /// Useful to have number of columns about
109     int numberColumns_;
110     /// Number of coefficients in gradient
111     int numberCoefficients_;
112     /// Number of quadratic columns
113     int numberQuadraticColumns_;
114     //@}
115};
116
117#endif
Note: See TracBrowser for help on using the repository browser.