| 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */cxx . . $ `<file>/highs/mip/HighsPseudocost.h`/ |
| 2 | /* */ |
| 3 | /* This file is part of the HiGHS linear optimization suite */ |
| 4 | /* */ |
| 5 | /* Available as open-source under the MIT License */ |
| 6 | /* */ |
| 7 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
| 8 | |
| 9 | #ifndef HIGHS_PSEUDOCOST_H_ |
| 10 | #define HIGHS_PSEUDOCOST_H_cxx . . $ `highs/mip/HighsPseudocost.h:10:9`! |
| 11 | |
| 12 | #include <algorithm> |
| 13 | #include <cassert> |
| 14 | #include <cmath> |
| 15 | #include <limits> |
| 16 | #include <vector> |
| 17 | |
| 18 | #include "util/HighsInt.h"cxx . . $ `<file>/highs/util/HighsInt.h`/ |
| 19 | |
| 20 | class HighsMipSolvercxx . . $ HighsMipSolver#; |
| 21 | namespace presolvecxx . . $ presolve/ { |
| 22 | class HighsPostsolveStackcxx . . $ presolve/HighsPostsolveStack#; |
| 23 | } |
| 24 | |
| 25 | class HighsPseudocostcxx . . $ HighsPseudocost#; |
| 26 | |
| 27 | constexpr double minThresholdcxx . . $ minThreshold. = 1e-6; |
| 28 | |
| 29 | struct HighsPseudocostInitializationcxx . . $ HighsPseudocostInitialization# { |
| 30 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<double> pseudocostupcxx . . $ HighsPseudocostInitialization#pseudocostup.; |
| 31 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<double> pseudocostdowncxx . . $ HighsPseudocostInitialization#pseudocostdown.; |
| 32 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<HighsIntcxx . . $ HighsInt#> nsamplesupcxx . . $ HighsPseudocostInitialization#nsamplesup.; |
| 33 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<HighsIntcxx . . $ HighsInt#> nsamplesdowncxx . . $ HighsPseudocostInitialization#nsamplesdown.; |
| 34 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<double> inferencesupcxx . . $ HighsPseudocostInitialization#inferencesup.; |
| 35 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<double> inferencesdowncxx . . $ HighsPseudocostInitialization#inferencesdown.; |
| 36 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<HighsIntcxx . . $ HighsInt#> ninferencesupcxx . . $ HighsPseudocostInitialization#ninferencesup.; |
| 37 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<HighsIntcxx . . $ HighsInt#> ninferencesdowncxx . . $ HighsPseudocostInitialization#ninferencesdown.; |
| 38 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<double> conflictscoreupcxx . . $ HighsPseudocostInitialization#conflictscoreup.; |
| 39 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<double> conflictscoredowncxx . . $ HighsPseudocostInitialization#conflictscoredown.; |
| 40 | double cost_totalcxx . . $ HighsPseudocostInitialization#cost_total.; |
| 41 | double inferences_totalcxx . . $ HighsPseudocostInitialization#inferences_total.; |
| 42 | double conflict_avg_scorecxx . . $ HighsPseudocostInitialization#conflict_avg_score.; |
| 43 | int64_t nsamplestotalcxx . . $ HighsPseudocostInitialization#nsamplestotal.; |
| 44 | int64_t ninferencestotalcxx . . $ HighsPseudocostInitialization#ninferencestotal.; |
| 45 | |
| 46 | HighsPseudocostInitializationcxx . . $ HighsPseudocostInitialization#HighsPseudocostInitialization(c680c89b2d266b93).(const HighsPseudocostcxx . . $ HighsPseudocost#& pscost, |
| 47 | HighsIntcxx . . $ HighsInt# maxCount); |
| 48 | HighsPseudocostInitializationcxx . . $ HighsPseudocostInitialization#HighsPseudocostInitialization(4988f87ae35adbf3).( |
| 49 | const HighsPseudocostcxx . . $ HighsPseudocost#& pscost, HighsIntcxx . . $ HighsInt# maxCount, |
| 50 | const presolvecxx . . $ presolve/::HighsPostsolveStackcxx . . $ presolve/HighsPostsolveStack#& postsolveStack); |
| 51 | }; |
| 52 | |
| 53 | class HighsPseudocostcxx . . $ HighsPseudocost# { |
| 54 | friend struct HighsPseudocostInitializationcxx . . $ HighsPseudocostInitialization#; |
| 55 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<double> pseudocostupcxx . . $ HighsPseudocost#pseudocostup.; |
| 56 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<double> pseudocostdowncxx . . $ HighsPseudocost#pseudocostdown.; |
| 57 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<HighsIntcxx . . $ HighsInt#> nsamplesupcxx . . $ HighsPseudocost#nsamplesup.; |
| 58 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<HighsIntcxx . . $ HighsInt#> nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.; |
| 59 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<double> inferencesupcxx . . $ HighsPseudocost#inferencesup.; |
| 60 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<double> inferencesdowncxx . . $ HighsPseudocost#inferencesdown.; |
| 61 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<HighsIntcxx . . $ HighsInt#> ninferencesupcxx . . $ HighsPseudocost#ninferencesup.; |
| 62 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<HighsIntcxx . . $ HighsInt#> ninferencesdowncxx . . $ HighsPseudocost#ninferencesdown.; |
| 63 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<HighsIntcxx . . $ HighsInt#> ncutoffsupcxx . . $ HighsPseudocost#ncutoffsup.; |
| 64 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<HighsIntcxx . . $ HighsInt#> ncutoffsdowncxx . . $ HighsPseudocost#ncutoffsdown.; |
| 65 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<double> conflictscoreupcxx . . $ HighsPseudocost#conflictscoreup.; |
| 66 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<double> conflictscoredowncxx . . $ HighsPseudocost#conflictscoredown.; |
| 67 | |
| 68 | double conflict_weightcxx . . $ HighsPseudocost#conflict_weight.; |
| 69 | double conflict_avg_scorecxx . . $ HighsPseudocost#conflict_avg_score.; |
| 70 | double cost_totalcxx . . $ HighsPseudocost#cost_total.; |
| 71 | double inferences_totalcxx . . $ HighsPseudocost#inferences_total.; |
| 72 | int64_t nsamplestotalcxx . . $ HighsPseudocost#nsamplestotal.; |
| 73 | int64_t ninferencestotalcxx . . $ HighsPseudocost#ninferencestotal.; |
| 74 | int64_t ncutoffstotalcxx . . $ HighsPseudocost#ncutoffstotal.; |
| 75 | HighsIntcxx . . $ HighsInt# minreliablecxx . . $ HighsPseudocost#minreliable.; |
| 76 | double degeneracyFactorcxx . . $ HighsPseudocost#degeneracyFactor.; |
| 77 | |
| 78 | public: |
| 79 | HighsPseudocostcxx . . $ HighsPseudocost#HighsPseudocost(49f6e7a06ebc5aa8).() = default; |
| 80 | HighsPseudocostcxx . . $ HighsPseudocost#HighsPseudocost(483966581fe739f9).(const HighsMipSolvercxx . . $ HighsMipSolver#& mipsolver); |
| 81 | |
| 82 | void subtractBasecxx . . $ HighsPseudocost#subtractBase(9c9d2850297cf67b).(const HighsPseudocostcxx . . $ HighsPseudocost#& base) { |
| 83 | for (size_tcxx . . $ size_t# i = 0; i != pseudocostupcxx . . $ HighsPseudocost#pseudocostup..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).(); ++i) { |
| 84 | pseudocostupcxx . . $ HighsPseudocost#pseudocostup.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i] -= base.pseudocostupcxx . . $ HighsPseudocost#pseudocostup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).i]; |
| 85 | pseudocostdowncxx . . $ HighsPseudocost#pseudocostdown.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i] -= base.pseudocostdowncxx . . $ HighsPseudocost#pseudocostdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).i]; |
| 86 | nsamplesupcxx . . $ HighsPseudocost#nsamplesup.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i] -= base.nsamplesupcxx . . $ HighsPseudocost#nsamplesup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).i]; |
| 87 | nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i] -= base.nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).i]; |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | void increaseConflictWeightcxx . . $ HighsPseudocost#increaseConflictWeight(49f6e7a06ebc5aa8).() { |
| 92 | conflict_weightcxx . . $ HighsPseudocost#conflict_weight. *= 1.02; |
| 93 | |
| 94 | if (conflict_weightcxx . . $ HighsPseudocost#conflict_weight. > 1000.0) { |
| 95 | double scale = 1.0 / conflict_weightcxx . . $ HighsPseudocost#conflict_weight.; |
| 96 | conflict_weightcxx . . $ HighsPseudocost#conflict_weight. = 1.0; |
| 97 | conflict_avg_scorecxx . . $ HighsPseudocost#conflict_avg_score. *= scale; |
| 98 | |
| 99 | for (size_tcxx . . $ size_t# i = 0; i != conflictscoreupcxx . . $ HighsPseudocost#conflictscoreup..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).(); ++i) { |
| 100 | conflictscoreupcxx . . $ HighsPseudocost#conflictscoreup.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i] *= scale; |
| 101 | conflictscoredowncxx . . $ HighsPseudocost#conflictscoredown.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i] *= scale; |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | void setDegeneracyFactorcxx . . $ HighsPseudocost#setDegeneracyFactor(ba8836b59fb42830).(double degeneracyFactor) { |
| 107 | assertcxx . . $ `/usr/include/assert.h:50:10`!(degeneracyFactor >= 1.0); |
| 108 | this->degeneracyFactorcxx . . $ HighsPseudocost#degeneracyFactor. = degeneracyFactor; |
| 109 | } |
| 110 | |
| 111 | void increaseConflictScoreUpcxx . . $ HighsPseudocost#increaseConflictScoreUp(d4f767463ce0a6b3).(HighsIntcxx . . $ HighsInt# col) { |
| 112 | conflictscoreupcxx . . $ HighsPseudocost#conflictscoreup.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col] += conflict_weightcxx . . $ HighsPseudocost#conflict_weight.; |
| 113 | conflict_avg_scorecxx . . $ HighsPseudocost#conflict_avg_score. += conflict_weightcxx . . $ HighsPseudocost#conflict_weight.; |
| 114 | } |
| 115 | |
| 116 | void increaseConflictScoreDowncxx . . $ HighsPseudocost#increaseConflictScoreDown(d4f767463ce0a6b3).(HighsIntcxx . . $ HighsInt# col) { |
| 117 | conflictscoredowncxx . . $ HighsPseudocost#conflictscoredown.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col] += conflict_weightcxx . . $ HighsPseudocost#conflict_weight.; |
| 118 | conflict_avg_scorecxx . . $ HighsPseudocost#conflict_avg_score. += conflict_weightcxx . . $ HighsPseudocost#conflict_weight.; |
| 119 | } |
| 120 | |
| 121 | void setMinReliablecxx . . $ HighsPseudocost#setMinReliable(d4f767463ce0a6b3).(HighsIntcxx . . $ HighsInt# minreliable) { this->minreliablecxx . . $ HighsPseudocost#minreliable. = minreliable; } |
| 122 | |
| 123 | HighsIntcxx . . $ HighsInt# getMinReliablecxx . . $ HighsPseudocost#getMinReliable(455f465bc33b4cdf).() const { return minreliablecxx . . $ HighsPseudocost#minreliable.; } |
| 124 | |
| 125 | HighsIntcxx . . $ HighsInt# getNumObservationscxx . . $ HighsPseudocost#getNumObservations(7ccb52b1bfe01045).(HighsIntcxx . . $ HighsInt# col) const { |
| 126 | return nsamplesupcxx . . $ HighsPseudocost#nsamplesup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] + nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]; |
| 127 | } |
| 128 | |
| 129 | HighsIntcxx . . $ HighsInt# getNumObservationsUpcxx . . $ HighsPseudocost#getNumObservationsUp(7ccb52b1bfe01045).(HighsIntcxx . . $ HighsInt# col) const { return nsamplesupcxx . . $ HighsPseudocost#nsamplesup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]; } |
| 130 | |
| 131 | HighsIntcxx . . $ HighsInt# getNumObservationsDowncxx . . $ HighsPseudocost#getNumObservationsDown(7ccb52b1bfe01045).(HighsIntcxx . . $ HighsInt# col) const { |
| 132 | return nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]; |
| 133 | } |
| 134 | |
| 135 | void addCutoffObservationcxx . . $ HighsPseudocost#addCutoffObservation(918ebd27a9ddbad3).(HighsIntcxx . . $ HighsInt# col, bool upbranch) { |
| 136 | ++ncutoffstotalcxx . . $ HighsPseudocost#ncutoffstotal.; |
| 137 | if (upbranch) |
| 138 | ncutoffsupcxx . . $ HighsPseudocost#ncutoffsup.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col] += 1; |
| 139 | else |
| 140 | ncutoffsdowncxx . . $ HighsPseudocost#ncutoffsdown.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col] += 1; |
| 141 | } |
| 142 | |
| 143 | void addObservationcxx . . $ HighsPseudocost#addObservation(d560e21ae44a0759).(HighsIntcxx . . $ HighsInt# col, double delta, double objdelta) { |
| 144 | assertcxx . . $ `/usr/include/assert.h:50:10`!(delta != 0.0); |
| 145 | assertcxx . . $ `/usr/include/assert.h:50:10`!(objdelta >= 0.0); |
| 146 | if (delta > 0.0) { |
| 147 | double unit_gain = objdelta / delta; |
| 148 | double d = unit_gain - pseudocostupcxx . . $ HighsPseudocost#pseudocostup.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col]; |
| 149 | nsamplesupcxx . . $ HighsPseudocost#nsamplesup.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col] += 1; |
| 150 | pseudocostupcxx . . $ HighsPseudocost#pseudocostup.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col] += d / nsamplesupcxx . . $ HighsPseudocost#nsamplesup.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col]; |
| 151 | |
| 152 | d = unit_gain - cost_totalcxx . . $ HighsPseudocost#cost_total.; |
| 153 | ++nsamplestotalcxx . . $ HighsPseudocost#nsamplestotal.; |
| 154 | cost_totalcxx . . $ HighsPseudocost#cost_total. += d / static_cast<double>(nsamplestotalcxx . . $ HighsPseudocost#nsamplestotal.); |
| 155 | } else { |
| 156 | double unit_gain = -objdelta / delta; |
| 157 | double d = unit_gain - pseudocostdowncxx . . $ HighsPseudocost#pseudocostdown.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col]; |
| 158 | nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col] += 1; |
| 159 | pseudocostdowncxx . . $ HighsPseudocost#pseudocostdown.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col] += d / nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col]; |
| 160 | |
| 161 | d = unit_gain - cost_totalcxx . . $ HighsPseudocost#cost_total.; |
| 162 | ++nsamplestotalcxx . . $ HighsPseudocost#nsamplestotal.; |
| 163 | cost_totalcxx . . $ HighsPseudocost#cost_total. += d / static_cast<double>(nsamplestotalcxx . . $ HighsPseudocost#nsamplestotal.); |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | void addInferenceObservationcxx . . $ HighsPseudocost#addInferenceObservation(6908015b96d379c0).(HighsIntcxx . . $ HighsInt# col, HighsIntcxx . . $ HighsInt# ninferences, |
| 168 | bool upbranch) { |
| 169 | double d = ninferences - inferences_totalcxx . . $ HighsPseudocost#inferences_total.; |
| 170 | ++ninferencestotalcxx . . $ HighsPseudocost#ninferencestotal.; |
| 171 | inferences_totalcxx . . $ HighsPseudocost#inferences_total. += d / static_cast<double>(ninferencestotalcxx . . $ HighsPseudocost#ninferencestotal.); |
| 172 | if (upbranch) { |
| 173 | d = ninferences - inferencesupcxx . . $ HighsPseudocost#inferencesup.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col]; |
| 174 | ninferencesupcxx . . $ HighsPseudocost#ninferencesup.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col] += 1; |
| 175 | inferencesupcxx . . $ HighsPseudocost#inferencesup.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col] += d / ninferencesupcxx . . $ HighsPseudocost#ninferencesup.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col]; |
| 176 | } else { |
| 177 | d = ninferences - inferencesdowncxx . . $ HighsPseudocost#inferencesdown.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col]; |
| 178 | ninferencesdowncxx . . $ HighsPseudocost#ninferencesdown.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col] += 1; |
| 179 | inferencesdowncxx . . $ HighsPseudocost#inferencesdown.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col] += d / ninferencesdowncxx . . $ HighsPseudocost#ninferencesdown.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).col]; |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | bool isReliablecxx . . $ HighsPseudocost#isReliable(4a668f6de69bf818).(HighsIntcxx . . $ HighsInt# col) const { |
| 184 | return stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(nsamplesupcxx . . $ HighsPseudocost#nsamplesup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col], nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]) >= minreliablecxx . . $ HighsPseudocost#minreliable.; |
| 185 | } |
| 186 | |
| 187 | bool isReliableUpcxx . . $ HighsPseudocost#isReliableUp(4a668f6de69bf818).(HighsIntcxx . . $ HighsInt# col) const { |
| 188 | return nsamplesupcxx . . $ HighsPseudocost#nsamplesup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] >= minreliablecxx . . $ HighsPseudocost#minreliable.; |
| 189 | } |
| 190 | |
| 191 | bool isReliableDowncxx . . $ HighsPseudocost#isReliableDown(4a668f6de69bf818).(HighsIntcxx . . $ HighsInt# col) const { |
| 192 | return nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] >= minreliablecxx . . $ HighsPseudocost#minreliable.; |
| 193 | } |
| 194 | |
| 195 | double getAvgPseudocostcxx . . $ HighsPseudocost#getAvgPseudocost(21b6c25e127938e2).() const { return cost_totalcxx . . $ HighsPseudocost#cost_total.; } |
| 196 | |
| 197 | double getPseudocostUpcxx . . $ HighsPseudocost#getPseudocostUp(3047521f90909539).(HighsIntcxx . . $ HighsInt# col, double frac, double offset) const { |
| 198 | double up = stdcxx . . $ std/::ceil(frac) - frac; |
| 199 | double cost; |
| 200 | |
| 201 | if (nsamplesupcxx . . $ HighsPseudocost#nsamplesup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] == 0 || nsamplesupcxx . . $ HighsPseudocost#nsamplesup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] < minreliablecxx . . $ HighsPseudocost#minreliable.) { |
| 202 | double weightPs = |
| 203 | nsamplesupcxx . . $ HighsPseudocost#nsamplesup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] == 0 |
| 204 | ? 0 |
| 205 | : 0.9 + 0.1 * nsamplesupcxx . . $ HighsPseudocost#nsamplesup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] / static_cast<double>(minreliablecxx . . $ HighsPseudocost#minreliable.); |
| 206 | cost = weightPs * pseudocostupcxx . . $ HighsPseudocost#pseudocostup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]; |
| 207 | cost += (1.0 - weightPs) * getAvgPseudocostcxx . . $ HighsPseudocost#getAvgPseudocost(21b6c25e127938e2).(); |
| 208 | } else |
| 209 | cost = pseudocostupcxx . . $ HighsPseudocost#pseudocostup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]; |
| 210 | return up * (offset + cost); |
| 211 | } |
| 212 | |
| 213 | double getPseudocostDowncxx . . $ HighsPseudocost#getPseudocostDown(3047521f90909539).(HighsIntcxx . . $ HighsInt# col, double frac, double offset) const { |
| 214 | double down = frac - stdcxx . . $ std/::floor(frac); |
| 215 | double cost; |
| 216 | |
| 217 | if (nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] == 0 || nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] < minreliablecxx . . $ HighsPseudocost#minreliable.) { |
| 218 | double weightPs = nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] == 0 |
| 219 | ? 0 |
| 220 | : 0.9 + 0.1 * nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] / |
| 221 | static_cast<double>(minreliablecxx . . $ HighsPseudocost#minreliable.); |
| 222 | cost = weightPs * pseudocostdowncxx . . $ HighsPseudocost#pseudocostdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]; |
| 223 | cost += (1.0 - weightPs) * getAvgPseudocostcxx . . $ HighsPseudocost#getAvgPseudocost(21b6c25e127938e2).(); |
| 224 | } else |
| 225 | cost = pseudocostdowncxx . . $ HighsPseudocost#pseudocostdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]; |
| 226 | |
| 227 | return down * (offset + cost); |
| 228 | } |
| 229 | |
| 230 | double getPseudocostUpcxx . . $ HighsPseudocost#getPseudocostUp(871c3035069e67f3).(HighsIntcxx . . $ HighsInt# col, double frac) const { |
| 231 | double up = stdcxx . . $ std/::ceil(frac) - frac; |
| 232 | if (nsamplesupcxx . . $ HighsPseudocost#nsamplesup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] == 0) return up * cost_totalcxx . . $ HighsPseudocost#cost_total.; |
| 233 | return up * pseudocostupcxx . . $ HighsPseudocost#pseudocostup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]; |
| 234 | } |
| 235 | |
| 236 | double getPseudocostDowncxx . . $ HighsPseudocost#getPseudocostDown(871c3035069e67f3).(HighsIntcxx . . $ HighsInt# col, double frac) const { |
| 237 | double down = frac - stdcxx . . $ std/::floor(frac); |
| 238 | if (nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] == 0) return down * cost_totalcxx . . $ HighsPseudocost#cost_total.; |
| 239 | return down * pseudocostdowncxx . . $ HighsPseudocost#pseudocostdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]; |
| 240 | } |
| 241 | |
| 242 | double getConflictScoreUpcxx . . $ HighsPseudocost#getConflictScoreUp(8bbae5fb2e9ef7ac).(HighsIntcxx . . $ HighsInt# col) const { |
| 243 | return conflictscoreupcxx . . $ HighsPseudocost#conflictscoreup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] / conflict_weightcxx . . $ HighsPseudocost#conflict_weight.; |
| 244 | } |
| 245 | |
| 246 | double getConflictScoreDowncxx . . $ HighsPseudocost#getConflictScoreDown(8bbae5fb2e9ef7ac).(HighsIntcxx . . $ HighsInt# col) const { |
| 247 | return conflictscoredowncxx . . $ HighsPseudocost#conflictscoredown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] / conflict_weightcxx . . $ HighsPseudocost#conflict_weight.; |
| 248 | } |
| 249 | |
| 250 | double getScorecxx . . $ HighsPseudocost#getScore(3047521f90909539).(HighsIntcxx . . $ HighsInt# col, double upcost, double downcost) const { |
| 251 | double costScore = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(upcost, minThresholdcxx . . $ minThreshold.) * |
| 252 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(downcost, minThresholdcxx . . $ minThreshold.) / |
| 253 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(minThresholdcxx . . $ minThreshold., cost_totalcxx . . $ HighsPseudocost#cost_total. * cost_totalcxx . . $ HighsPseudocost#cost_total.); |
| 254 | double inferenceScore = |
| 255 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(inferencesupcxx . . $ HighsPseudocost#inferencesup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col], minThresholdcxx . . $ minThreshold.) * |
| 256 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(inferencesdowncxx . . $ HighsPseudocost#inferencesdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col], minThresholdcxx . . $ minThreshold.) / |
| 257 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(minThresholdcxx . . $ minThreshold., inferences_totalcxx . . $ HighsPseudocost#inferences_total. * inferences_totalcxx . . $ HighsPseudocost#inferences_total.); |
| 258 | |
| 259 | double cutOffScoreUp = |
| 260 | ncutoffsupcxx . . $ HighsPseudocost#ncutoffsup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] / |
| 261 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(1.0, static_cast<double>(ncutoffsupcxx . . $ HighsPseudocost#ncutoffsup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]) + |
| 262 | static_cast<double>(nsamplesupcxx . . $ HighsPseudocost#nsamplesup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col])); |
| 263 | double cutOffScoreDown = |
| 264 | ncutoffsdowncxx . . $ HighsPseudocost#ncutoffsdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] / |
| 265 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(1.0, static_cast<double>(ncutoffsdowncxx . . $ HighsPseudocost#ncutoffsdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]) + |
| 266 | static_cast<double>(nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col])); |
| 267 | double avgCutoffs = static_cast<double>(ncutoffstotalcxx . . $ HighsPseudocost#ncutoffstotal.) / |
| 268 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(1.0, static_cast<double>(ncutoffstotalcxx . . $ HighsPseudocost#ncutoffstotal.) + |
| 269 | static_cast<double>(nsamplestotalcxx . . $ HighsPseudocost#nsamplestotal.)); |
| 270 | |
| 271 | double cutoffScore = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(cutOffScoreUp, minThresholdcxx . . $ minThreshold.) * |
| 272 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(cutOffScoreDown, minThresholdcxx . . $ minThreshold.) / |
| 273 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(minThresholdcxx . . $ minThreshold., avgCutoffs * avgCutoffs); |
| 274 | |
| 275 | double conflictScoreUp = conflictscoreupcxx . . $ HighsPseudocost#conflictscoreup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] / conflict_weightcxx . . $ HighsPseudocost#conflict_weight.; |
| 276 | double conflictScoreDown = conflictscoredowncxx . . $ HighsPseudocost#conflictscoredown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] / conflict_weightcxx . . $ HighsPseudocost#conflict_weight.; |
| 277 | double conflictScoreAvg = |
| 278 | conflict_avg_scorecxx . . $ HighsPseudocost#conflict_avg_score. / |
| 279 | (conflict_weightcxx . . $ HighsPseudocost#conflict_weight. * static_cast<double>(conflictscoreupcxx . . $ HighsPseudocost#conflictscoreup..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).())); |
| 280 | double conflictScore = |
| 281 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(conflictScoreUp, minThresholdcxx . . $ minThreshold.) * |
| 282 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(conflictScoreDown, minThresholdcxx . . $ minThreshold.) / |
| 283 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(minThresholdcxx . . $ minThreshold., conflictScoreAvg * conflictScoreAvg); |
| 284 | |
| 285 | auto mapScore = [](double score) { return 1.0 - 1.0 / (1.0 + score); }; |
| 286 | return mapScore(cxx . . $ HighsPseudocost#getScore(3047521f90909539).$anonymous_type_0#`operator()`(7e3a3c6b59947c6d).costScore) / degeneracyFactorcxx . . $ HighsPseudocost#degeneracyFactor. + |
| 287 | degeneracyFactorcxx . . $ HighsPseudocost#degeneracyFactor. * |
| 288 | (1e-2 * mapScore(cxx . . $ HighsPseudocost#getScore(3047521f90909539).$anonymous_type_0#`operator()`(7e3a3c6b59947c6d).conflictScore) + |
| 289 | 1e-4 * (mapScore(cxx . . $ HighsPseudocost#getScore(3047521f90909539).$anonymous_type_0#`operator()`(7e3a3c6b59947c6d).cutoffScore) + mapScore(cxx . . $ HighsPseudocost#getScore(3047521f90909539).$anonymous_type_0#`operator()`(7e3a3c6b59947c6d).inferenceScore))); |
| 290 | } |
| 291 | |
| 292 | double getScorecxx . . $ HighsPseudocost#getScore(871c3035069e67f3).(HighsIntcxx . . $ HighsInt# col, double frac) const { |
| 293 | double upcost = getPseudocostUpcxx . . $ HighsPseudocost#getPseudocostUp(871c3035069e67f3).(col, frac); |
| 294 | double downcost = getPseudocostDowncxx . . $ HighsPseudocost#getPseudocostDown(871c3035069e67f3).(col, frac); |
| 295 | |
| 296 | return getScorecxx . . $ HighsPseudocost#getScore(3047521f90909539).(col, upcost, downcost); |
| 297 | } |
| 298 | |
| 299 | double getScoreUpcxx . . $ HighsPseudocost#getScoreUp(871c3035069e67f3).(HighsIntcxx . . $ HighsInt# col, double frac) const { |
| 300 | double costScore = |
| 301 | getPseudocostUpcxx . . $ HighsPseudocost#getPseudocostUp(871c3035069e67f3).(col, frac) / stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(minThresholdcxx . . $ minThreshold., cost_totalcxx . . $ HighsPseudocost#cost_total.); |
| 302 | double inferenceScore = |
| 303 | inferencesupcxx . . $ HighsPseudocost#inferencesup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] / stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(minThresholdcxx . . $ minThreshold., inferences_totalcxx . . $ HighsPseudocost#inferences_total.); |
| 304 | |
| 305 | double cutOffScoreUp = |
| 306 | ncutoffsupcxx . . $ HighsPseudocost#ncutoffsup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] / |
| 307 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(1.0, static_cast<double>(ncutoffsupcxx . . $ HighsPseudocost#ncutoffsup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]) + |
| 308 | static_cast<double>(nsamplesupcxx . . $ HighsPseudocost#nsamplesup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col])); |
| 309 | double avgCutoffs = static_cast<double>(ncutoffstotalcxx . . $ HighsPseudocost#ncutoffstotal.) / |
| 310 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(1.0, static_cast<double>(ncutoffstotalcxx . . $ HighsPseudocost#ncutoffstotal.) + |
| 311 | static_cast<double>(nsamplestotalcxx . . $ HighsPseudocost#nsamplestotal.)); |
| 312 | |
| 313 | double cutoffScore = cutOffScoreUp / stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(minThresholdcxx . . $ minThreshold., avgCutoffs); |
| 314 | |
| 315 | double conflictScoreUp = conflictscoreupcxx . . $ HighsPseudocost#conflictscoreup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] / conflict_weightcxx . . $ HighsPseudocost#conflict_weight.; |
| 316 | double conflictScoreAvg = |
| 317 | conflict_avg_scorecxx . . $ HighsPseudocost#conflict_avg_score. / |
| 318 | (conflict_weightcxx . . $ HighsPseudocost#conflict_weight. * static_cast<double>(conflictscoreupcxx . . $ HighsPseudocost#conflictscoreup..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).())); |
| 319 | double conflictScore = |
| 320 | conflictScoreUp / stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(minThresholdcxx . . $ minThreshold., conflictScoreAvg); |
| 321 | |
| 322 | auto mapScore = [](double score) { return 1.0 - 1.0 / (1.0 + score); }; |
| 323 | |
| 324 | return mapScore(cxx . . $ HighsPseudocost#getScoreUp(871c3035069e67f3).$anonymous_type_1#`operator()`(7e3a3c6b59947c6d).costScore) + |
| 325 | (1e-2 * mapScore(cxx . . $ HighsPseudocost#getScoreUp(871c3035069e67f3).$anonymous_type_1#`operator()`(7e3a3c6b59947c6d).conflictScore) + |
| 326 | 1e-4 * (mapScore(cxx . . $ HighsPseudocost#getScoreUp(871c3035069e67f3).$anonymous_type_1#`operator()`(7e3a3c6b59947c6d).cutoffScore) + mapScore(cxx . . $ HighsPseudocost#getScoreUp(871c3035069e67f3).$anonymous_type_1#`operator()`(7e3a3c6b59947c6d).inferenceScore))); |
| 327 | } |
| 328 | |
| 329 | double getScoreDowncxx . . $ HighsPseudocost#getScoreDown(871c3035069e67f3).(HighsIntcxx . . $ HighsInt# col, double frac) const { |
| 330 | double costScore = |
| 331 | getPseudocostDowncxx . . $ HighsPseudocost#getPseudocostDown(871c3035069e67f3).(col, frac) / stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(minThresholdcxx . . $ minThreshold., cost_totalcxx . . $ HighsPseudocost#cost_total.); |
| 332 | double inferenceScore = |
| 333 | inferencesdowncxx . . $ HighsPseudocost#inferencesdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] / stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(minThresholdcxx . . $ minThreshold., inferences_totalcxx . . $ HighsPseudocost#inferences_total.); |
| 334 | |
| 335 | double cutOffScoreDown = |
| 336 | ncutoffsdowncxx . . $ HighsPseudocost#ncutoffsdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] / |
| 337 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(1.0, static_cast<double>(ncutoffsdowncxx . . $ HighsPseudocost#ncutoffsdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]) + |
| 338 | static_cast<double>(nsamplesdowncxx . . $ HighsPseudocost#nsamplesdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col])); |
| 339 | double avgCutoffs = static_cast<double>(ncutoffstotalcxx . . $ HighsPseudocost#ncutoffstotal.) / |
| 340 | stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(1.0, static_cast<double>(ncutoffstotalcxx . . $ HighsPseudocost#ncutoffstotal.) + |
| 341 | static_cast<double>(nsamplestotalcxx . . $ HighsPseudocost#nsamplestotal.)); |
| 342 | |
| 343 | double cutoffScore = cutOffScoreDown / stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(minThresholdcxx . . $ minThreshold., avgCutoffs); |
| 344 | |
| 345 | double conflictScoreDown = conflictscoredowncxx . . $ HighsPseudocost#conflictscoredown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col] / conflict_weightcxx . . $ HighsPseudocost#conflict_weight.; |
| 346 | double conflictScoreAvg = |
| 347 | conflict_avg_scorecxx . . $ HighsPseudocost#conflict_avg_score. / |
| 348 | (conflict_weightcxx . . $ HighsPseudocost#conflict_weight. * static_cast<double>(conflictscoredowncxx . . $ HighsPseudocost#conflictscoredown..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).())); |
| 349 | double conflictScore = |
| 350 | conflictScoreDown / stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(minThresholdcxx . . $ minThreshold., conflictScoreAvg); |
| 351 | |
| 352 | auto mapScore = [](double score) { return 1.0 - 1.0 / (1.0 + score); }; |
| 353 | |
| 354 | return mapScore(cxx . . $ HighsPseudocost#getScoreDown(871c3035069e67f3).$anonymous_type_2#`operator()`(7e3a3c6b59947c6d).costScore) + |
| 355 | (1e-2 * mapScore(cxx . . $ HighsPseudocost#getScoreDown(871c3035069e67f3).$anonymous_type_2#`operator()`(7e3a3c6b59947c6d).conflictScore) + |
| 356 | 1e-4 * (mapScore(cxx . . $ HighsPseudocost#getScoreDown(871c3035069e67f3).$anonymous_type_2#`operator()`(7e3a3c6b59947c6d).cutoffScore) + mapScore(cxx . . $ HighsPseudocost#getScoreDown(871c3035069e67f3).$anonymous_type_2#`operator()`(7e3a3c6b59947c6d).inferenceScore))); |
| 357 | } |
| 358 | |
| 359 | double getAvgInferencesUpcxx . . $ HighsPseudocost#getAvgInferencesUp(8bbae5fb2e9ef7ac).(HighsIntcxx . . $ HighsInt# col) const { return inferencesupcxx . . $ HighsPseudocost#inferencesup.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]; } |
| 360 | |
| 361 | double getAvgInferencesDowncxx . . $ HighsPseudocost#getAvgInferencesDown(8bbae5fb2e9ef7ac).(HighsIntcxx . . $ HighsInt# col) const { |
| 362 | return inferencesdowncxx . . $ HighsPseudocost#inferencesdown.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).col]; |
| 363 | } |
| 364 | }; |
| 365 | |
| 366 | #endif |