Ignore:
Timestamp:
Jan 3, 2019 2:03:23 PM (2 years ago)
Author:
unxusr
Message:

.clang-format with proposal for formatting code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/src/CbcSOS.hpp

    r2422 r2464  
    3030
    3131public:
    32 
    33     // Default Constructor
    34     CbcSOS ();
    35 
    36         /** \brief Constructor with SOS type and member information
     32  // Default Constructor
     33  CbcSOS();
     34
     35  /** \brief Constructor with SOS type and member information
    3736
    3837    Type specifies SOS 1 or 2. Identifier is an arbitrary value.
     
    4443        */
    4544
    46     CbcSOS (CbcModel * model, int numberMembers,
    47             const int * which, const double * weights, int identifier,
    48             int type = 1);
    49 
    50     // Copy constructor
    51     CbcSOS ( const CbcSOS &);
    52 
    53     /// Clone
    54     virtual CbcObject * clone() const;
    55 
    56     // Assignment operator
    57     CbcSOS & operator=( const CbcSOS& rhs);
    58 
    59     // Destructor
    60     virtual ~CbcSOS ();
    61 
    62     /// Infeasibility - large is 0.5
    63     virtual double infeasibility(const OsiBranchingInformation * info,
    64                                  int &preferredWay) const;
    65 
    66     using CbcObject::feasibleRegion ;
    67     /// This looks at solution and sets bounds to contain solution
    68     virtual void feasibleRegion();
    69 
    70     /// Creates a branching object
    71     virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
    72 
    73 
    74 
    75     /** Pass in information on branch just done and create CbcObjectUpdateData instance.
     45  CbcSOS(CbcModel *model, int numberMembers,
     46    const int *which, const double *weights, int identifier,
     47    int type = 1);
     48
     49  // Copy constructor
     50  CbcSOS(const CbcSOS &);
     51
     52  /// Clone
     53  virtual CbcObject *clone() const;
     54
     55  // Assignment operator
     56  CbcSOS &operator=(const CbcSOS &rhs);
     57
     58  // Destructor
     59  virtual ~CbcSOS();
     60
     61  /// Infeasibility - large is 0.5
     62  virtual double infeasibility(const OsiBranchingInformation *info,
     63    int &preferredWay) const;
     64
     65  using CbcObject::feasibleRegion;
     66  /// This looks at solution and sets bounds to contain solution
     67  virtual void feasibleRegion();
     68
     69  /// Creates a branching object
     70  virtual CbcBranchingObject *createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way);
     71
     72  /** Pass in information on branch just done and create CbcObjectUpdateData instance.
    7673        If object does not need data then backward pointer will be NULL.
    7774        Assumes can get information from solver */
    78     virtual CbcObjectUpdateData createUpdateInformation(const OsiSolverInterface * solver,
    79             const CbcNode * node,
    80             const CbcBranchingObject * branchingObject);
    81     /// Update object by CbcObjectUpdateData
    82     virtual void updateInformation(const CbcObjectUpdateData & data) ;
    83     using CbcObject::solverBranch ;
    84     /** Create an OsiSolverBranch object
     75  virtual CbcObjectUpdateData createUpdateInformation(const OsiSolverInterface *solver,
     76    const CbcNode *node,
     77    const CbcBranchingObject *branchingObject);
     78  /// Update object by CbcObjectUpdateData
     79  virtual void updateInformation(const CbcObjectUpdateData &data);
     80  using CbcObject::solverBranch;
     81  /** Create an OsiSolverBranch object
    8582
    8683        This returns NULL if branch not represented by bound changes
    8784    */
    88     virtual OsiSolverBranch * solverBranch() const;
    89     /// Redoes data when sequence numbers change
    90     virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
    91 
    92     /// Construct an OsiSOS object
    93     OsiSOS * osiObject(const OsiSolverInterface * solver) const;
    94     /// Number of members
    95     inline int numberMembers() const {
    96         return numberMembers_;
    97     }
    98 
    99     /// Members (indices in range 0 ... numberColumns-1)
    100     inline const int * members() const {
    101         return members_;
    102     }
    103 
    104     /// SOS type
    105     inline int sosType() const {
    106         return sosType_;
    107     }
    108     /// Down number times
    109     inline int numberTimesDown() const {
    110         return numberTimesDown_;
    111     }
    112     /// Up number times
    113     inline int numberTimesUp() const {
    114         return numberTimesUp_;
    115     }
    116 
    117     /** Array of weights */
    118     inline const double * weights() const {
    119         return weights_;
    120     }
    121 
    122     /// Set number of members
    123     inline void setNumberMembers(int n) {
    124         numberMembers_ = n;
    125     }
    126 
    127     /// Members (indices in range 0 ... numberColumns-1)
    128     inline int * mutableMembers() const {
    129         return members_;
    130     }
    131 
    132     /** Array of weights */
    133     inline double * mutableWeights() const {
    134         return weights_;
    135     }
    136 
    137     /** \brief Return true if object can take part in normal heuristics
    138     */
    139     virtual bool canDoHeuristics() const {
    140         return (sosType_ == 1 && integerValued_);
    141     }
    142     /// Set whether set is integer valued or not
    143     inline void setIntegerValued(bool yesNo) {
    144         integerValued_ = yesNo;
    145     }
     85  virtual OsiSolverBranch *solverBranch() const;
     86  /// Redoes data when sequence numbers change
     87  virtual void redoSequenceEtc(CbcModel *model, int numberColumns, const int *originalColumns);
     88
     89  /// Construct an OsiSOS object
     90  OsiSOS *osiObject(const OsiSolverInterface *solver) const;
     91  /// Number of members
     92  inline int numberMembers() const
     93  {
     94    return numberMembers_;
     95  }
     96
     97  /// Members (indices in range 0 ... numberColumns-1)
     98  inline const int *members() const
     99  {
     100    return members_;
     101  }
     102
     103  /// SOS type
     104  inline int sosType() const
     105  {
     106    return sosType_;
     107  }
     108  /// Down number times
     109  inline int numberTimesDown() const
     110  {
     111    return numberTimesDown_;
     112  }
     113  /// Up number times
     114  inline int numberTimesUp() const
     115  {
     116    return numberTimesUp_;
     117  }
     118
     119  /** Array of weights */
     120  inline const double *weights() const
     121  {
     122    return weights_;
     123  }
     124
     125  /// Set number of members
     126  inline void setNumberMembers(int n)
     127  {
     128    numberMembers_ = n;
     129  }
     130
     131  /// Members (indices in range 0 ... numberColumns-1)
     132  inline int *mutableMembers() const
     133  {
     134    return members_;
     135  }
     136
     137  /** Array of weights */
     138  inline double *mutableWeights() const
     139  {
     140    return weights_;
     141  }
     142
     143  /** \brief Return true if object can take part in normal heuristics
     144    */
     145  virtual bool canDoHeuristics() const
     146  {
     147    return (sosType_ == 1 && integerValued_);
     148  }
     149  /// Set whether set is integer valued or not
     150  inline void setIntegerValued(bool yesNo)
     151  {
     152    integerValued_ = yesNo;
     153  }
     154
    146155protected:
    147     /// data
    148 
    149     /// Members (indices in range 0 ... numberColumns-1)
    150     int * members_;
     156  /// data
     157
     158  /// Members (indices in range 0 ... numberColumns-1)
     159  int *members_;
    151160  /** \brief Weights for individual members
    152161
     
    161170  */
    162171
    163     double * weights_;
    164     /// Current pseudo-shadow price estimate down
    165     mutable double shadowEstimateDown_;
    166     /// Current pseudo-shadow price estimate up
    167     mutable double shadowEstimateUp_;
    168     /// Down pseudo ratio
    169     double downDynamicPseudoRatio_;
    170     /// Up pseudo ratio
    171     double upDynamicPseudoRatio_;
    172     /// Number of times we have gone down
    173     int numberTimesDown_;
    174     /// Number of times we have gone up
    175     int numberTimesUp_;
    176     /// Number of members
    177     int numberMembers_;
    178     /// SOS type
    179     int sosType_;
    180     /// Whether integer valued
    181     bool integerValued_;
    182     /// Whether odd values e.g. negative
    183     bool oddValues_;
     172  double *weights_;
     173  /// Current pseudo-shadow price estimate down
     174  mutable double shadowEstimateDown_;
     175  /// Current pseudo-shadow price estimate up
     176  mutable double shadowEstimateUp_;
     177  /// Down pseudo ratio
     178  double downDynamicPseudoRatio_;
     179  /// Up pseudo ratio
     180  double upDynamicPseudoRatio_;
     181  /// Number of times we have gone down
     182  int numberTimesDown_;
     183  /// Number of times we have gone up
     184  int numberTimesUp_;
     185  /// Number of members
     186  int numberMembers_;
     187  /// SOS type
     188  int sosType_;
     189  /// Whether integer valued
     190  bool integerValued_;
     191  /// Whether odd values e.g. negative
     192  bool oddValues_;
    184193};
    185194
     
    192201
    193202public:
    194 
    195     // Default Constructor
    196     CbcSOSBranchingObject ();
    197 
    198     // Useful constructor
    199     CbcSOSBranchingObject (CbcModel * model,  const CbcSOS * clique,
    200                            int way,
    201                            double separator);
    202 
    203     // Copy constructor
    204     CbcSOSBranchingObject ( const CbcSOSBranchingObject &);
    205 
    206     // Assignment operator
    207     CbcSOSBranchingObject & operator=( const CbcSOSBranchingObject& rhs);
    208 
    209     /// Clone
    210     virtual CbcBranchingObject * clone() const;
    211 
    212     // Destructor
    213     virtual ~CbcSOSBranchingObject ();
    214 
    215     using CbcBranchingObject::branch ;
    216     /// Does next branch and updates state
    217     virtual double branch();
    218     /** Update bounds in solver as in 'branch' and update given bounds.
     203  // Default Constructor
     204  CbcSOSBranchingObject();
     205
     206  // Useful constructor
     207  CbcSOSBranchingObject(CbcModel *model, const CbcSOS *clique,
     208    int way,
     209    double separator);
     210
     211  // Copy constructor
     212  CbcSOSBranchingObject(const CbcSOSBranchingObject &);
     213
     214  // Assignment operator
     215  CbcSOSBranchingObject &operator=(const CbcSOSBranchingObject &rhs);
     216
     217  /// Clone
     218  virtual CbcBranchingObject *clone() const;
     219
     220  // Destructor
     221  virtual ~CbcSOSBranchingObject();
     222
     223  using CbcBranchingObject::branch;
     224  /// Does next branch and updates state
     225  virtual double branch();
     226  /** Update bounds in solver as in 'branch' and update given bounds.
    219227        branchState is -1 for 'down' +1 for 'up' */
    220     virtual void fix(OsiSolverInterface * solver,
    221                      double * lower, double * upper,
    222                      int branchState) const ;
    223 
    224     /** Reset every information so that the branching object appears to point to
     228  virtual void fix(OsiSolverInterface *solver,
     229    double *lower, double *upper,
     230    int branchState) const;
     231
     232  /** Reset every information so that the branching object appears to point to
    225233        the previous child. This method does not need to modify anything in any
    226234        solver. */
    227     virtual void previousBranch() {
    228         CbcBranchingObject::previousBranch();
    229         computeNonzeroRange();
    230     }
    231 
    232     using CbcBranchingObject::print ;
    233     /** \brief Print something about branch - only if log level high
    234     */
    235     virtual void print();
    236 
    237     /** Return the type (an integer identifier) of \c this */
    238     virtual CbcBranchObjType type() const {
    239         return SoSBranchObj;
    240     }
    241 
    242     /** Compare the original object of \c this with the original object of \c
     235  virtual void previousBranch()
     236  {
     237    CbcBranchingObject::previousBranch();
     238    computeNonzeroRange();
     239  }
     240
     241  using CbcBranchingObject::print;
     242  /** \brief Print something about branch - only if log level high
     243    */
     244  virtual void print();
     245
     246  /** Return the type (an integer identifier) of \c this */
     247  virtual CbcBranchObjType type() const
     248  {
     249    return SoSBranchObj;
     250  }
     251
     252  /** Compare the original object of \c this with the original object of \c
    243253        brObj. Assumes that there is an ordering of the original objects.
    244254        This method should be invoked only if \c this and brObj are of the same
     
    247257        smaller/same/larger than the argument.
    248258    */
    249     virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
    250 
    251     /** Compare the \c this with \c brObj. \c this and \c brObj must be os the
     259  virtual int compareOriginalObject(const CbcBranchingObject *brObj) const;
     260
     261  /** Compare the \c this with \c brObj. \c this and \c brObj must be os the
    252262        same type and must have the same original object, but they may have
    253263        different feasible regions.
     
    257267        whose feasible region is the overlap.
    258268     */
    259     virtual CbcRangeCompare compareBranchingObject
    260     (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
    261 
    262     /** Fill out the \c firstNonzero_ and \c lastNonzero_ data members */
    263     void computeNonzeroRange();
     269  virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap = false);
     270
     271  /** Fill out the \c firstNonzero_ and \c lastNonzero_ data members */
     272  void computeNonzeroRange();
    264273
    265274protected:
    266     /// data
    267     const CbcSOS * set_;
    268     /// separator
    269     double separator_;
    270     /** The following two members describe the range in the members_ of the
     275  /// data
     276  const CbcSOS *set_;
     277  /// separator
     278  double separator_;
     279  /** The following two members describe the range in the members_ of the
    271280        original object that whose upper bound is not fixed to 0. This is not
    272281        necessary for Cbc to function correctly, this is there for heuristics so
    273282        that separate branching decisions on the same object can be pooled into
    274283        one branching object. */
    275     int firstNonzero_;
    276     int lastNonzero_;
     284  int firstNonzero_;
     285  int lastNonzero_;
    277286};
    278287#endif
    279 
Note: See TracChangeset for help on using the changeset viewer.