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.cpp

    r1665 r2385  
    1515// Default Constructor
    1616//-------------------------------------------------------------------
    17 ClpConstraint::ClpConstraint () :
    18      lastGradient_(NULL),
    19      functionValue_(0.0),
    20      offset_(0.0),
    21      type_(-1),
    22     rowNumber_(-1)
     17ClpConstraint::ClpConstraint()
     18  : lastGradient_(NULL)
     19  , functionValue_(0.0)
     20  , offset_(0.0)
     21  , type_(-1)
     22  , rowNumber_(-1)
    2323{
    24 
    2524}
    2625
     
    2827// Copy constructor
    2928//-------------------------------------------------------------------
    30 ClpConstraint::ClpConstraint (const ClpConstraint & source) :
    31      lastGradient_(NULL),
    32      functionValue_(source.functionValue_),
    33      offset_(source.offset_),
    34      type_(source.type_),
    35     rowNumber_(source.rowNumber_)
     29ClpConstraint::ClpConstraint(const ClpConstraint &source)
     30  : lastGradient_(NULL)
     31  , functionValue_(source.functionValue_)
     32  , offset_(source.offset_)
     33  , type_(source.type_)
     34  , rowNumber_(source.rowNumber_)
    3635{
    37 
    3836}
    3937
     
    4139// Destructor
    4240//-------------------------------------------------------------------
    43 ClpConstraint::~ClpConstraint ()
     41ClpConstraint::~ClpConstraint()
    4442{
    45      delete [] lastGradient_;
    46 
     43  delete[] lastGradient_;
    4744}
    4845
     
    5148//-------------------------------------------------------------------
    5249ClpConstraint &
    53 ClpConstraint::operator=(const ClpConstraint& rhs)
     50ClpConstraint::operator=(const ClpConstraint &rhs)
    5451{
    55      if (this != &rhs) {
    56           functionValue_ = rhs.functionValue_;
    57           offset_ = rhs.offset_;
    58           type_ = rhs.type_;
    59           rowNumber_ = rhs.rowNumber_;
    60           delete [] lastGradient_;
    61           lastGradient_ = NULL;
    62      }
    63      return *this;
     52  if (this != &rhs) {
     53    functionValue_ = rhs.functionValue_;
     54    offset_ = rhs.offset_;
     55    type_ = rhs.type_;
     56    rowNumber_ = rhs.rowNumber_;
     57    delete[] lastGradient_;
     58    lastGradient_ = NULL;
     59  }
     60  return *this;
    6461}
    6562// Constraint function value
    6663double
    67 ClpConstraint::functionValue (const ClpSimplex * model,
    68                               const double * solution,
    69                               bool useScaling,
    70                               bool refresh) const
     64ClpConstraint::functionValue(const ClpSimplex *model,
     65  const double *solution,
     66  bool useScaling,
     67  bool refresh) const
    7168{
    72      double offset;
    73      double value;
    74      int n = model->numberColumns();
    75      double * grad = new double [n];
    76      gradient(model, solution, grad, value, offset, useScaling, refresh);
    77      delete [] grad;
    78      return value;
     69  double offset;
     70  double value;
     71  int n = model->numberColumns();
     72  double *grad = new double[n];
     73  gradient(model, solution, grad, value, offset, useScaling, refresh);
     74  delete[] grad;
     75  return value;
    7976}
    8077
     78/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
     79*/
Note: See TracChangeset for help on using the changeset viewer.