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

Method readModel

highs/lp_data/Highs.cpp:790–829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

788}
789
790HighsStatus Highs::readModel(const std::string& filename) {
791 this->logHeader();
792 HighsStatus return_status = HighsStatus::kOk;
793 Filereader* reader =
794 Filereader::getFilereader(options_.log_options, filename);
795 if (reader == NULL) {
796 highsLogUser(options_.log_options, HighsLogType::kError,
797 "Model file %s not supported\n", filename.c_str());
798 return HighsStatus::kError;
799 }
800
801 HighsModel model;
802 FilereaderRetcode call_code =
803 reader->readModelFromFile(options_, filename, model);
804 delete reader;
805 if (call_code != FilereaderRetcode::kOk) {
806 interpretFilereaderRetcode(options_.log_options, filename, call_code);
807 const HighsStatus call_status = call_code == FilereaderRetcode::kWarning
808 ? HighsStatus::kWarning
809 : HighsStatus::kError;
810 return_status = interpretCallStatus(options_.log_options, call_status,
811 return_status, "readModelFromFile");
812 if (return_status == HighsStatus::kError) return return_status;
813 }
814 model.lp_.model_name_ = extractModelName(filename);
815 const bool remove_rows_of_count_1 = false;
816 if (remove_rows_of_count_1) {
817 // .lp files from PWSC (notably st-test23.lp) have bounds for
818 // semi-continuous variables in the constraints section. By default,
819 // these are interpreted as constraints, so the semi-continuous
820 // variables are not set up correctly. Fix is to remove all rows of
821 // count 1, interpreting their bounds as bounds on the corresponding
822 // variable.
823 removeRowsOfCountOne(options_.log_options, model.lp_);
824 }
825 return_status =
826 interpretCallStatus(options_.log_options, passModel(std::move(model)),
827 return_status, "passModel");
828 return returnFromHighs(return_status);
829}
830
831HighsStatus Highs::matrixImage(
832 const std::string& matrix_image_filename,

Callers 15

mainFunction · 0.45
Docs.pyFile · 0.45
TestHighsModel.cppFile · 0.45
TestInfo.cppFile · 0.45
TestRanging.cppFile · 0.45
runHipoTestFunction · 0.45
TestFilereader.cppFile · 0.45
freeFixedModelTestFunction · 0.45

Calls 8

logHeaderMethod · 0.95
highsLogUserFunction · 0.85
interpretCallStatusFunction · 0.85
extractModelNameFunction · 0.85
removeRowsOfCountOneFunction · 0.85
c_strMethod · 0.80
readModelFromFileMethod · 0.45

Tested by 15

runHipoTestFunction · 0.36
freeFixedModelTestFunction · 0.36
instanceTestFunction · 0.36
testDualObjectiveFunction · 0.36
testStandardFormModelFunction · 0.36
testMpsFunction · 0.36
presolveSolvePostsolveFunction · 0.36
testBasisReloadModelFunction · 0.36
runMipUserSolutionTestFunction · 0.36
mpsGalenetFunction · 0.36
mpsUnboundedFunction · 0.36