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

Method validLinearObjective

highs/lp_data/HighsInterface.cpp:3867–3889  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3865}
3866
3867bool Highs::validLinearObjective(const HighsLinearObjective& linear_objective,
3868 const HighsInt iObj) const {
3869 HighsInt linear_objective_coefficients_size =
3870 linear_objective.coefficients.size();
3871 if (linear_objective_coefficients_size != this->model_.lp_.num_col_) {
3872 highsLogUser(
3873 options_.log_options, HighsLogType::kError,
3874 "Coefficient vector for linear objective %s has size %d != %d = "
3875 "lp.num_col_\n",
3876 iObj >= 0 ? std::to_string(iObj).c_str() : "",
3877 int(linear_objective_coefficients_size),
3878 int(this->model_.lp_.num_col_));
3879 return false;
3880 }
3881 if (!options_.blend_multi_objectives &&
3882 hasRepeatedLinearObjectivePriorities(&linear_objective)) {
3883 highsLogUser(
3884 options_.log_options, HighsLogType::kError,
3885 "Repeated priorities for lexicographic optimization is illegal\n");
3886 return false;
3887 }
3888 return true;
3889}
3890
3891bool Highs::hasRepeatedLinearObjectivePriorities(
3892 const HighsLinearObjective* linear_objective) const {

Callers 1

addLinearObjectiveMethod · 0.95

Calls 4

highsLogUserFunction · 0.85
to_stringFunction · 0.85
c_strMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected