Skip to content

Commit 5f994bd

Browse files
committed
Merge branch 'latest' into enhance-iis
2 parents e8e644f + cc5b4e1 commit 5f994bd

35 files changed

+716
-926
lines changed

check/TestMipSolver.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,3 +1279,16 @@ TEST_CASE("row-fixed-lp", "[highs_test_mip_solver]") {
12791279

12801280
h.resetGlobalScheduler(true);
12811281
}
1282+
1283+
TEST_CASE("issue-2585", "[highs_test_mip_solver]") {
1284+
std::string filename =
1285+
std::string(HIGHS_DIR) + "/check/instances/issue-2585.lp";
1286+
Highs highs;
1287+
highs.setOptionValue("output_flag", dev_run);
1288+
highs.setOptionValue("mip_rel_gap", 0);
1289+
highs.setOptionValue("mip_abs_gap", 0);
1290+
highs.readModel(filename);
1291+
const HighsModelStatus require_model_status = HighsModelStatus::kOptimal;
1292+
const double optimal_objective = -175.91;
1293+
solve(highs, kHighsOnString, require_model_status, optimal_objective);
1294+
}

check/instances/issue-2585.lp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Minimize -24 a + 5 b + 7.4 c + 9 d
2+
Subject To
3+
96.55 a - 32.45 c + 88.78 d <= 1216.06
4+
-3.14 a - 78.02 b <= -50.5404
5+
11.8 b - 21.94 c <= 3.422
6+
91.59 c - 10.58 d <= -35.25
7+
79.17 a + 1.73 b - 73.23 d <= 411.403
8+
-10.61 a - 94.66 b + 76.88 d <= 195.69
9+
Bounds
10+
-100 <= a <= 100
11+
-100 <= b <= 100
12+
-100 <= c <= 100
13+
-100 <= d <= 100
14+
Generals
15+
c d
16+
End

cmake/FindHipoDeps.cmake

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -101,37 +101,46 @@ if (NOT USE_CMAKE_FIND_BLAS)
101101
endif()
102102
else()
103103

104-
if (NOT BLA_VENDOR)
105-
if (APPLE)
106-
set (BLA_VENDOR Apple)
107-
elseif(LINUX)
108-
set (BLA_VENDOR OpenBLAS)
109-
elseif(WIN32)
110-
set (BLA_VENDOR OpenBLAS)
104+
if (WIN32 AND NOT BLAS_LIBRARIES AND NOT BLA_VENDOR)
105+
find_package(OpenBLAS CONFIG)
106+
if(OpenBLAS_FOUND)
107+
message(STATUS "OpenBLAS CMake config path: ${OpenBLAS_DIR}")
111108
endif()
109+
endif()
110+
111+
if (NOT OpenBLAS_FOUND)
112+
if (NOT BLA_VENDOR)
113+
if (APPLE)
114+
set (BLA_VENDOR Apple)
115+
elseif(LINUX)
116+
set (BLA_VENDOR OpenBLAS)
117+
elseif(WIN32)
118+
set (BLA_VENDOR OpenBLAS)
119+
endif()
112120

113-
find_package(BLAS QUIET)
114-
if (BLAS_FOUND)
115-
message(STATUS "Using BLAS library: ${BLAS_LIBRARIES}")
116-
if (BLAS_INCLUDE_DIRS)
117-
message(STATUS "BLAS include dirs: ${BLAS_INCLUDE_DIRS}")
121+
find_package(BLAS QUIET)
122+
if (BLAS_FOUND)
123+
message(STATUS "Using BLAS library: ${BLAS_LIBRARIES}")
124+
if (BLAS_INCLUDE_DIRS)
125+
message(STATUS "BLAS include dirs: ${BLAS_INCLUDE_DIRS}")
126+
endif()
127+
else()
128+
unset(BLA_VENDOR)
118129
endif()
119130
else()
120-
unset(BLA_VENDOR)
131+
message(STATUS "Specified BLA_VENDOR: ${BLA_VENDOR}")
121132
endif()
122-
else()
123-
message(STATUS "Specified BLA_VENDOR: ${BLA_VENDOR}")
124-
endif()
125133

126-
if (NOT BLAS_FOUND)
127-
find_package(BLAS REQUIRED)
128-
if (BLAS_FOUND)
129-
message(STATUS "Using BLAS library: ${BLAS_LIBRARIES}")
130-
if (BLAS_INCLUDE_DIRS)
131-
message(STATUS "BLAS include dirs: ${BLAS_INCLUDE_DIRS}")
134+
if (NOT BLAS_FOUND)
135+
find_package(BLAS REQUIRED)
136+
if (BLAS_FOUND)
137+
message(STATUS "Using BLAS library: ${BLAS_LIBRARIES}")
138+
if (BLAS_INCLUDE_DIRS)
139+
message(STATUS "BLAS include dirs: ${BLAS_INCLUDE_DIRS}")
140+
endif()
141+
else()
142+
message(FATAL_ERROR "No BLAS library found!")
132143
endif()
133-
else()
134-
message(FATAL_ERROR "No BLAS library found!")
135144
endif()
136145
endif()
137146
endif()

cmake/sources.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ set(hipo_sources
184184
ipm/hipo/ipm/Iterate.cpp
185185
ipm/hipo/ipm/LogHighs.cpp
186186
ipm/hipo/ipm/Model.cpp
187+
ipm/hipo/ipm/Refine.cpp
187188
ipm/hipo/ipm/Solver.cpp)
188189

189190
set(hipo_headers

docs/src/installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ git checkout 521-ts
3939

4040
Then build with
4141
```
42-
cmake -S. -B build
43-
-DGKLIB_PATH=/path_to_METIS_repo/GKlib
42+
cmake -S. -B build \
43+
-DGKLIB_PATH=/path_to_METIS_repo/GKlib \
4444
-DCMAKE_INSTALL_PREFIX=path_to_installs_dir
4545
cmake --build build
4646
cmake --install build

highs/CMakeLists.txt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,19 @@ else()
219219
endif(BLAS_LIB)
220220
endif(APPLE)
221221
else()
222-
target_link_libraries(highs PRIVATE BLAS::BLAS)
223222

224-
string(TOLOWER "${BLAS_LIBRARIES}" blas_lower)
225-
if(blas_lower MATCHES "openblas")
223+
if (WIN32 AND TARGET OpenBLAS::OpenBLAS)
226224
target_compile_definitions(highs PRIVATE HIPO_USES_OPENBLAS)
227-
elseif(blas_lower MATCHES "accelerate")
228-
target_compile_definitions(highs PRIVATE HIPO_USES_APPLE_BLAS)
225+
target_link_libraries(highs PRIVATE OpenBLAS::OpenBLAS)
226+
else()
227+
target_link_libraries(highs PRIVATE BLAS::BLAS)
228+
229+
string(TOLOWER "${BLAS_LIBRARIES}" blas_lower)
230+
if(blas_lower MATCHES "openblas")
231+
target_compile_definitions(highs PRIVATE HIPO_USES_OPENBLAS)
232+
elseif(blas_lower MATCHES "accelerate")
233+
target_compile_definitions(highs PRIVATE HIPO_USES_APPLE_BLAS)
234+
endif()
229235
endif()
230236
endif()
231237

highs/ipm/hipo/auxiliary/Auxiliary.cpp

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -97,48 +97,6 @@ void transpose(const std::vector<Int>& ptr, const std::vector<Int>& rows,
9797
}
9898
}
9999

100-
void symProduct(const std::vector<Int>& ptr, const std::vector<Int>& rows,
101-
const std::vector<double>& vals, const std::vector<double>& x,
102-
std::vector<double>& y, double alpha) {
103-
// Matrix-vector product in CSC format, for symmetric matrix which stores only
104-
// the lower triangle.
105-
// Compute y = y + alpha * M * x
106-
107-
const Int n = ptr.size() - 1;
108-
109-
for (Int col = 0; col < n; ++col) {
110-
for (Int el = ptr[col]; el < ptr[col + 1]; ++el) {
111-
Int row = rows[el];
112-
double val = vals[el];
113-
114-
y[row] += alpha * val * x[col];
115-
if (row != col) y[col] += alpha * val * x[row];
116-
}
117-
}
118-
}
119-
120-
void symProductQuad(const std::vector<Int>& ptr, const std::vector<Int>& rows,
121-
const std::vector<double>& vals,
122-
const std::vector<double>& x, std::vector<HighsCDouble>& y,
123-
double alpha) {
124-
// Matrix-vector product in CSC format, for symmetric matrix which stores only
125-
// the lower triangle.
126-
// Compute y = y + alpha * M * x
127-
128-
const Int n = ptr.size() - 1;
129-
130-
for (Int col = 0; col < n; ++col) {
131-
for (Int el = ptr[col]; el < ptr[col + 1]; ++el) {
132-
Int row = rows[el];
133-
HighsCDouble val = vals[el];
134-
135-
y[row] += val * (HighsCDouble)x[col] * (HighsCDouble)alpha;
136-
if (row != col)
137-
y[col] += val * (HighsCDouble)x[row] * (HighsCDouble)alpha;
138-
}
139-
}
140-
}
141-
142100
void childrenLinkedList(const std::vector<Int>& parent, std::vector<Int>& head,
143101
std::vector<Int>& next) {
144102
// Create linked lists of children in elimination tree.

highs/ipm/hipo/auxiliary/Auxiliary.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <vector>
99

1010
#include "ipm/hipo/auxiliary/IntConfig.h"
11-
#include "util/HighsCDouble.h"
1211

1312
namespace hipo {
1413

@@ -20,13 +19,6 @@ void transpose(const std::vector<Int>& ptr, const std::vector<Int>& rows,
2019
void transpose(const std::vector<Int>& ptr, const std::vector<Int>& rows,
2120
const std::vector<double>& val, std::vector<Int>& ptrT,
2221
std::vector<Int>& rowsT, std::vector<double>& valT);
23-
void symProduct(const std::vector<Int>& ptr, const std::vector<Int>& rows,
24-
const std::vector<double>& vals, const std::vector<double>& x,
25-
std::vector<double>& y, double alpha = 1.0);
26-
void symProductQuad(const std::vector<Int>& ptr, const std::vector<Int>& rows,
27-
const std::vector<double>& vals,
28-
const std::vector<double>& x, std::vector<HighsCDouble>& y,
29-
double alpha);
3022
void childrenLinkedList(const std::vector<Int>& parent, std::vector<Int>& head,
3123
std::vector<Int>& next);
3224
void reverseLinkedList(std::vector<Int>& head, std::vector<Int>& next);

highs/ipm/hipo/factorhighs/DataCollector.cpp

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void DataCollector::printTimes(const Log& log) const {
141141
<< "\n";
142142

143143
#if HIPO_TIMING_LEVEL >= 2
144-
log_stream << "\tPrepare: "
144+
log_stream << "\tPrepare fact: "
145145
<< fix(times[kTimeFactorisePrepare], 8, 4) << " ("
146146
<< fix(times[kTimeFactorisePrepare] / times[kTimeFactorise] * 100,
147147
4, 1)
@@ -189,7 +189,7 @@ void DataCollector::printTimes(const Log& log) const {
189189
<< "\n";
190190

191191
#if HIPO_TIMING_LEVEL >= 2
192-
log_stream << "\tPrepare: "
192+
log_stream << "\tPrepare solve: "
193193
<< fix(times[kTimeSolvePrepare], 8, 4) << " ("
194194
<< fix(times[kTimeSolvePrepare] / times[kTimeSolve] * 100, 4, 1)
195195
<< "%)\n";
@@ -203,14 +203,6 @@ void DataCollector::printTimes(const Log& log) const {
203203
<< fix(times[kTimeSolveSolve_sparse], 8, 4) << "\n";
204204
log_stream << "\t\tswap: " << fix(times[kTimeSolveSolve_swap], 8, 4)
205205
<< "\n";
206-
log_stream << "\tResidual: "
207-
<< fix(times[kTimeSolveResidual], 8, 4) << " ("
208-
<< fix(times[kTimeSolveResidual] / times[kTimeSolve] * 100, 4, 1)
209-
<< "%)\n";
210-
log_stream << "\tOmega: "
211-
<< fix(times[kTimeSolveOmega], 8, 4) << " ("
212-
<< fix(times[kTimeSolveOmega] / times[kTimeSolve] * 100, 4, 1)
213-
<< "%)\n";
214206
#endif
215207
log_stream << "----------------------------------------------------\n";
216208

@@ -225,68 +217,57 @@ void DataCollector::printTimes(const Log& log) const {
225217
log_stream << "BLAS time \t" << fix(total_blas_time, 8, 4)
226218
<< '\n';
227219
log_stream << "\tcopy: \t" << fix(times[kTimeBlas_copy], 8, 4)
228-
<< " ("
229-
<< fix(times[kTimeBlas_copy] / times[kTimeSolve] * 100, 4, 1)
220+
<< " (" << fix(times[kTimeBlas_copy] / total_blas_time * 100, 4, 1)
230221
<< "%) in "
231222
<< integer(blas_calls[kTimeBlas_copy - kTimeBlasStart], 10)
232223
<< " calls\n";
233224
log_stream << "\taxpy: \t" << fix(times[kTimeBlas_axpy], 8, 4)
234-
<< " ("
235-
<< fix(times[kTimeBlas_axpy] / times[kTimeSolve] * 100, 4, 1)
225+
<< " (" << fix(times[kTimeBlas_axpy] / total_blas_time * 100, 4, 1)
236226
<< "%) in "
237227
<< integer(blas_calls[kTimeBlas_axpy - kTimeBlasStart], 10)
238228
<< " calls\n";
239229
log_stream << "\tscal: \t" << fix(times[kTimeBlas_scal], 8, 4)
240-
<< " ("
241-
<< fix(times[kTimeBlas_scal] / times[kTimeSolve] * 100, 4, 1)
230+
<< " (" << fix(times[kTimeBlas_scal] / total_blas_time * 100, 4, 1)
242231
<< "%) in "
243232
<< integer(blas_calls[kTimeBlas_scal - kTimeBlasStart], 10)
244233
<< " calls\n";
245234
log_stream << "\tswap: \t" << fix(times[kTimeBlas_swap], 8, 4)
246-
<< " ("
247-
<< fix(times[kTimeBlas_swap] / times[kTimeSolve] * 100, 4, 1)
235+
<< " (" << fix(times[kTimeBlas_swap] / total_blas_time * 100, 4, 1)
248236
<< "%) in "
249237
<< integer(blas_calls[kTimeBlas_swap - kTimeBlasStart], 10)
250238
<< " calls\n";
251239
log_stream << "\tgemv: \t" << fix(times[kTimeBlas_gemv], 8, 4)
252-
<< " ("
253-
<< fix(times[kTimeBlas_gemv] / times[kTimeSolve] * 100, 4, 1)
240+
<< " (" << fix(times[kTimeBlas_gemv] / total_blas_time * 100, 4, 1)
254241
<< "%) in "
255242
<< integer(blas_calls[kTimeBlas_gemv - kTimeBlasStart], 10)
256243
<< " calls\n";
257244
log_stream << "\ttrsv: \t" << fix(times[kTimeBlas_trsv], 8, 4)
258-
<< " ("
259-
<< fix(times[kTimeBlas_trsv] / times[kTimeSolve] * 100, 4, 1)
245+
<< " (" << fix(times[kTimeBlas_trsv] / total_blas_time * 100, 4, 1)
260246
<< "%) in "
261247
<< integer(blas_calls[kTimeBlas_trsv - kTimeBlasStart], 10)
262248
<< " calls\n";
263249
log_stream << "\ttpsv: \t" << fix(times[kTimeBlas_tpsv], 8, 4)
264-
<< " ("
265-
<< fix(times[kTimeBlas_tpsv] / times[kTimeSolve] * 100, 4, 1)
250+
<< " (" << fix(times[kTimeBlas_tpsv] / total_blas_time * 100, 4, 1)
266251
<< "%) in "
267252
<< integer(blas_calls[kTimeBlas_tpsv - kTimeBlasStart], 10)
268253
<< " calls\n";
269254
log_stream << "\tger: \t" << fix(times[kTimeBlas_ger], 8, 4)
270-
<< " ("
271-
<< fix(times[kTimeBlas_ger] / times[kTimeSolve] * 100, 4, 1)
255+
<< " (" << fix(times[kTimeBlas_ger] / total_blas_time * 100, 4, 1)
272256
<< "%) in "
273257
<< integer(blas_calls[kTimeBlas_ger - kTimeBlasStart], 10)
274258
<< " calls\n";
275259
log_stream << "\ttrsm: \t" << fix(times[kTimeBlas_trsm], 8, 4)
276-
<< " ("
277-
<< fix(times[kTimeBlas_trsm] / times[kTimeSolve] * 100, 4, 1)
260+
<< " (" << fix(times[kTimeBlas_trsm] / total_blas_time * 100, 4, 1)
278261
<< "%) in "
279262
<< integer(blas_calls[kTimeBlas_trsm - kTimeBlasStart], 10)
280263
<< " calls\n";
281264
log_stream << "\tsyrk: \t" << fix(times[kTimeBlas_syrk], 8, 4)
282-
<< " ("
283-
<< fix(times[kTimeBlas_syrk] / times[kTimeSolve] * 100, 4, 1)
265+
<< " (" << fix(times[kTimeBlas_syrk] / total_blas_time * 100, 4, 1)
284266
<< "%) in "
285267
<< integer(blas_calls[kTimeBlas_syrk - kTimeBlasStart], 10)
286268
<< " calls\n";
287269
log_stream << "\tgemm: \t" << fix(times[kTimeBlas_gemm], 8, 4)
288-
<< " ("
289-
<< fix(times[kTimeBlas_gemm] / times[kTimeSolve] * 100, 4, 1)
270+
<< " (" << fix(times[kTimeBlas_gemm] / total_blas_time * 100, 4, 1)
290271
<< "%) in "
291272
<< integer(blas_calls[kTimeBlas_gemm - kTimeBlasStart], 10)
292273
<< " calls\n";

highs/ipm/hipo/factorhighs/FactorHiGHS.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ Int FHsolver::factorise(const Symbolic& S, const std::vector<Int>& rows,
4848
return fact_obj.run(N_);
4949
}
5050

51-
Int FHsolver::solve(std::vector<double>& x, Int* solve_count, double* omega) {
52-
return N_.solve(x, solve_count, omega);
53-
}
51+
Int FHsolver::solve(std::vector<double>& x) { return N_.solve(x); }
52+
53+
void FHsolver::getRegularisation(std::vector<double>& reg) { N_.getReg(reg); }
5454

5555
} // namespace hipo

0 commit comments

Comments
 (0)