source: trunk/Cbc/examples/CbcBranchUser.hpp

Last change on this file was 1574, checked in by lou, 8 years ago

Change to EPL license notice.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1// $Id: CbcBranchUser.hpp 1574 2011-01-05 01:13:55Z unxusr $
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) ;
54private:
55 
56  /// Illegal Assignment operator
57  CbcBranchUserDecision & operator=(const CbcBranchUserDecision& rhs);
58
59};
60
61/// Define a single integer class where branching is forced until fixed
62
63
64class CbcSimpleIntegerFixed : public CbcSimpleInteger {
65
66public:
67
68  // Default Constructor
69  CbcSimpleIntegerFixed ();
70
71  // Useful constructor - passed integer index and model index
72  CbcSimpleIntegerFixed (CbcModel * model, int iColumn, double breakEven=0.5);
73 
74  // Constructor from simple
75  CbcSimpleIntegerFixed (const CbcSimpleInteger & simple);
76 
77  // Copy constructor
78  CbcSimpleIntegerFixed ( const CbcSimpleIntegerFixed &);
79   
80  /// Clone
81  virtual CbcObject * clone() const;
82
83  // Assignment operator
84  CbcSimpleIntegerFixed & operator=( const CbcSimpleIntegerFixed& rhs);
85
86  // Destructor
87  ~CbcSimpleIntegerFixed ();
88 
89  /// Infeasibility - large is 0.5
90  virtual double infeasibility(int & preferredWay) const;
91
92  /** Creates a branching object
93
94    The preferred direction is set by \p way, -1 for down, +1 for up.
95  */
96  //virtual CbcBranchingObject * createBranch(int way) ;
97  /** Create a branching object and indicate which way to branch first.
98     
99      The branching object has to know how to create branches (fix
100      variables, etc.)
101  */
102  virtual CbcBranchingObject * createBranch(OsiSolverInterface * solver,
103                                            const OsiBranchingInformation * info, int way) ;
104
105protected:
106  /// data
107};
108
109#endif
Note: See TracBrowser for help on using the repository browser.