Skip to content

Commit f75687b

Browse files
committed
Update highs headers to 1.12
1 parent bdb00fe commit f75687b

File tree

94 files changed

+1372
-580
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1372
-580
lines changed

thirdparty/solvers/highs/HConfig.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@
55
/* #undef ZLIB_FOUND */
66
#define CUPDLP_CPU
77
/* #undef CUPDLP_GPU */
8-
#define CMAKE_BUILD_TYPE "Release"
8+
/* #undef HIPO */
9+
/* #undef CMAKE_BUILD_TYPE */
910
/* #undef HIGHSINT64 */
1011
/* #undef HIGHS_NO_DEFAULT_THREADS */
1112
#define HIGHS_HAVE_MM_PAUSE
1213
/* #undef HIGHS_HAVE_BUILTIN_CLZ */
1314
#define HIGHS_HAVE_BITSCAN_REVERSE
15+
/* #undef BLAS_LIBRARIES */
1416

15-
#define HIGHS_GITHASH "364c83a51"
17+
#define HIGHS_GITHASH "755a8e027"
1618
#define HIGHS_VERSION_MAJOR 1
17-
#define HIGHS_VERSION_MINOR 11
19+
#define HIGHS_VERSION_MINOR 12
1820
#define HIGHS_VERSION_PATCH 0
1921

2022
#endif /* HCONFIG_H_ */

thirdparty/solvers/highs/Highs.h

Lines changed: 103 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,7 @@ const char* highsGithash();
4242
class Highs {
4343
public:
4444
Highs();
45-
virtual ~Highs() {
46-
FILE* log_stream = options_.log_options.log_stream;
47-
if (log_stream != nullptr) {
48-
assert(log_stream != stdout);
49-
fclose(log_stream);
50-
}
51-
}
45+
virtual ~Highs() { this->closeLogFile(); }
5246

5347
/**
5448
* @brief Return the version as a string
@@ -90,6 +84,11 @@ class Highs {
9084
*/
9185
HighsStatus clearSolver();
9286

87+
/**
88+
* @brief Clear all dual data associated with the model
89+
*/
90+
HighsStatus clearSolverDualData();
91+
9392
/**
9493
* Methods for model input
9594
*/
@@ -160,6 +159,21 @@ class Highs {
160159
HighsStatus addLinearObjective(const HighsLinearObjective& linear_objective,
161160
const HighsInt iObj = -1);
162161

162+
/**
163+
* @brief Get number of linear objectives from the incumbent model
164+
*/
165+
HighsInt getNumLinearObjectives() const {
166+
return multi_linear_objective_.size();
167+
}
168+
169+
/**
170+
* @brief Get a linear objective from the incumbent model
171+
*/
172+
const HighsLinearObjective& getLinearObjective(const HighsInt idx) const {
173+
assert(idx >= 0 && idx < int(multi_linear_objective_.size()));
174+
return multi_linear_objective_[idx];
175+
}
176+
163177
/**
164178
* @brief Clear the multiple linear objective data
165179
*/
@@ -429,13 +443,14 @@ class Highs {
429443
double* value = nullptr);
430444

431445
/**
432-
* @brief Return a const reference to the presolved HighsLp instance in HiGHS
446+
* @brief Return a const reference to the internal presolved HighsLp
447+
* instance
433448
*/
434449
const HighsLp& getPresolvedLp() const { return presolved_model_.lp_; }
435450

436451
/**
437-
* @brief Return a const reference to the presolved HighsModel instance in
438-
* HiGHS
452+
* @brief Return a const reference to the internal presolved
453+
* HighsModel instance
439454
*/
440455
const HighsModel& getPresolvedModel() const { return presolved_model_; }
441456

@@ -460,6 +475,13 @@ class Highs {
460475
return presolve_.data_.postSolveStack.getOrigRowsIndex();
461476
}
462477

478+
/**
479+
* @brief Return an LP associated with a MIP and its solution, with
480+
* each integer variable fixed to the value it takes in the MIP
481+
* solution. If no solution is available, an error is returned.
482+
*/
483+
HighsStatus getFixedLp(HighsLp& lp) const;
484+
463485
/**
464486
* @brief Return a const reference to the incumbent LP
465487
*/
@@ -471,17 +493,24 @@ class Highs {
471493
const HighsModel& getModel() const { return model_; }
472494

473495
/**
474-
* @brief Return a const reference to the internal HighsSolution instance
496+
* @brief Return a const reference to the internal HighsSolution
497+
* instance
475498
*/
476499
const HighsSolution& getSolution() const { return solution_; }
477500

501+
/**
502+
* @brief Return a const reference to the internal IIS LP instance
503+
*/
504+
const HighsLp& getIisLp() const { return iis_.model_.lp_; }
505+
478506
/**
479507
* @brief Zero all clocks in the internal HighsTimer instance
480508
*/
481509
void zeroAllClocks() { timer_.zeroAllClocks(); };
482510

483511
/**
484-
* @brief Return a const reference to the internal HighsSolution instance
512+
* @brief Return a const reference to the internal HighsSolution
513+
* instance
485514
*/
486515
const std::vector<HighsObjectiveSolution>& getSavedMipSolutions() const {
487516
return saved_objective_and_solution_;
@@ -562,6 +591,13 @@ class Highs {
562591
const HighsInt method = 0,
563592
const double ill_conditioning_bound = 1e-4);
564593

594+
/**
595+
* @brief Get the suggested objective and bound scaling for the incumbent
596+
* model
597+
*/
598+
HighsStatus getObjectiveBoundScaling(HighsInt& suggested_objective_scale,
599+
HighsInt& suggested_bound_scale);
600+
565601
/**
566602
* @brief Get (any) irreducible infeasible subsystem (IIS)
567603
* information for the incumbent model
@@ -844,6 +880,11 @@ class Highs {
844880
*/
845881
HighsStatus writePresolvedModel(const std::string& filename = "");
846882

883+
/**
884+
* @brief Write out the internal IIS LP instance to a file
885+
*/
886+
HighsStatus writeIisModel(const std::string& filename = "");
887+
847888
/**
848889
* @brief Write out the given model to a file
849890
*/
@@ -853,7 +894,7 @@ class Highs {
853894
/**
854895
* @brief Write out the internal HighsBasis instance to a file
855896
*/
856-
HighsStatus writeBasis(const std::string& filename = "") const;
897+
HighsStatus writeBasis(const std::string& filename = "");
857898

858899
/**
859900
* Methods for incumbent model modification
@@ -1186,6 +1227,26 @@ class Highs {
11861227
*/
11871228
HighsStatus setBasis();
11881229

1230+
/**
1231+
* @brief Return a const reference to the internal sub-solver call and time
1232+
* instance
1233+
*/
1234+
const HighsSubSolverCallTime& getSubSolverCallTime() const {
1235+
return sub_solver_call_time_;
1236+
}
1237+
1238+
/**
1239+
* @brief Report internal sub-solver call and time instance
1240+
*/
1241+
void reportSubSolverCallTime() const;
1242+
1243+
/**
1244+
* @brief Initialise the internal sub-solver call and time instance
1245+
*/
1246+
void initialiseSubSolverCallTime() {
1247+
this->sub_solver_call_time_.initialise();
1248+
}
1249+
11891250
/**
11901251
* @brief Run IPX crossover from a given HighsSolution instance and,
11911252
* if successful, set the internal HighsBasis and HighsSolution
@@ -1198,6 +1259,11 @@ class Highs {
11981259
*/
11991260
HighsStatus openLogFile(const std::string& log_file = "");
12001261

1262+
/**
1263+
* @brief Close any open log file
1264+
*/
1265+
HighsStatus closeLogFile();
1266+
12011267
/**
12021268
* @brief Interpret common qualifiers to string values
12031269
*/
@@ -1234,14 +1300,14 @@ class Highs {
12341300
}
12351301

12361302
/**
1237-
* @Brief Put a copy of the current iterate - basis; invertible
1303+
* @brief Put a copy of the current iterate - basis; invertible
12381304
* representation and dual edge weights - into storage within
12391305
* HSimplexNla. Advanced method: for HiGHS MIP solver
12401306
*/
12411307
HighsStatus putIterate();
12421308

12431309
/**
1244-
* @Brief Get a copy of the iterate stored within HSimplexNla and
1310+
* @brief Get a copy of the iterate stored within HSimplexNla and
12451311
* overwrite the current iterate. Advanced method: for HiGHS MIP
12461312
* solver
12471313
*/
@@ -1276,7 +1342,7 @@ class Highs {
12761342
HVector& row_ep_buffer);
12771343

12781344
/**
1279-
* @Brief Get the primal simplex phase 1 dual values. Advanced
1345+
* @brief Get the primal simplex phase 1 dual values. Advanced
12801346
* method: for HiGHS IIS calculation
12811347
*/
12821348
const std::vector<double>& getPrimalPhase1Dual() const {
@@ -1475,6 +1541,8 @@ class Highs {
14751541

14761542
HighsPresolveLog presolve_log_;
14771543

1544+
HighsSubSolverCallTime sub_solver_call_time_;
1545+
14781546
HighsInt max_threads = 0;
14791547
// This is strictly for debugging. It's used to check whether
14801548
// returnFromOptimizeModel() was called after the previous call to
@@ -1542,10 +1610,19 @@ class Highs {
15421610
// invalidateRanging(), invalidateInfo(), invalidateEkk() and
15431611
// invalidateIis()
15441612
void invalidateSolverData();
1613+
1614+
// Invalidates all solver dual data in Highs class members by calling
1615+
// invalidateModelStatus(), invalidateRanging(), and invalidateInfo()
1616+
//
1617+
// Used when only the objective changes
1618+
void invalidateSolverDualData();
15451619
//
15461620
// Invalidates the model status, solution_ and info_
15471621
void invalidateModelStatusSolutionAndInfo();
15481622
//
1623+
// Invalidates the model status and info_
1624+
void invalidateModelStatusAndInfo();
1625+
//
15491626
// Sets model status to HighsModelStatus::kNotset
15501627
void invalidateModelStatus();
15511628
//
@@ -1614,6 +1691,8 @@ class Highs {
16141691
const HighsVarType* usr_inegrality);
16151692
HighsStatus changeCostsInterface(HighsIndexCollection& index_collection,
16161693
const double* usr_col_cost);
1694+
1695+
bool feasibleWrtBounds(const bool columns = true) const;
16171696
HighsStatus changeColBoundsInterface(HighsIndexCollection& index_collection,
16181697
const double* usr_col_lower,
16191698
const double* usr_col_upper);
@@ -1646,10 +1725,12 @@ class Highs {
16461725
HighsStatus getRangingInterface();
16471726

16481727
HighsStatus getIisInterface();
1728+
HighsStatus getIisInterfaceReturn(const HighsStatus return_status);
16491729

16501730
HighsStatus elasticityFilterReturn(
16511731
const HighsStatus return_status, const bool feasible_model,
1652-
const HighsInt original_num_col, const HighsInt original_num_row,
1732+
const std::string& original_model_name, const HighsInt original_num_col,
1733+
const HighsInt original_num_row,
16531734
const std::vector<double>& original_col_cost,
16541735
const std::vector<double>& original_col_lower,
16551736
const std::vector<double> original_col_upper,
@@ -1674,12 +1755,16 @@ class Highs {
16741755
bool qFormatOk(const HighsInt num_nz, const HighsInt format);
16751756
void clearZeroHessian();
16761757
HighsStatus checkOptimality(const std::string& solver_type);
1677-
HighsStatus lpKktCheck(const std::string& message);
1758+
HighsStatus lpKktCheck(const HighsLp& lp, const std::string& message = "");
16781759
HighsStatus invertRequirementError(std::string method_name) const;
16791760

16801761
HighsStatus handleInfCost();
16811762
void restoreInfCost(HighsStatus& return_status);
16821763
HighsStatus optionChangeAction();
1764+
1765+
HighsStatus userScaleModel(HighsUserScaleData& data);
1766+
HighsStatus userScaleSolution(HighsUserScaleData& data,
1767+
bool update_kkt = false);
16831768
HighsStatus computeIllConditioning(HighsIllConditioning& ill_conditioning,
16841769
const bool constraint,
16851770
const HighsInt method,

0 commit comments

Comments
 (0)