source: branches/devel/Cbc/examples/CbcBranchUser.hpp @ 466

Last change on this file since 466 was 466, checked in by forrest, 13 years ago

for nonlinear

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1// Copyright (C) 2002, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#ifndef CbcBranchUser_H
4#define CbcBranchUser_H
5
6#include "CbcBranchBase.hpp"
7#include "CbcBranchActual.hpp"
8
9/** Branching decision user class */
10
11class CbcBranchUserDecision : public CbcBranchDecision {
12public:
13  // Default Constructor
14  CbcBranchUserDecision ();
15
16  // Copy constructor
17  CbcBranchUserDecision ( const CbcBranchUserDecision &);
18
19  virtual ~CbcBranchUserDecision();
20
21 /// Clone
22  virtual CbcBranchDecision * clone() const;
23
24    /// Initialize i.e. before start of choosing at a node
25  virtual void initialize(CbcModel * model);
26
27  /** Returns nonzero if branching on first object is "better" than on
28      second (if second NULL first wins).
29      This is only used after strong branching.  The initial selection
30      is done by infeasibility() for each CbcObject
31      return code +1 for up branch preferred, -1 for down
32     
33 */
34  virtual int betterBranch(CbcBranchingObject * thisOne,
35                            CbcBranchingObject * bestSoFar,
36                            double changeUp, int numberInfeasibilitiesUp,
37                            double changeDown, int numberInfeasibilitiesDown);
38
39  /** \brief Compare N branching objects. Return index of best
40      and sets way of branching in chosen object.
41   
42    This routine is used only after strong branching.
43    This is reccommended version as it can be more sophisticated
44  */
45
46  virtual int
47  bestBranch (CbcBranchingObject ** objects, int numberObjects, int numberUnsatisfied,
48              double * changeUp, int * numberInfeasibilitiesUp,
49              double * changeDown, int * numberInfeasibilitiesDown,
50              double objectiveValue) ;
51private:
52 
53  /// Illegal Assignment operator
54  CbcBranchUserDecision & operator=(const CbcBranchUserDecision& rhs);
55
56};
57
58/// Define a single integer class where branching is forced until fixed
59
60
61class CbcSimpleIntegerFixed : public CbcSimpleInteger {
62
63public:
64
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.