Osi  0.107.9
OsiSolverBranch.hpp
Go to the documentation of this file.
1 // Copyright (C) 2005, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 // This code is licensed under the terms of the Eclipse Public License (EPL).
4 
5 #ifndef OsiSolverBranch_H
6 #define OsiSolverBranch_H
7 
9 #include "CoinWarmStartBasis.hpp"
10 
11 //#############################################################################
12 
19 
20 public:
22 
23  void addBranch(int iColumn, double value);
25 
27  void addBranch(int way,int numberTighterLower, const int * whichLower, const double * newLower,
28  int numberTighterUpper, const int * whichUpper, const double * newUpper);
30  void addBranch(int way,int numberColumns,const double * oldLower, const double * newLower,
31  const double * oldUpper, const double * newUpper);
32 
34  void applyBounds(OsiSolverInterface & solver,int way) const;
36  bool feasibleOneWay(const OsiSolverInterface & solver) const;
38  inline const int * starts() const
39  { return start_;}
41  inline const int * which() const
42  { return indices_;}
44  inline const double * bounds() const
45  { return bound_;}
47 
48 
50 
51  OsiSolverBranch();
53 
56 
59 
62 
64 
65 private:
67 
68  int start_[5];
71  int * indices_;
73  double * bound_;
75 };
76 //#############################################################################
77 
84 
85 public:
87 
88  void createResult(const OsiSolverInterface & solver,const double * lowerBefore,
90  const double * upperBefore);
91 
93  void restoreResult(OsiSolverInterface & solver) const;
94 
96  inline const CoinWarmStartBasis & basis() const
97  { return basis_;}
98 
100  inline double objectiveValue() const
101  { return objectiveValue_;}
102 
104  inline const double * primalSolution() const
105  { return primalSolution_;}
106 
108  inline const double * dualSolution() const
109  { return dualSolution_;}
110 
112  inline const OsiSolverBranch & fixed() const
113  { return fixed_;}
115 
116 
118 
119  OsiSolverResult();
121 
123  OsiSolverResult(const OsiSolverInterface & solver,const double * lowerBefore,
124  const double * upperBefore);
125 
128 
131 
134 
136 
137 private:
139 
140  double objectiveValue_;
143  CoinWarmStartBasis basis_;
145  double * primalSolution_;
147  double * dualSolution_;
151 };
152 #endif
OsiSolverResult::restoreResult
void restoreResult(OsiSolverInterface &solver) const
Restore result.
OsiSolverResult::~OsiSolverResult
~OsiSolverResult()
Destructor.
OsiSolverBranch
Solver Branch Class.
Definition: OsiSolverBranch.hpp:18
OsiSolverResult::fixed
const OsiSolverBranch & fixed() const
Extra fixed.
Definition: OsiSolverBranch.hpp:112
OsiSolverBranch::bounds
const double * bounds() const
Bounds.
Definition: OsiSolverBranch.hpp:44
OsiSolverResult::primalSolution_
double * primalSolution_
Primal solution (numberColumns)
Definition: OsiSolverBranch.hpp:145
OsiSolverBranch::~OsiSolverBranch
~OsiSolverBranch()
Destructor.
OsiSolverBranch::which
const int * which() const
Which variables.
Definition: OsiSolverBranch.hpp:41
OsiSolverBranch::applyBounds
void applyBounds(OsiSolverInterface &solver, int way) const
Apply bounds.
OsiSolverResult::createResult
void createResult(const OsiSolverInterface &solver, const double *lowerBefore, const double *upperBefore)
Create result.
OsiSolverBranch::start_
int start_[5]
Start of lower first, upper first, lower second, upper second.
Definition: OsiSolverBranch.hpp:69
OsiSolverResult::dualSolution_
double * dualSolution_
Dual solution (numberRows)
Definition: OsiSolverBranch.hpp:147
OsiSolverResult::basis
const CoinWarmStartBasis & basis() const
Get basis.
Definition: OsiSolverBranch.hpp:96
OsiSolverResult::primalSolution
const double * primalSolution() const
Primal solution.
Definition: OsiSolverBranch.hpp:104
OsiSolverResult::OsiSolverResult
OsiSolverResult(const OsiSolverResult &rhs)
Copy constructor.
OsiSolverBranch::operator=
OsiSolverBranch & operator=(const OsiSolverBranch &rhs)
Assignment operator.
OsiSolverResult::operator=
OsiSolverResult & operator=(const OsiSolverResult &rhs)
Assignment operator.
OsiSolverBranch::OsiSolverBranch
OsiSolverBranch(const OsiSolverBranch &rhs)
Copy constructor.
OsiSolverBranch::bound_
double * bound_
New bounds.
Definition: OsiSolverBranch.hpp:73
OsiSolverResult::objectiveValue_
double objectiveValue_
Value of objective (if >= OsiSolverInterface::getInfinity() then infeasible)
Definition: OsiSolverBranch.hpp:141
OsiSolverResult::objectiveValue
double objectiveValue() const
Objective value (as minimization)
Definition: OsiSolverBranch.hpp:100
OsiSolverResult::OsiSolverResult
OsiSolverResult()
Default Constructor.
OsiSolverResult::dualSolution
const double * dualSolution() const
Dual solution.
Definition: OsiSolverBranch.hpp:108
OsiSolverResult::fixed_
OsiSolverBranch fixed_
Which extra variables have been fixed (only way==-1 counts)
Definition: OsiSolverBranch.hpp:149
OsiSolverBranch::starts
const int * starts() const
Starts.
Definition: OsiSolverBranch.hpp:38
OsiSolverResult::basis_
CoinWarmStartBasis basis_
Warm start information.
Definition: OsiSolverBranch.hpp:143
OsiSolverResult::OsiSolverResult
OsiSolverResult(const OsiSolverInterface &solver, const double *lowerBefore, const double *upperBefore)
Constructor from solver.
OsiSolverBranch::indices_
int * indices_
Column numbers (if >= numberColumns treat as rows)
Definition: OsiSolverBranch.hpp:71
OsiSolverBranch::addBranch
void addBranch(int way, int numberColumns, const double *oldLower, const double *newLower, const double *oldUpper, const double *newUpper)
Add bounds - way =-1 is first , +1 is second.
OsiSolverBranch::addBranch
void addBranch(int way, int numberTighterLower, const int *whichLower, const double *newLower, int numberTighterUpper, const int *whichUpper, const double *newUpper)
Add bounds - way =-1 is first , +1 is second.
OsiSolverResult
Solver Result Class.
Definition: OsiSolverBranch.hpp:83
OsiSolverBranch::OsiSolverBranch
OsiSolverBranch()
Default Constructor.
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition: OsiSolverInterface.hpp:62
OsiSolverBranch::addBranch
void addBranch(int iColumn, double value)
Add a simple branch (i.e. first sets ub of floor(value), second lb of ceil(value))
OsiSolverBranch::feasibleOneWay
bool feasibleOneWay(const OsiSolverInterface &solver) const
Returns true if current solution satsifies one side of branch.