source: trunk/Cbc/examples/CbcBranchUser.hpp

Last change on this file was 2469, checked in by unxusr, 4 months ago

formatting

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1// $Id: CbcBranchUser.hpp 2469 2019-01-06 23:17:46Z stefan $
2// Copyright (C) 2002, 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#ifndef CbcBranchUser_H
7#define CbcBranchUser_H
8
9#include "CbcBranchBase.hpp"
10#include "CbcBranchActual.hpp"
11
12/** Branching decision user class */
13
14class CbcBranchUserDecision : public CbcBranchDecision {
15public:
16  // Default Constructor
17  CbcBranchUserDecision();
18
19  // Copy constructor
20  CbcBranchUserDecision(const CbcBranchUserDecision &);
21
22  virtual ~CbcBranchUserDecision();
23
24  /// Clone
25  virtual CbcBranchDecision *clone() const;
26
27  /// Initialize i.e. before start of choosing at a node
28  virtual void initialize(CbcModel *model);
29
30  /** Returns nonzero if branching on first object is "better" than on
31      second (if second NULL first wins).
32      This is only used after strong branching.  The initial selection
33      is done by infeasibility() for each CbcObject
34      return code +1 for up branch preferred, -1 for down
35     
36 */
37  virtual int betterBranch(CbcBranchingObject *thisOne,
38    CbcBranchingObject *bestSoFar,
39    double changeUp, int numberInfeasibilitiesUp,
40    double changeDown, int numberInfeasibilitiesDown);
41
42  /** \brief Compare N branching objects. Return index of best
43      and sets way of branching in chosen object.
44   
45    This routine is used only after strong branching.
46    This is reccommended version as it can be more sophisticated
47  */
48
49  virtual int
50  bestBranch(CbcBranchingObject **objects, int numberObjects, int numberUnsatisfied,
51    double *changeUp, int *numberInfeasibilitiesUp,
52    double *changeDown, int *numberInfeasibilitiesDown,
53    double objectiveValue);
54
55private:
56  /// Illegal Assignment operator
57  CbcBranchUserDecision &operator=(const CbcBranchUserDecision &rhs);
58};
59
60/// Define a single integer class where branching is forced until fixed
61
62class CbcSimpleIntegerFixed : public CbcSimpleInteger {
63
64public:
65  // Default Constructor
66  CbcSimpleIntegerFixed();
67
68  // Useful constructor - passed integer index and model index
69  CbcSimpleIntegerFixed(CbcModel *model, int iColumn, double breakEven = 0.5);
70
71  // Constructor from simple
72  CbcSimpleIntegerFixed(const CbcSimpleInteger &simple);
73
74  // Copy constructor
75  CbcSimpleIntegerFixed(const CbcSimpleIntegerFixed &);
76
77  /// Clone
78  virtual CbcObject *clone() const;
79
80  // Assignment operator
81  CbcSimpleIntegerFixed &operator=(const CbcSimpleIntegerFixed &rhs);
82
83  // Destructor
84  ~CbcSimpleIntegerFixed();
85
86  /// Infeasibility - large is 0.5
87  virtual double infeasibility(int &preferredWay) const;
88
89  /** Creates a branching object
90
91    The preferred direction is set by \p way, -1 for down, +1 for up.
92  */
93  //virtual CbcBranchingObject * createBranch(int way) ;
94  /** Create a branching object and indicate which way to branch first.
95     
96      The branching object has to know how to create branches (fix
97      variables, etc.)
98  */
99  virtual CbcBranchingObject *createBranch(OsiSolverInterface *solver,
100    const OsiBranchingInformation *info, int way);
101
102protected:
103  /// data
104};
105
106#endif
Note: See TracBrowser for help on using the repository browser.