Ignore:
Timestamp:
Jan 6, 2019 2:43:06 PM (4 months ago)
Author:
unxusr
Message:

formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/ClpConstraint.hpp

    r1665 r2385  
    66#ifndef ClpConstraint_H
    77#define ClpConstraint_H
    8 
    98
    109//#############################################################################
     
    1716
    1817*/
    19 class ClpConstraint  {
     18class ClpConstraint {
    2019
    2120public:
     21  ///@name Stuff
     22  //@{
    2223
    23      ///@name Stuff
    24      //@{
    25 
    26      /** Fills gradient.  If Linear then solution may be NULL,
     24  /** Fills gradient.  If Linear then solution may be NULL,
    2725         also returns true value of function and offset so we can use x not deltaX in constraint
    2826         If refresh is false then uses last solution
     
    3028         Returns non-zero if gradient undefined at current solution
    3129     */
    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;
    39      /// Constraint function value
    40      virtual double functionValue (const ClpSimplex * model,
    41                                    const double * solution,
    42                                    bool useScaling = false,
    43                                    bool refresh = true) const ;
    44      /// Resize constraint
    45      virtual void resize(int newNumberColumns) = 0;
    46      /// Delete columns in  constraint
    47      virtual void deleteSome(int numberToDelete, const int * which) = 0;
    48      /// Scale constraint
    49      virtual void reallyScale(const double * columnScale) = 0;
    50      /** Given a zeroed array sets nonlinear columns to 1.
     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;
     37  /// Constraint function value
     38  virtual double functionValue(const ClpSimplex *model,
     39    const double *solution,
     40    bool useScaling = false,
     41    bool refresh = true) const;
     42  /// Resize constraint
     43  virtual void resize(int newNumberColumns) = 0;
     44  /// Delete columns in  constraint
     45  virtual void deleteSome(int numberToDelete, const int *which) = 0;
     46  /// Scale constraint
     47  virtual void reallyScale(const double *columnScale) = 0;
     48  /** Given a zeroed array sets nonlinear columns to 1.
    5149         Returns number of nonlinear columns
    5250      */
    53      virtual int markNonlinear(char * which) const = 0;
    54      /** Given a zeroed array sets possible nonzero coefficients to 1.
     51  virtual int markNonlinear(char *which) const = 0;
     52  /** Given a zeroed array sets possible nonzero coefficients to 1.
    5553         Returns number of nonzeros
    5654      */
    57      virtual int markNonzero(char * which) const = 0;
    58      //@}
     55  virtual int markNonzero(char *which) const = 0;
     56  //@}
    5957
     58  ///@name Constructors and destructors
     59  //@{
     60  /// Default Constructor
     61  ClpConstraint();
    6062
    61      ///@name Constructors and destructors
    62      //@{
    63      /// Default Constructor
    64      ClpConstraint();
     63  /// Copy constructor
     64  ClpConstraint(const ClpConstraint &);
    6565
    66      /// Copy constructor
    67      ClpConstraint(const ClpConstraint &);
     66  /// Assignment operator
     67  ClpConstraint &operator=(const ClpConstraint &rhs);
    6868
    69      /// Assignment operator
    70      ClpConstraint & operator=(const ClpConstraint& rhs);
     69  /// Destructor
     70  virtual ~ClpConstraint();
    7171
    72      /// Destructor
    73      virtual ~ClpConstraint ();
     72  /// Clone
     73  virtual ClpConstraint *clone() const = 0;
    7474
    75      /// Clone
    76      virtual ClpConstraint * clone() const = 0;
     75  //@}
    7776
    78      //@}
     77  ///@name Other
     78  //@{
     79  /// Returns type, 0 linear, 1 nonlinear
     80  inline int type()
     81  {
     82    return type_;
     83  }
     84  /// Row number (-1 is objective)
     85  inline int rowNumber() const
     86  {
     87    return rowNumber_;
     88  }
    7989
    80      ///@name Other
    81      //@{
    82      /// Returns type, 0 linear, 1 nonlinear
    83      inline int type() {
    84           return type_;
    85      }
    86      /// Row number (-1 is objective)
    87      inline int rowNumber() const {
    88           return rowNumber_;
    89      }
     90  /// Number of possible coefficients in gradient
     91  virtual int numberCoefficients() const = 0;
    9092
    91      /// Number of possible coefficients in gradient
    92      virtual int numberCoefficients() const = 0;
     93  /// Stored constraint function value
     94  inline double functionValue() const
     95  {
     96    return functionValue_;
     97  }
    9398
    94      /// Stored constraint function value
    95      inline double functionValue () const {
    96           return functionValue_;
    97      }
     99  /// Constraint offset
     100  inline double offset() const
     101  {
     102    return offset_;
     103  }
     104  /// Say we have new primal solution - so may need to recompute
     105  virtual void newXValues() {}
     106  //@}
    98107
    99      /// Constraint offset
    100      inline double offset () const {
    101           return offset_;
    102      }
    103      /// Say we have new primal solution - so may need to recompute
    104      virtual void newXValues() {}
    105      //@}
    106 
    107      //---------------------------------------------------------------------------
     108  //---------------------------------------------------------------------------
    108109
    109110protected:
    110      ///@name Protected member data
    111      //@{
    112      /// Gradient at last evaluation
    113      mutable double * lastGradient_;
    114      /// Value of non-linear part of constraint
    115      mutable double functionValue_;
    116      /// Value of offset for constraint
    117      mutable double offset_;
    118      /// Type of constraint - linear is 1
    119      int type_;
    120      /// Row number (-1 is objective)
    121      int rowNumber_;
    122      //@}
     111  ///@name Protected member data
     112  //@{
     113  /// Gradient at last evaluation
     114  mutable double *lastGradient_;
     115  /// Value of non-linear part of constraint
     116  mutable double functionValue_;
     117  /// Value of offset for constraint
     118  mutable double offset_;
     119  /// Type of constraint - linear is 1
     120  int type_;
     121  /// Row number (-1 is objective)
     122  int rowNumber_;
     123  //@}
    123124};
    124125
    125126#endif
     127
     128/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
     129*/
Note: See TracChangeset for help on using the changeset viewer.