Debian Codegraph @

Bonmin/src/Algorithms/Branching/BonRandomChoice.cpp

raw
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 #include "BonRandomChoice.hpp"
10 #include "BonminConfig.h"
11 #include "CoinFinite.hpp"
12
13 int BonRandomChoice::setupList(OsiBranchingInformation * info, bool initialize){
14 if (initialize) {
15 status_=-2;
16 delete [] goodSolution_;
17 bestObjectIndex_=-1;
18 numberStrongDone_=0;
19 numberStrongIterations_ = 0;
20 numberStrongFixed_ = 0;
21 goodSolution_ = NULL;
22 goodObjectiveValue_ = COIN_DBL_MAX;
23 numberOnList_=0;
24 }
25 numberUnsatisfied_=0;
26 int numberObjects = solver_->numberObjects();
27 assert (numberObjects);
28 int bestPriority=COIN_INT_MAX;
29 std::fill(list_, list_+numberObjects, -1);
30 OsiObject ** object = info->solver_->objects();
31 // Say feasible
32 //bool feasible = true;
33 for (int i=0;i<numberObjects;i++) {
34 int way;
35 double value = object[i]->infeasibility(info,way);
36 if (value>0.0) {
37 if (value==COIN_DBL_MAX) {
38 // infeasible
39 //feasible=false;
40 break;
41 }
42 int priorityLevel = object[i]->priority();
43 // Better priority? Flush choices.
44 if (priorityLevel<bestPriority) {
45 numberUnsatisfied_ = 0;
46 std::fill(list_, list_+numberObjects, -1);
47 }
48 bestPriority = priorityLevel;
49 if (priorityLevel==bestPriority) {
50 list_[numberUnsatisfied_]=i;
51 numberUnsatisfied_++;
52 }
53 }
54 }
55 return numberUnsatisfied_;
56 }