Skip to content

Commit 535336c

Browse files
committed
Update HiGHS to 1.8.1
1 parent 05fce3e commit 535336c

39 files changed

+1048
-320
lines changed

thirdparty/solvers/highs/HConfig.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef HCONFIG_H_
22
#define HCONFIG_H_
33

4-
/* #undef FAST_BUILD */
4+
#define FAST_BUILD
55
/* #undef ZLIB_FOUND */
66
/* #undef CUPDLP_CPU */
77
#define CMAKE_BUILD_TYPE "Release"
@@ -12,10 +12,10 @@
1212
/* #undef HIGHS_HAVE_BUILTIN_CLZ */
1313
#define HIGHS_HAVE_BITSCAN_REVERSE
1414

15-
#define HIGHS_GITHASH "fcfb53414"
15+
#define HIGHS_GITHASH "4a7f24ac6"
1616
#define HIGHS_VERSION_MAJOR 1
1717
#define HIGHS_VERSION_MINOR 8
18-
#define HIGHS_VERSION_PATCH 0
18+
#define HIGHS_VERSION_PATCH 1
1919
#define HIGHS_DIR "E:/HiGHS"
2020

2121
#endif /* HCONFIG_H_ */

thirdparty/solvers/highs/Highs.h

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ class Highs {
176176
HighsStatus readBasis(const std::string& filename);
177177

178178
/**
179-
* @brief Presolve the incumbent model
179+
* @brief Presolve the incumbent model, allowing the presolved model
180+
* to be extracted. Subsequent solution of the incumbent model will
181+
* only use presolve if there is no valid basis
180182
*/
181183
HighsStatus presolve();
182184

@@ -400,6 +402,17 @@ class Highs {
400402
* Methods for model output
401403
*/
402404

405+
/**
406+
* @brief Identify and the standard form of the HighsLp instance in
407+
* HiGHS
408+
*/
409+
HighsStatus getStandardFormLp(HighsInt& num_col, HighsInt& num_row,
410+
HighsInt& num_nz, double& offset,
411+
double* cost = nullptr, double* rhs = nullptr,
412+
HighsInt* start = nullptr,
413+
HighsInt* index = nullptr,
414+
double* value = nullptr);
415+
403416
/**
404417
* @brief Return a const reference to the presolved HighsLp instance in HiGHS
405418
*/
@@ -493,6 +506,15 @@ class Highs {
493506
*/
494507
HighsStatus getDualRaySparse(bool& has_dual_ray, HVector& row_ep_buffer);
495508

509+
/**
510+
* @brief Indicate whether a dual unboundedness direction exists,
511+
* and gets it if it does and dual_unboundedness_direction is not
512+
* nullptr
513+
*/
514+
HighsStatus getDualUnboundednessDirection(
515+
bool& has_dual_unboundedness_direction,
516+
double* dual_unboundedness_direction_value = nullptr);
517+
496518
/**
497519
* @brief Indicate whether a primal unbounded ray exists, and gets
498520
* it if it does and primal_ray is not nullptr
@@ -530,10 +552,15 @@ class Highs {
530552
HighsStatus getIis(HighsIis& iis);
531553

532554
/**
533-
* @brief Get the current model objective value
555+
* @brief Get the current model objective function value
534556
*/
535557
double getObjectiveValue() const { return info_.objective_function_value; }
536558

559+
/**
560+
* @brief Try to get the current dual objective function value
561+
*/
562+
HighsStatus getDualObjectiveValue(double& dual_objective_value);
563+
537564
/**
538565
* Methods for operations with the invertible representation of the
539566
* current basis matrix
@@ -1322,9 +1349,8 @@ class Highs {
13221349

13231350
HighsStatus resetHighsOptions();
13241351

1325-
HighsStatus writeHighsOptions(
1326-
const std::string& filename, //!< The filename
1327-
const bool report_only_non_default_values = true);
1352+
HighsStatus writeHighsOptions(const std::string& filename, //!< The filename
1353+
const bool report_only_deviations = true);
13281354

13291355
HighsInt getSimplexIterationCount() {
13301356
deprecationMessage("getSimplexIterationCount", "None");
@@ -1378,6 +1404,12 @@ class Highs {
13781404
HighsPresolveStatus::kNotPresolved;
13791405
HighsModelStatus model_status_ = HighsModelStatus::kNotset;
13801406

1407+
bool standard_form_valid_;
1408+
double standard_form_offset_;
1409+
std::vector<double> standard_form_cost_;
1410+
std::vector<double> standard_form_rhs_;
1411+
HighsSparseMatrix standard_form_matrix_;
1412+
13811413
HEkk ekk_instance_;
13821414

13831415
HighsPresolveLog presolve_log_;
@@ -1430,6 +1462,9 @@ class Highs {
14301462
// Clears the presolved model and its status
14311463
void clearPresolve();
14321464
//
1465+
// Clears the standard form LP
1466+
void clearStandardFormLp();
1467+
//
14331468
// Methods to clear solver data for users in Highs class members
14341469
// before (possibly) updating them with data from trying to solve
14351470
// the incumbent model.
@@ -1470,9 +1505,8 @@ class Highs {
14701505
HighsStatus returnFromHighs(const HighsStatus return_status);
14711506
void reportSolvedLpQpStats();
14721507

1473-
void underDevelopmentLogMessage(const std::string& method_name);
1474-
14751508
// Interface methods
1509+
HighsStatus formStandardFormLp();
14761510
HighsStatus basisForSolution();
14771511
HighsStatus addColsInterface(
14781512
HighsInt ext_num_new_col, const double* ext_col_cost,

thirdparty/solvers/highs/interfaces/highs_c_api.h

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -915,11 +915,13 @@ HighsInt Highs_getBasis(const void* highs, HighsInt* col_status,
915915
HighsInt Highs_getModelStatus(const void* highs);
916916

917917
/**
918-
* Get an unbounded dual ray that is a certificate of primal infeasibility.
918+
* Indicates whether a dual ray that is a certificate of primal
919+
* infeasibility currently exists, and (at the expense of solving an
920+
* LP) gets it if it does not and dual_ray_value is not nullptr.
919921
*
920922
* @param highs A pointer to the Highs instance.
921-
* @param has_dual_ray A pointer to an int to store 1 if the dual ray
922-
* exists.
923+
* @param has_dual_ray A pointer to an int to store 1 if a dual ray
924+
* currently exists.
923925
* @param dual_ray_value An array of length [num_row] filled with the
924926
* unbounded ray.
925927
*
@@ -929,7 +931,28 @@ HighsInt Highs_getDualRay(const void* highs, HighsInt* has_dual_ray,
929931
double* dual_ray_value);
930932

931933
/**
932-
* Get an unbounded primal ray that is a certificate of dual infeasibility.
934+
* Indicates whether a dual unboundedness direction (corresponding to a
935+
* certificate of primal infeasibility) exists, and (at the expense of
936+
* solving an LP) gets it if it does not and
937+
* dual_unboundedness_direction is not nullptr
938+
*
939+
* @param highs A pointer to the Highs
940+
* instance.
941+
* @param has_dual_unboundedness_direction A pointer to an int to store 1
942+
* if the dual unboundedness
943+
* direction exists.
944+
* @param dual_unboundedness_direction_value An array of length [num_col]
945+
* filled with the unboundedness
946+
* direction.
947+
*/
948+
HighsInt getDualUnboundednessDirection(
949+
const void* highs, HighsInt* has_dual_unboundedness_direction,
950+
double* dual_unboundedness_direction_value);
951+
952+
/**
953+
* Indicates whether a primal ray that is a certificate of primal
954+
* unboundedness currently exists, and (at the expense of solving an
955+
* LP) gets it if it does not and primal_ray_value is not nullptr.
933956
*
934957
* @param highs A pointer to the Highs instance.
935958
* @param has_primal_ray A pointer to an int to store 1 if the primal ray

thirdparty/solvers/highs/io/HighsIO.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class HighsOptions;
2424

2525
const HighsInt kIoBufferSize = 1024; // 65536;
2626

27-
enum class HighsFileType { kNone = 0, kOther, kMps, kLp, kMd, kHtml };
27+
enum class HighsFileType { kMinimal = 0, kFull, kMps, kLp, kMd };
2828

2929
/**
3030
* @brief IO methods for HiGHS - currently just print/log messages

thirdparty/solvers/highs/lp_data/HConst.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,14 @@ enum HighsAnalysisLevel {
8686
kHighsAnalysisLevelSolverTime = 8,
8787
kHighsAnalysisLevelNlaData = 16,
8888
kHighsAnalysisLevelNlaTime = 32,
89+
kHighsAnalysisLevelMipData = 64,
90+
kHighsAnalysisLevelMipTime = 128,
8991
kHighsAnalysisLevelMin = kHighsAnalysisLevelNone,
9092
kHighsAnalysisLevelMax =
9193
kHighsAnalysisLevelModelData + kHighsAnalysisLevelSolverSummaryData +
9294
kHighsAnalysisLevelSolverRuntimeData + kHighsAnalysisLevelSolverTime +
93-
kHighsAnalysisLevelNlaData + kHighsAnalysisLevelNlaTime
95+
kHighsAnalysisLevelNlaData + kHighsAnalysisLevelNlaTime +
96+
kHighsAnalysisLevelMipData + kHighsAnalysisLevelMipTime
9497
};
9598

9699
enum class HighsVarType : uint8_t {
@@ -288,6 +291,10 @@ const HighsInt kHighsIllegalInfeasibilityCount = -1;
288291
const double kHighsIllegalErrorValue = kHighsInf;
289292
const HighsInt kHighsIllegalErrorIndex = -1;
290293

294+
// Illegal values for complementarity violations used to indicate that true
295+
// values aren't known
296+
const double kHighsIllegalComplementarityViolation = kHighsInf;
297+
291298
// Maximum upper bound on semi-variables
292299
const double kMaxSemiVariableUpper = 1e5;
293300

thirdparty/solvers/highs/lp_data/HighsInfo.h

Lines changed: 50 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -87,46 +87,6 @@ class InfoRecordDouble : public InfoRecord {
8787
virtual ~InfoRecordDouble() {}
8888
};
8989

90-
InfoStatus getInfoIndex(const HighsLogOptions& report_log_options,
91-
const std::string& name,
92-
const std::vector<InfoRecord*>& info_records,
93-
HighsInt& index);
94-
95-
InfoStatus checkInfo(const HighsLogOptions& report_log_options,
96-
const std::vector<InfoRecord*>& info_records);
97-
InfoStatus checkInfo(const InfoRecordInt& info);
98-
InfoStatus checkInfo(const InfoRecordDouble& info);
99-
100-
InfoStatus getLocalInfoValue(const HighsLogOptions& report_log_options,
101-
const std::string& name, const bool valid,
102-
const std::vector<InfoRecord*>& info_records,
103-
int64_t& value);
104-
InfoStatus getLocalInfoValue(const HighsLogOptions& report_log_options,
105-
const std::string& name, const bool valid,
106-
const std::vector<InfoRecord*>& info_records,
107-
HighsInt& value);
108-
InfoStatus getLocalInfoValue(const HighsLogOptions& report_log_options,
109-
const std::string& name, const bool valid,
110-
const std::vector<InfoRecord*>& info_records,
111-
double& value);
112-
113-
InfoStatus getLocalInfoType(const HighsLogOptions& report_log_options,
114-
const std::string& name,
115-
const std::vector<InfoRecord*>& info_records,
116-
HighsInfoType& type);
117-
118-
HighsStatus writeInfoToFile(
119-
FILE* file, const bool valid, const std::vector<InfoRecord*>& info_records,
120-
const HighsFileType file_type = HighsFileType::kOther);
121-
void reportInfo(FILE* file, const std::vector<InfoRecord*>& info_records,
122-
const HighsFileType file_type = HighsFileType::kOther);
123-
void reportInfo(FILE* file, const InfoRecordInt64& info,
124-
const HighsFileType file_type = HighsFileType::kOther);
125-
void reportInfo(FILE* file, const InfoRecordInt& info,
126-
const HighsFileType file_type = HighsFileType::kOther);
127-
void reportInfo(FILE* file, const InfoRecordDouble& info,
128-
const HighsFileType file_type = HighsFileType::kOther);
129-
13090
// For now, but later change so HiGHS properties are string based so that new
13191
// info (for debug and testing too) can be added easily. The info below
13292
// are just what has been used to parse info from argv.
@@ -155,6 +115,7 @@ struct HighsInfoStruct {
155115
double sum_dual_infeasibilities;
156116
double max_complementarity_violation;
157117
double sum_complementarity_violations;
118+
double primal_dual_integral;
158119
};
159120

160121
class HighsInfo : public HighsInfoStruct {
@@ -313,10 +274,59 @@ class HighsInfo : public HighsInfoStruct {
313274
"sum_complementarity_violations", "Sum of complementarity violations",
314275
advanced, &sum_complementarity_violations, 0);
315276
records.push_back(record_double);
277+
278+
record_double =
279+
new InfoRecordDouble("primal_dual_integral", "Primal-dual integral",
280+
advanced, &primal_dual_integral, 0);
281+
records.push_back(record_double);
316282
}
317283

318284
public:
319285
std::vector<InfoRecord*> records;
320286
};
321287

288+
HighsStatus writeInfoToFile(
289+
FILE* file, const bool valid, const HighsInfo& info,
290+
const HighsFileType file_type = HighsFileType::kFull);
291+
292+
InfoStatus getInfoIndex(const HighsLogOptions& report_log_options,
293+
const std::string& name,
294+
const std::vector<InfoRecord*>& info_records,
295+
HighsInt& index);
296+
297+
InfoStatus checkInfo(const HighsLogOptions& report_log_options,
298+
const std::vector<InfoRecord*>& info_records);
299+
InfoStatus checkInfo(const InfoRecordInt& info);
300+
InfoStatus checkInfo(const InfoRecordDouble& info);
301+
302+
InfoStatus getLocalInfoValue(const HighsLogOptions& report_log_options,
303+
const std::string& name, const bool valid,
304+
const std::vector<InfoRecord*>& info_records,
305+
int64_t& value);
306+
InfoStatus getLocalInfoValue(const HighsLogOptions& report_log_options,
307+
const std::string& name, const bool valid,
308+
const std::vector<InfoRecord*>& info_records,
309+
HighsInt& value);
310+
InfoStatus getLocalInfoValue(const HighsLogOptions& report_log_options,
311+
const std::string& name, const bool valid,
312+
const std::vector<InfoRecord*>& info_records,
313+
double& value);
314+
315+
InfoStatus getLocalInfoType(const HighsLogOptions& report_log_options,
316+
const std::string& name,
317+
const std::vector<InfoRecord*>& info_records,
318+
HighsInfoType& type);
319+
320+
HighsStatus writeInfoToFile(
321+
FILE* file, const bool valid, const std::vector<InfoRecord*>& info_records,
322+
const HighsFileType file_type = HighsFileType::kFull);
323+
void reportInfo(FILE* file, const std::vector<InfoRecord*>& info_records,
324+
const HighsFileType file_type = HighsFileType::kFull);
325+
void reportInfo(FILE* file, const InfoRecordInt64& info,
326+
const HighsFileType file_type = HighsFileType::kFull);
327+
void reportInfo(FILE* file, const InfoRecordInt& info,
328+
const HighsFileType file_type = HighsFileType::kFull);
329+
void reportInfo(FILE* file, const InfoRecordDouble& info,
330+
const HighsFileType file_type = HighsFileType::kFull);
331+
322332
#endif

thirdparty/solvers/highs/lp_data/HighsLpUtils.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ void getLpMatrixCoefficient(const HighsLp& lp, const HighsInt row,
201201
void analyseLp(const HighsLogOptions& log_options, const HighsLp& lp);
202202

203203
HighsStatus readSolutionFile(const std::string filename,
204-
const HighsOptions& options, const HighsLp& lp,
204+
const HighsOptions& options, HighsLp& lp,
205205
HighsBasis& basis, HighsSolution& solution,
206206
const HighsInt style);
207207

@@ -216,7 +216,9 @@ bool readSolutionFileKeywordLineOk(std::string& keyword,
216216
std::ifstream& in_file);
217217
bool readSolutionFileHashKeywordIntLineOk(std::string& keyword, HighsInt& value,
218218
std::ifstream& in_file);
219-
bool readSolutionFileIdDoubleLineOk(double& value, std::ifstream& in_file);
219+
bool readSolutionFileIdIgnoreLineOk(std::string& id, std::ifstream& in_file);
220+
bool readSolutionFileIdDoubleLineOk(std::string& id, double& value,
221+
std::ifstream& in_file);
220222
bool readSolutionFileIdDoubleIntLineOk(double& value, HighsInt& index,
221223
std::ifstream& in_file);
222224

@@ -225,7 +227,8 @@ void assessColPrimalSolution(const HighsOptions& options, const double primal,
225227
const HighsVarType type, double& col_infeasibility,
226228
double& integer_infeasibility);
227229

228-
HighsStatus assessLpPrimalSolution(const HighsOptions& options,
230+
HighsStatus assessLpPrimalSolution(const std::string message,
231+
const HighsOptions& options,
229232
const HighsLp& lp,
230233
const HighsSolution& solution, bool& valid,
231234
bool& integral, bool& feasible);

0 commit comments

Comments
 (0)