Skip to content

Commit fd89523

Browse files
committed
Update HiGHS header to 1.8.0
1 parent e72c158 commit fd89523

33 files changed

+517
-146
lines changed

thirdparty/solvers/highs/HConfig.h

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

4-
#define FAST_BUILD
4+
/* #undef FAST_BUILD */
55
/* #undef ZLIB_FOUND */
66
/* #undef CUPDLP_CPU */
77
#define CMAKE_BUILD_TYPE "Release"
8-
#define CMAKE_INSTALL_PREFIX "D:/a/highsbox/highsbox/HiGHS/highs_dist"
8+
#define CMAKE_INSTALL_PREFIX "E:/HiGHS/build/install"
99
/* #undef HIGHSINT64 */
1010
/* #undef HIGHS_NO_DEFAULT_THREADS */
1111
#define HIGHS_HAVE_MM_PAUSE
1212
/* #undef HIGHS_HAVE_BUILTIN_CLZ */
1313
#define HIGHS_HAVE_BITSCAN_REVERSE
1414

15-
#define HIGHS_GITHASH "5ce7a27"
15+
#define HIGHS_GITHASH "fcfb53414"
1616
#define HIGHS_VERSION_MAJOR 1
17-
#define HIGHS_VERSION_MINOR 7
18-
#define HIGHS_VERSION_PATCH 2
19-
#define HIGHS_DIR "D:/a/highsbox/highsbox/HiGHS"
17+
#define HIGHS_VERSION_MINOR 8
18+
#define HIGHS_VERSION_PATCH 0
19+
#define HIGHS_DIR "E:/HiGHS"
2020

2121
#endif /* HCONFIG_H_ */

thirdparty/solvers/highs/Highs.h

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <sstream>
1818

1919
#include "lp_data/HighsCallback.h"
20+
#include "lp_data/HighsIis.h"
2021
#include "lp_data/HighsLpUtils.h"
2122
#include "lp_data/HighsRanging.h"
2223
#include "lp_data/HighsSolutionDebug.h"
@@ -159,6 +160,11 @@ class Highs {
159160
*/
160161
HighsStatus passRowName(const HighsInt row, const std::string& name);
161162

163+
/**
164+
* @brief Pass a model name to the incumbent model
165+
*/
166+
HighsStatus passModelName(const std::string& name);
167+
162168
/**
163169
* @brief Read in a model
164170
*/
@@ -499,6 +505,16 @@ class Highs {
499505
*/
500506
HighsStatus getRanging(HighsRanging& ranging);
501507

508+
/**
509+
* @brief Solve the feasibility relaxation problem
510+
*/
511+
HighsStatus feasibilityRelaxation(const double global_lower_penalty,
512+
const double global_upper_penalty,
513+
const double global_rhs_penalty,
514+
const double* local_lower_penalty = nullptr,
515+
const double* local_upper_penalty = nullptr,
516+
const double* local_rhs_penalty = nullptr);
517+
502518
/**
503519
* @brief Get the ill-conditioning information for the current basis
504520
*/
@@ -507,6 +523,12 @@ class Highs {
507523
const HighsInt method = 0,
508524
const double ill_conditioning_bound = 1e-4);
509525

526+
/**
527+
* @brief Get (any) irreducible infeasible subsystem (IIS)
528+
* information for the incumbent model
529+
*/
530+
HighsStatus getIis(HighsIis& iis);
531+
510532
/**
511533
* @brief Get the current model objective value
512534
*/
@@ -586,6 +608,14 @@ class Highs {
586608
HighsInt* col_num_nz = nullptr,
587609
HighsInt* col_indices = nullptr);
588610

611+
/**
612+
* @brief Get the condition number of the current basis matrix,
613+
* possibly computing it exactly and reporting the error in the
614+
* approximate condition number
615+
*/
616+
HighsStatus getKappa(double& kappa, const bool exact = false,
617+
const bool report = false);
618+
589619
/**
590620
* @brief Get the number of columns in the incumbent model
591621
*/
@@ -1063,6 +1093,12 @@ class Highs {
10631093
*/
10641094
HighsStatus setSolution(const HighsSolution& solution);
10651095

1096+
/**
1097+
* @brief Pass a sparse primal solution
1098+
*/
1099+
HighsStatus setSolution(const HighsInt num_entries, const HighsInt* index,
1100+
const double* value);
1101+
10661102
/**
10671103
* @brief Set the callback method to use for HiGHS
10681104
*/
@@ -1210,6 +1246,14 @@ class Highs {
12101246
HighsStatus getBasisInverseRowSparse(const HighsInt row,
12111247
HVector& row_ep_buffer);
12121248

1249+
/**
1250+
* @Brief Get the primal simplex phase 1 dual values. Advanced
1251+
* method: for HiGHS IIS calculation
1252+
*/
1253+
const std::vector<double>& getPrimalPhase1Dual() const {
1254+
return ekk_instance_.primal_phase1_dual_;
1255+
}
1256+
12131257
// Start of deprecated methods
12141258

12151259
std::string compilationDate() const { return "deprecated"; }
@@ -1326,6 +1370,7 @@ class Highs {
13261370
HighsOptions options_;
13271371
HighsInfo info_;
13281372
HighsRanging ranging_;
1373+
HighsIis iis_;
13291374

13301375
std::vector<HighsObjectiveSolution> saved_objective_and_solution_;
13311376

@@ -1368,7 +1413,7 @@ class Highs {
13681413
HighsStatus openWriteFile(const string filename, const string method_name,
13691414
FILE*& file, HighsFileType& file_type) const;
13701415

1371-
void reportModel();
1416+
void reportModel(const HighsModel& model);
13721417
void newHighsBasis();
13731418
void forceHighsSolutionBasisSize();
13741419
//
@@ -1415,6 +1460,9 @@ class Highs {
14151460
// Invalidates ekk_instance_
14161461
void invalidateEkk();
14171462

1463+
// Invalidates iis_
1464+
void invalidateIis();
1465+
14181466
HighsStatus returnFromWriteSolution(FILE* file,
14191467
const HighsStatus return_status);
14201468
HighsStatus returnFromRun(const HighsStatus return_status,
@@ -1497,6 +1545,27 @@ class Highs {
14971545
double* primal_ray_value);
14981546
HighsStatus getRangingInterface();
14991547

1548+
HighsStatus getIisInterface();
1549+
1550+
HighsStatus elasticityFilterReturn(
1551+
const HighsStatus return_status, const bool feasible_model,
1552+
const HighsInt original_num_col, const HighsInt original_num_row,
1553+
const std::vector<double>& original_col_cost,
1554+
const std::vector<double>& original_col_lower,
1555+
const std::vector<double> original_col_upper,
1556+
const std::vector<HighsVarType> original_integrality);
1557+
HighsStatus elasticityFilter(const double global_lower_penalty,
1558+
const double global_upper_penalty,
1559+
const double global_rhs_penalty,
1560+
const double* local_lower_penalty,
1561+
const double* local_upper_penalty,
1562+
const double* local_rhs_penalty,
1563+
const bool get_infeasible_row,
1564+
std::vector<HighsInt>& infeasible_row_subset);
1565+
HighsStatus extractIis(HighsInt& num_iis_col, HighsInt& num_iis_row,
1566+
HighsInt* iis_col_index, HighsInt* iis_row_index,
1567+
HighsInt* iis_col_bound, HighsInt* iis_row_bound);
1568+
15001569
bool aFormatOk(const HighsInt num_nz, const HighsInt format);
15011570
bool qFormatOk(const HighsInt num_nz, const HighsInt format);
15021571
void clearZeroHessian();

thirdparty/solvers/highs/interfaces/highs_c_api.h

Lines changed: 82 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// Highs_mipCall or Highs_qpCall, and these methods return the
1919
// appropriate solution information
2020
//
21-
// For sophisticated applications, where esoteric solutiuon
21+
// For sophisticated applications, where esoteric solution
2222
// information is needed, or if a sequence of modified models need to
2323
// be solved, use the Highs_create method to generate a pointer to an
2424
// instance of the C++ Highs class, and then use any of a large number
@@ -120,6 +120,8 @@ const char* const kHighsCallbackDataOutPdlpIterationCountName =
120120
const char* const kHighsCallbackDataOutObjectiveFunctionValueName =
121121
"objective_function_value";
122122
const char* const kHighsCallbackDataOutMipNodeCountName = "mip_node_count";
123+
const char* const kHighsCallbackDataOutMipTotalLpIterationsName =
124+
"mip_total_lp_iterations";
123125
const char* const kHighsCallbackDataOutMipPrimalBoundName = "mip_primal_bound";
124126
const char* const kHighsCallbackDataOutMipDualBoundName = "mip_dual_bound";
125127
const char* const kHighsCallbackDataOutMipGapName = "mip_gap";
@@ -227,11 +229,14 @@ HighsInt Highs_mipCall(const HighsInt num_col, const HighsInt num_row,
227229
* @param q_format The format of the Hessian matrix in the form of a
228230
* `kHighsHessianStatus` constant. If q_num_nz > 0, this must
229231
* be `kHighsHessianFormatTriangular`.
230-
* @param q_start The Hessian matrix is provided in the same format as the
231-
* constraint matrix, using `q_start`, `q_index`, and `q_value`
232-
* in the place of `a_start`, `a_index`, and `a_value`.
232+
* @param q_start The Hessian matrix is provided to HiGHS as the lower
233+
* triangular component in compressed sparse column form
234+
* (or, equivalently, as the upper triangular component
235+
* in compressed sparse row form). The sparse matrix consists
236+
* of three arrays, `q_start`, `q_index`, and `q_value`.
237+
* `q_start` is an array of length [num_col].
233238
* @param q_index An array of length [q_num_nz] with indices of matrix
234-
* sentries.
239+
* entries.
235240
* @param q_value An array of length [q_num_nz] with values of matrix entries.
236241
*
237242
* @returns A `kHighsStatus` constant indicating whether the call succeeded.
@@ -496,10 +501,13 @@ HighsInt Highs_passMip(void* highs, const HighsInt num_col,
496501
* @param a_index An array of length [num_nz] with indices of matrix
497502
* entries.
498503
* @param a_value An array of length [num_nz] with values of matrix entries.
499-
* @param q_start The Hessian matrix is provided in the same format as the
500-
* constraint matrix, using `q_start`, `q_index`, and
501-
* `q_value` in the place of `a_start`, `a_index`, and
502-
* `a_value`. If the model is linear, pass NULL.
504+
* @param q_start The Hessian matrix is provided to HiGHS as the lower
505+
* triangular component in compressed sparse column form
506+
* (or, equivalently, as the upper triangular component
507+
* in compressed sparse row form). The sparse matrix consists
508+
* of three arrays, `q_start`, `q_index`, and `q_value`.
509+
* `q_start` is an array of length [num_col]. If the model
510+
* is linear, pass NULL.
503511
* @param q_index An array of length [q_num_nz] with indices of matrix
504512
* entries. If the model is linear, pass NULL.
505513
* @param q_value An array of length [q_num_nz] with values of matrix
@@ -529,11 +537,16 @@ HighsInt Highs_passModel(void* highs, const HighsInt num_col,
529537
* @param num_nz The number of non-zero elements in the Hessian matrix.
530538
* @param format The format of the Hessian matrix as a `kHighsHessianFormat`
531539
* constant. This must be `kHighsHessianFormatTriangular`.
532-
* @param start The Hessian matrix is provided to HiGHS as the upper
533-
* triangular component in compressed sparse column form. The
534-
* sparse matrix consists of three arrays, `start`, `index`,
535-
* and `value`. `start` is an array of length [num_col]
536-
* containing the starting index of each column in `index`.
540+
* @param start The Hessian matrix is provided to HiGHS as the lower
541+
* triangular component in compressed sparse column form
542+
* (or, equivalently, as the upper triangular component
543+
* in compressed sparse row form), using `q_start`, `q_index`,
544+
* and `q_value`.The Hessian matrix is provided to HiGHS as the
545+
* lower triangular component in compressed sparse column form.
546+
* The sparse matrix consists of three arrays, `start`,
547+
* `index`, and `value`. `start` is an array of length
548+
* [num_col] containing the starting index of each column in
549+
* `index`.
537550
* @param index An array of length [num_nz] with indices of matrix entries.
538551
* @param value An array of length [num_nz] with values of matrix entries.
539552
*
@@ -568,6 +581,16 @@ HighsInt Highs_passRowName(const void* highs, const HighsInt row,
568581
HighsInt Highs_passColName(const void* highs, const HighsInt col,
569582
const char* name);
570583

584+
/**
585+
* Pass the name of the model.
586+
*
587+
* @param highs A pointer to the Highs instance.
588+
* @param name The name of the model.
589+
*
590+
* @returns A `kHighsStatus` constant indicating whether the call succeeded.
591+
*/
592+
HighsInt Highs_passModelName(const void* highs, const char* name);
593+
571594
/**
572595
* Read the option values from file.
573596
*
@@ -1137,6 +1160,19 @@ HighsInt Highs_setSolution(void* highs, const double* col_value,
11371160
const double* row_value, const double* col_dual,
11381161
const double* row_dual);
11391162

1163+
/**
1164+
* Set a partial primal solution by passing values for a set of variables
1165+
*
1166+
* @param highs A pointer to the Highs instance.
1167+
* @param num_entries Number of variables in the set
1168+
* @param index Indices of variables in the set
1169+
* @param value Values of variables in the set
1170+
*
1171+
* @returns A `kHighsStatus` constant indicating whether the call succeeded.
1172+
*/
1173+
HighsInt Highs_setSparseSolution(void* highs, const HighsInt num_entries,
1174+
const HighsInt* index, const double* value);
1175+
11401176
/**
11411177
* Set the callback method to use for HiGHS
11421178
*
@@ -2149,6 +2185,38 @@ HighsInt Highs_getRanging(
21492185
double* row_bound_dn_value, double* row_bound_dn_objective,
21502186
HighsInt* row_bound_dn_in_var, HighsInt* row_bound_dn_ou_var);
21512187

2188+
/**
2189+
* Compute the solution corresponding to a (possibly weighted) sum of
2190+
* (allowable) infeasibilities in an LP/MIP.
2191+
*
2192+
* If local penalties are not defined, pass NULL, and the global
2193+
* penalty will be used. Negative penalty values imply that the bound
2194+
* or RHS value cannot be violated
2195+
*
2196+
* @param highs A pointer to the Highs instance.
2197+
* @param const double global_lower_penalty The penalty for violating lower
2198+
* bounds on variables
2199+
* @param const double global_upper_penalty The penalty for violating upper
2200+
* bounds on variables
2201+
* @param const double global_rhs_penalty The penalty for violating constraint
2202+
* RHS values
2203+
* @param const double* local_lower_penalty The penalties for violating specific
2204+
* lower bounds on variables
2205+
* @param const double* local_upper_penalty The penalties for violating specific
2206+
* upper bounds on variables
2207+
* @param const double* local_rhs_penalty The penalties for violating specific
2208+
* constraint RHS values
2209+
* @returns A `kHighsStatus` constant indicating whether the call succeeded.
2210+
*/
2211+
2212+
HighsInt Highs_feasibilityRelaxation(void* highs,
2213+
const double global_lower_penalty,
2214+
const double global_upper_penalty,
2215+
const double global_rhs_penalty,
2216+
const double* local_lower_penalty,
2217+
const double* local_upper_penalty,
2218+
const double* local_rhs_penalty);
2219+
21522220
/**
21532221
* Releases all resources held by the global scheduler instance.
21542222
*

thirdparty/solvers/highs/io/HMpsFF.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838

3939
using Triplet = std::tuple<HighsInt, HighsInt, double>;
4040

41+
const std::string mps_comment_chars = "*$";
42+
4143
enum class FreeFormatParserReturnCode {
4244
kSuccess,
4345
kParserError,
@@ -124,7 +126,6 @@ class HMpsFF {
124126
HighsInt fillMatrix(const HighsLogOptions& log_options);
125127
HighsInt fillHessian(const HighsLogOptions& log_options);
126128

127-
const bool kAnyFirstNonBlankAsStarImpliesComment = false;
128129
/// how to treat variables that appear in COLUMNS section first
129130
/// assume them to be binary as in the original IBM interpretation
130131
/// or integer with default bounds
@@ -189,6 +190,9 @@ class HMpsFF {
189190

190191
mutable std::string section_args;
191192

193+
bool timeout();
194+
bool getMpsLine(std::istream& file, std::string& strline, bool& skip);
195+
192196
FreeFormatParserReturnCode parse(const HighsLogOptions& log_options,
193197
const std::string& filename);
194198
// Checks first word of strline and wraps it by it_begin and it_end

thirdparty/solvers/highs/io/HighsIO.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <iostream>
1919

2020
#include "lp_data/HighsCallback.h"
21-
//#include "util/HighsInt.h"
21+
// #include "util/HighsInt.h"
2222

2323
class HighsOptions;
2424

@@ -88,6 +88,14 @@ void highsLogUser(const HighsLogOptions& log_options_, const HighsLogType type,
8888
void highsLogDev(const HighsLogOptions& log_options_, const HighsLogType type,
8989
const char* format, ...);
9090

91+
/**
92+
* @brief Replaces fprintf(file,... so that when file=stdout highsLogUser is
93+
* used
94+
*/
95+
// Printing format: must contain exactly one "\n" at end of format
96+
void highsFprintfString(FILE* file, const HighsLogOptions& log_options_,
97+
const std::string& s);
98+
9199
/**
92100
* @brief For development logging when true log_options may not be available -
93101
* indicated by null pointer

0 commit comments

Comments
 (0)