Bonmin 1.8.9
Loading...
Searching...
No Matches
BonRandomChoice.hpp
Go to the documentation of this file.
1// (C) Copyright CNRS 2008
2// All Rights Reserved.
3// This code is published under the Eclipse Public License.
4//
5// Authors :
6// Pierre Bonami, LIF, CNRS-Marseille Universites.
7//
8// Date : 03/17/2008
9#ifndef BonRandomChoice_H
10#define BonRandomChoice_H
11
12#include "OsiChooseVariable.hpp"
14#include <list>
15#include <cmath>
16
18 public:
22
23 //Constructor from solver
25 OsiChooseVariable(solver){
26 }
27
28 // Copy constructor
30 OsiChooseVariable(other){
31 }
32
33 // Assignment operator
36 return (*this);
37 }
38
39 // Virtual copy
40 virtual OsiChooseVariable * clone() const{
41 return new BonRandomChoice(*this);
42 }
43
46 }
47
50 virtual int setupList(OsiBranchingInformation * info, bool initialize);
51
52 virtual int chooseVariable( OsiSolverInterface * solver,
54 bool fixVariables){
56 int chosen = (int) (floor(CoinDrand48() * (numberUnsatisfied_)));
57 bestObjectIndex_ = list_[chosen];
61 return 0;
62 }
63 else {
64 return 1;
65 }
66 }
67};
68#endif
double CoinDrand48(bool isSeed=false, unsigned int seed=1)
BonRandomChoice(const OsiSolverInterface *solver)
virtual ~BonRandomChoice()
Destructor.
virtual int chooseVariable(OsiSolverInterface *solver, OsiBranchingInformation *info, bool fixVariables)
BonRandomChoice & operator=(const BonRandomChoice &rhs)
BonRandomChoice()
Default constructor.
virtual OsiChooseVariable * clone() const
BonRandomChoice(const BonRandomChoice &other)
virtual int setupList(OsiBranchingInformation *info, bool initialize)
Own version of setupList since Osi version is broken and what we want to do here is anyway much simpl...
OsiChooseVariable & operator=(const OsiChooseVariable &rhs)
int whichWay() const
const OsiObject * object(int which) const