37 const std::string &
prefix):
49 roptions->AddLowerBoundedIntegerOption(
"branch_on_frac_only",
50 "Starting at given depth branch on the subset of fractional variables (and set the last branch that one of them is 1)",
53 roptions->AddStringOption2(
"do_a_quick_one",
54 "Do we try our luck?",
56 "no",
"Don't (of course).",
109 options()->GetEnumValue(
"do_a_quick_one", do_quick,
prefix());
111 options()->GetIntegerValue(
"branch_on_frac_only", depth_frac,
prefix());
117 const int & numSos = sos->
num;
118 OsiObject **
objects =
new OsiObject*[numSos];
119 const int * starts = sos->
starts;
120 const int * indices = sos->
indices;
122 const double * weights = sos->
weights;
123 bool hasPriorities =
false;
128 for (
int i = 0 ; i < numberObjects ; i++) {
129 if (varPriorities[i]) {
130 hasPriorities =
true;
138 for (
int i = 0 ; i < numSos ; i++) {
139 if (sosPriorities[i]) {
140 hasPriorities =
true;
146 std::vector<std::list<int> > groups(numSos + 1);
148 for (
int i = 0 ; i < numSos ; i++)
150 int start = starts[i];
151 int length = starts[i + 1] - start;
152 for(
int j = 0 ;
j < length ;
j++){
153 groups[(size_t) weights[
j]].push_back(indices[start+
j]);
157 for (
int i = 0 ; i < numSos ; i++)
159 int start = starts[i];
160 int length = starts[i + 1] - start;
162 nway->setPriority(1);
163 for(
int j = 0 ;
j < length ;
j++){
165 std::vector<int>& ids = cons.
indices;
166 int idx = (
int) weights[
j];
167 const std::list<int> &to_add = groups[idx];
168 for(std::list<int>::const_iterator
k = to_add.begin() ;
169 k != to_add.end() ;
k++){
170 if(*
k != indices[start+
j]) ids.push_back(*
k);
179 if (hasPriorities && sosPriorities && sosPriorities[i]) {
180 objects[i]->setPriority(sosPriorities[i]);
184 for (
int i = 0 ; i < numSos ; i++)
void set_only_frac_branches(int depth)
int getIntParameter(const IntParameter &p) const
Return value of integer parameter.
virtual void registerOptions()
Register all the options for this algorithm instance.
const vector< OsiObject * > & objects() const
Access to extra objects.
int intParam_[NumberIntParam]
storage of integer parameters.
void initializeRobot()
Initialize a branch-and-with robot nway.
int num
Number of SOS constraints.
This is class provides an Osi interface for a Mixed Integer Linear Program expressed as a TMINLP (so ...
virtual const SosInfo * sosConstraints() const =0
This class chooses a variable to branch on.
Number of candidates for strong branching.
Class to store sos constraints for model.
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Register class options.
void setPriorities()
Set the priorities into OsiTMINLPInterface when needed.
OsiTMINLPInterface * nonlinearSolver_
Storage of the non-linear solver used.
const int * getPriorities() const
Get priorities on integer variables.
RobotSetup(const CoinMessageHandler *handler=NULL)
Default constructor.
OsiChooseVariable * branchingMethod_
Branching method.
int * starts
For 0 <= i < nums, start[i] gives the indice of indices and weights arrays at which the description o...
static void registerAllOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Register all bonmin type executable options.
void setConsequence(int iMember, const n_way_consequences &consequence)
Set up a consequence for a single member.
static void registerAllOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Register all bonmin type executable options.
int * priorities
priorities of sos constraints.
Consider or not SOS constraints.
int * indices
indices of elements belonging to the SOS.
void addNWays()
Add nway objects.
Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions_
Registered Options.
const TMINLP * model() const
OsiTMINLPInterface * nonlinearSolver()
Pointer to the non-linear solver used.
void initialize(Ipopt::SmartPtr< TMINLP > tminlp, bool createContinuousSolver=true)
Initialize, read options and create appropriate bonmin setup.
Ipopt::SmartPtr< Ipopt::OptionsList > options()
Acces list of Options.
std::vector< int > indices
OsiSolverInterface * continuousSolver_
Storage of continuous solver.
const char * prefix() const
Get prefix to use for options.
double * weights
weights of the elements of the SOS.
void initialize(Ipopt::SmartPtr< TMINLP > tminlp, bool createContinuousSolver=true)
Initialize, read options and create appropriate bonmin setup.