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

Method changeCostsInterface

highs/lp_data/HighsInterface.cpp:908–938  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

906}
907
908HighsStatus Highs::changeCostsInterface(HighsIndexCollection& index_collection,
909 const double* cost) {
910 HighsInt num_cost = dataSize(index_collection);
911 // If a non-positive number of costs (may) need changing nothing needs to be
912 // done
913 if (num_cost <= 0) return HighsStatus::kOk;
914 if (doubleUserDataNotNull(options_.log_options, cost, "column costs"))
915 return HighsStatus::kError;
916 // Take a copy of the cost that can be normalised
917 std::vector<double> local_colCost{cost, cost + num_cost};
918 HighsStatus return_status = HighsStatus::kOk;
919 bool local_has_infinite_cost = false;
920 return_status = interpretCallStatus(
921 options_.log_options,
922 assessCosts(options_, 0, index_collection, local_colCost,
923 local_has_infinite_cost, options_.infinite_cost),
924 return_status, "assessCosts");
925 if (return_status == HighsStatus::kError) return return_status;
926 HighsLp& lp = model_.lp_;
927 changeLpCosts(lp, index_collection, local_colCost, options_.infinite_cost);
928
929 // Interpret possible introduction of infinite costs
930 lp.has_infinite_cost_ = lp.has_infinite_cost_ || local_has_infinite_cost;
931 assert(lp.has_infinite_cost_ == lp.hasInfiniteCost(options_.infinite_cost));
932
933 // Deduce the consequences of new costs
934 invalidateModelStatusSolutionAndInfo();
935 // Determine any implications for simplex data
936 ekk_instance_.updateStatus(LpAction::kNewCosts);
937 return HighsStatus::kOk;
938}
939
940bool Highs::feasibleWrtBounds(const bool columns) const {
941 if (this->info_.primal_solution_status != kSolutionStatusFeasible)

Callers

nothing calls this directly

Calls 7

dataSizeFunction · 0.85
doubleUserDataNotNullFunction · 0.85
interpretCallStatusFunction · 0.85
assessCostsFunction · 0.85
changeLpCostsFunction · 0.85
hasInfiniteCostMethod · 0.80
updateStatusMethod · 0.80

Tested by

no test coverage detected