MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / transformNewIntegerFeasibleSolution

Method transformNewIntegerFeasibleSolution

highs/mip/HighsMipWorker.cpp:77–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77std::pair<bool, double> HighsMipWorker::transformNewIntegerFeasibleSolution(
78 const std::vector<double>& sol) const {
79 HighsSolution solution;
80 solution.col_value = sol;
81 solution.value_valid = true;
82
83 // Perform primal postsolve to get the original column values
84 mipsolver_.mipdata_->postSolveStack.undoPrimal(*mipsolver_.options_mip_,
85 solution, -1, true);
86
87 // Determine the row values, as they aren't computed in primal
88 // postsolve
89 HighsStatus return_status =
90 calculateRowValuesQuad(*mipsolver_.orig_model_, solution);
91 if (kAllowDeveloperAssert) assert(return_status == HighsStatus::kOk);
92
93 // compute the objective value in the original space
94 double bound_violation_ = 0;
95 double row_violation_ = 0;
96 double integrality_violation_ = 0;
97
98 HighsCDouble mipsolver_quad_objective_value = 0;
99
100 bool feasible = mipsolver_.solutionFeasible(
101 mipsolver_.orig_model_, solution.col_value, &solution.row_value,
102 bound_violation_, row_violation_, integrality_violation_,
103 mipsolver_quad_objective_value);
104
105 const double transformed_solobj = static_cast<double>(
106 static_cast<HighsInt>(mipsolver_.orig_model_->sense_) *
107 mipsolver_quad_objective_value -
108 mipsolver_.model_->offset_);
109
110 return std::make_pair(feasible, transformed_solobj);
111}
112
113bool HighsMipWorker::trySolution(const std::vector<double>& solution,
114 const int solution_source) {

Callers 1

runMethod · 0.45

Calls 3

calculateRowValuesQuadFunction · 0.85
undoPrimalMethod · 0.80
solutionFeasibleMethod · 0.80

Tested by

no test coverage detected