source: trunk/Cbc/src/CbcBranchToFixLots.hpp

Last change on this file was 2465, checked in by unxusr, 6 months ago

script to format sources

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1// $Id: CbcBranchToFixLots.hpp 2465 2019-01-03 19:26:52Z tkr $
2// Copyright (C) 2004, 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// Edwin 11/13/2009-- carved out of CbcBranchCut
7
8#ifndef CbcBranchToFixLots_H
9#define CbcBranchToFixLots_H
10
11#include "CbcBranchCut.hpp"
12#include "CbcBranchBase.hpp"
13#include "OsiRowCut.hpp"
14#include "CoinPackedMatrix.hpp"
15
16/** Define a branch class that branches so that one way variables are fixed
17    while the other way cuts off that solution.
18    a) On reduced cost
19    b) When enough ==1 or <=1 rows have been satisfied (not fixed - satisfied)
20*/
21
22class CbcBranchToFixLots : public CbcBranchCut {
23
24public:
25  // Default Constructor
26  CbcBranchToFixLots();
27
28  /** Useful constructor - passed reduced cost tolerance and fraction we would like fixed.
29        Also depth level to do at.
30        Also passed number of 1 rows which when clean triggers fix
31        Always does if all 1 rows cleaned up and number>0 or if fraction columns reached
32        Also whether to create branch if can't reach fraction.
33    */
34  CbcBranchToFixLots(CbcModel *model, double djTolerance,
35    double fractionFixed, int depth,
36    int numberClean = 0,
37    const char *mark = NULL,
38    bool alwaysCreate = false);
39
40  // Copy constructor
41  CbcBranchToFixLots(const CbcBranchToFixLots &);
42
43  /// Clone
44  virtual CbcObject *clone() const;
45
46  // Assignment operator
47  CbcBranchToFixLots &operator=(const CbcBranchToFixLots &rhs);
48
49  // Destructor
50  ~CbcBranchToFixLots();
51
52  /** Does a lot of the work,
53        Returns 0 if no good, 1 if dj, 2 if clean, 3 if both
54        FIXME: should use enum or equivalent to make these numbers clearer.
55    */
56  int shallWe() const;
57
58  /// Infeasibility for an integer variable - large is 0.5, but also can be infinity when known infeasible.
59  virtual double infeasibility(const OsiBranchingInformation *info,
60    int &preferredWay) const;
61  /** \brief Return true if object can take part in normal heuristics
62    */
63  virtual bool canDoHeuristics() const
64  {
65    return true;
66  }
67
68  /// Creates a branching object
69  virtual CbcBranchingObject *createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way);
70  /// Redoes data when sequence numbers change
71  virtual void redoSequenceEtc(CbcModel *model, int numberColumns, const int *originalColumns);
72
73protected:
74  /// data
75
76  /// Reduced cost tolerance i.e. dj has to be >= this before fixed
77  double djTolerance_;
78  /// We only need to make sure this fraction fixed
79  double fractionFixed_;
80  /// Never fix ones marked here
81  char *mark_;
82  /// Matrix by row
83  CoinPackedMatrix matrixByRow_;
84  /// Do if depth multiple of this
85  int depth_;
86  /// number of ==1 rows which need to be clean
87  int numberClean_;
88  /// If true then always create branch
89  bool alwaysCreate_;
90};
91#endif
92
93/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
94*/
Note: See TracBrowser for help on using the repository browser.