Ignore:
Timestamp:
Oct 8, 2006 7:33:47 PM (13 years ago)
Author:
forrest
Message:

towards common use with other solvers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/devel/Cbc/src/CbcBranchActual.hpp

    r424 r439  
    187187  CbcSimpleInteger ();
    188188
    189   // Useful constructor - passed integer index and model index
    190   CbcSimpleInteger (CbcModel * model, int sequence, int iColumn, double breakEven=0.5);
     189  // Useful constructor - passed model and index
     190  CbcSimpleInteger (CbcModel * model,  int iColumn, double breakEven=0.5);
     191 
     192  // Useful constructor - passed model and Osi object
     193  CbcSimpleInteger (CbcModel * model,  const OsiSimpleInteger * object);
    191194 
    192195  // Copy constructor
     
    201204  // Destructor
    202205  ~CbcSimpleInteger ();
    203  
     206  /// Construct an OsiSimpleInteger object
     207  OsiSimpleInteger * osiObject() const;
     208  /// Infeasibility - large is 0.5
     209  virtual double infeasibility(const OsiSolverInterface * solver,
     210                               const OsiBranchingInformation * info, int & preferredWay) const;
     211
     212  /** Set bounds to fix the variable at the current (integer) value.
     213
     214    Given an integer value, set the lower and upper bounds to fix the
     215    variable. Returns amount it had to move variable.
     216  */
     217  virtual double feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const;
     218
     219  /** Create a branching object and indicate which way to branch first.
     220     
     221      The branching object has to know how to create branches (fix
     222      variables, etc.)
     223  */
     224  virtual CbcBranchingObject * createBranch(OsiSolverInterface * solver,
     225                                            const OsiBranchingInformation * info, int way) ;
     226  /** Create an OsiSolverBranch object
     227
     228      This returns NULL if branch not represented by bound changes
     229  */
     230  virtual OsiSolverBranch * solverBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info) const;
    204231  /// Infeasibility - large is 0.5
    205232  virtual double infeasibility(int & preferredWay) const;
     
    218245  */
    219246  virtual CbcBranchingObject * createBranch(int way) ;
    220 
    221   /** Create an OsiSolverBranch object
    222 
    223       This returns NULL if branch not represented by bound changes
    224   */
    225   virtual OsiSolverBranch * solverBranch() const;
    226   /// Redoes data when sequence numbers change
    227   virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
    228  
    229   /** \brief Given a valid solution (with reduced costs, etc.),
    230       return a branching object which would give a new feasible
    231       point in the good direction.
    232 
    233     The preferred branching object will force the variable to be either the
    234     floor or ceiling of its current value, depending on the reduced cost and
    235     objective sense. If movement in the direction which improves the
    236     objective is impossible due to bounds on the variable, the branching
    237     object will move in the other direction.  If no movement is possible, the
    238     method returns NULL.
    239 
    240     Only the bounds on this variable are considered when determining if the new
    241     point is feasible.
    242   */
    243   virtual CbcBranchingObject * preferredNewFeasible() const;
    244  
    245   /** \brief Given a valid solution (with reduced costs, etc.),
    246       return a branching object which would give a new feasible
    247       point in a bad direction.
    248 
    249     As for preferredNewFeasible(), but the preferred branching object will
    250     force movement in a direction that degrades the objective.
    251   */
    252   virtual CbcBranchingObject * notPreferredNewFeasible() const ;
    253  
    254   /** Reset original upper and lower bound values from the solver.
    255  
    256     Handy for updating bounds held in this object after bounds held in the
    257     solver have been tightened.
    258    */
    259   virtual void resetBounds();
    260  
    261   /// Sequence number
    262   inline int sequence() const
    263   {return sequence_;};
    264 
    265   /// Model column number
    266   inline int modelSequence() const
    267   {return columnNumber_;};
    268   /// Set model column number
    269   inline void setColumnNumber(int value)
    270   {columnNumber_=value;};
    271  
    272247  /** Column number if single column object -1 otherwise,
    273248      so returns >= 0
     
    296271  /// data
    297272
    298   /// Sequence
    299   int sequence_;
    300   /// Column number in model
    301   int columnNumber_;
    302273  /// Original lower bound
    303274  double originalLower_;
     
    306277  /// Breakeven i.e. >= this preferred is up
    307278  double breakEven_;
    308 };
    309 
     279  /// Column number in model
     280  int columnNumber_;
     281  /// If -1 down always chosen first, +1 up always, 0 normal
     282  int preferredWay_;
     283};
    310284/** Define an n-way class for variables.
    311285    Only valid value is one at UB others at LB
     
    425399             Returns change in guessed objective on next branch
    426400  */
    427   virtual double branch(bool normalBranch=false);
     401  virtual double branch();
    428402
    429403  /** \brief Print something about branch - only if log level high
    430404  */
    431   virtual void print(bool normalBranch);
     405  virtual void print();
    432406
    433407protected:
     
    449423  CbcSimpleIntegerPseudoCost ();
    450424
    451   // Useful constructor - passed integer index and model index
    452   CbcSimpleIntegerPseudoCost (CbcModel * model, int sequence, int iColumn, double breakEven=0.5);
    453  
    454   // Useful constructor - passed integer index and model index and pseudo costs
    455   CbcSimpleIntegerPseudoCost (CbcModel * model, int sequence, int iColumn,
     425  // Useful constructor - passed model index
     426  CbcSimpleIntegerPseudoCost (CbcModel * model, int iColumn, double breakEven=0.5);
     427 
     428  // Useful constructor - passed and model index and pseudo costs
     429  CbcSimpleIntegerPseudoCost (CbcModel * model, int iColumn,
     430                              double downPseudoCost, double upPseudoCost);
     431  // Useful constructor - passed and model index and pseudo costs
     432  CbcSimpleIntegerPseudoCost (CbcModel * model, int dummy,int iColumn,
    456433                              double downPseudoCost, double upPseudoCost);
    457434 
     
    582559             This version also changes guessed objective value
    583560  */
    584   virtual double branch(bool normalBranch=false);
     561  virtual double branch();
    585562
    586563  /// Change in guessed
     
    630607 
    631608  /// Does next branch and updates state
    632   virtual double branch(bool normalBranch=false);
     609  virtual double branch();
    633610
    634611  /** \brief Print something about branch - only if log level high
    635612  */
    636   virtual void print(bool normalBranch);
     613  virtual void print();
    637614private:
    638615  /// data
     
    675652 
    676653  /// Does next branch and updates state
    677   virtual double branch(bool normalBranch=false);
     654  virtual double branch();
    678655
    679656  /** \brief Print something about branch - only if log level high
    680657  */
    681   virtual void print(bool normalBranch);
     658  virtual void print();
    682659private:
    683660  /// data
     
    719696 
    720697  /// Does next branch and updates state
    721   virtual double branch(bool normalBranch=false);
     698  virtual double branch();
    722699
    723700  /** \brief Print something about branch - only if log level high
    724701  */
    725   virtual void print(bool normalBranch);
     702  virtual void print();
    726703private:
    727704  /// data
     
    761738 
    762739  /// Does next branch and updates state
    763   virtual double branch(bool normalBranch=false);
     740  virtual double branch();
    764741
    765742  /** \brief Print something about branch - only if log level high
    766743  */
    767   virtual void print(bool normalBranch);
     744  virtual void print();
    768745  /** The number of branch arms created for this branching object
    769746  */
     
    861838  double bestChangeDown_;
    862839
     840  /// Pointer to best branching object
     841  CbcBranchingObject * bestObject_;
     842
    863843  /// Number of infeasibilities for down
    864844  int bestNumberDown_;
    865 
    866   /// Pointer to best branching object
    867   CbcBranchingObject * bestObject_;
    868845
    869846};
     
    951928 
    952929  /// Does next branch and updates state
    953   virtual double branch(bool normalBranch=false);
     930  virtual double branch();
    954931
    955932  /** \brief Print something about branch - only if log level high
    956933  */
    957   virtual void print(bool normalBranch);
     934  virtual void print();
    958935private:
    959936  /// data
     
    10471024  /** \brief Dummy branch
    10481025  */
    1049   virtual double branch(bool normalBranch=false);
     1026  virtual double branch();
    10501027
    10511028  /** \brief Print something about branch - only if log level high
    10521029  */
    1053   virtual void print(bool normalBranch);
     1030  virtual void print();
    10541031
    10551032};
Note: See TracChangeset for help on using the changeset viewer.