Skip to content

Commit 26d098c

Browse files
committed
Merge branch 'latest' into cmake
2 parents 59ea897 + ccf22bd commit 26d098c

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

check/TestLpSolvers.cpp

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,9 @@ bool fileExists(const std::string& file_name) {
407407

408408
TEST_CASE("highs-files-lp", "[highs_lp_solver]") {
409409
Highs h;
410-
std::string write_solution_file = "temp.sol";
411-
std::string write_basis_file = "temp.bas";
412-
std::string write_model_file = "temp.mps";
410+
std::string write_solution_file = "lp-temp.sol";
411+
std::string write_basis_file = "lp-temp.bas";
412+
std::string write_model_file = "lp-temp.mps";
413413
h.setOptionValue("output_flag", dev_run);
414414
std::string model_file =
415415
std::string(HIGHS_DIR) + "/check/instances/avgas.mps";
@@ -429,10 +429,12 @@ TEST_CASE("highs-files-lp", "[highs_lp_solver]") {
429429
h.setOptionValue("write_basis_file", "");
430430
h.setOptionValue("write_model_file", "");
431431

432+
h.setOptionValue("read_basis_file", write_basis_file);
433+
432434
REQUIRE(h.readModel(write_model_file) == HighsStatus::kOk);
433435

434-
h.setOptionValue("read_basis_file", write_basis_file);
435436
h.run();
437+
436438
REQUIRE(h.getInfo().simplex_iteration_count == 0);
437439

438440
std::remove(write_model_file.c_str());
@@ -442,9 +444,9 @@ TEST_CASE("highs-files-lp", "[highs_lp_solver]") {
442444

443445
TEST_CASE("highs-files-mip", "[highs_lp_solver]") {
444446
Highs h;
445-
std::string write_solution_file = "temp.sol";
446-
std::string write_basis_file = "temp.bas";
447-
std::string write_model_file = "temp.mps";
447+
std::string write_solution_file = "mip-temp.sol";
448+
std::string write_basis_file = "mip-temp.bas";
449+
std::string write_model_file = "mip-temp.mps";
448450
h.setOptionValue("output_flag", dev_run);
449451
std::string model_file =
450452
std::string(HIGHS_DIR) + "/check/instances/flugpl.mps";
@@ -454,34 +456,23 @@ TEST_CASE("highs-files-mip", "[highs_lp_solver]") {
454456
h.setOptionValue("write_model_file", write_model_file);
455457

456458
h.run();
457-
// Removed to get back to meson build CI test passing
458-
//
459-
// const int64_t mip_node_count = h.getInfo().mip_node_count;
460-
461-
// Ideally we'd check that the files have been created, but this
462-
// causes the meson build CI test to fail
463-
//
464-
// REQUIRE(fileExists(write_model_file));
465-
// REQUIRE(fileExists(write_solution_file));
466-
467-
// However, std::remove returning zero is a test for existence
468-
//
469-
// But this also causes the meson build CI test to fail!
470-
// REQUIRE(std::remove(write_model_file.c_str()) == 0);
471-
// REQUIRE(std::remove(write_solution_file.c_str()) == 0);
472-
// REQUIRE(std::remove(write_basis_file.c_str()) != 0);
473-
474-
// Removed to get back to meson build CI test passing
475-
//
476-
// REQUIRE(h.readModel(write_model_file) == HighsStatus::kOk);
477-
// h.setOptionValue("read_solution_file", write_solution_file);
478-
// HighsStatus run_status = h.run();
479-
//
480-
// This appears to cause the meson build CI test to fail
481-
// REQUIRE(run_status == HighsStatus::kOk);
459+
460+
const int64_t mip_node_count = h.getInfo().mip_node_count;
461+
462+
REQUIRE(fileExists(write_model_file));
463+
REQUIRE(fileExists(write_solution_file));
464+
465+
h.setOptionValue("solution_file", "");
466+
h.setOptionValue("write_model_file", "");
467+
468+
REQUIRE(h.readModel(write_model_file) == HighsStatus::kOk);
469+
h.setOptionValue("read_solution_file", write_solution_file);
470+
HighsStatus run_status = h.run();
471+
472+
REQUIRE(run_status == HighsStatus::kOk);
482473

483474
// This also causes the meson build CI test to fail!
484-
// REQUIRE(h.getInfo().mip_node_count < mip_node_count);
475+
REQUIRE(h.getInfo().mip_node_count < mip_node_count);
485476

486477
std::remove(write_model_file.c_str());
487478
std::remove(write_solution_file.c_str());

docs/c_api_gen/build.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ import Clang: Generators
1212

1313
highs_src = joinpath(dirname(dirname(@__DIR__)), "highs")
1414
c_api = joinpath(highs_src, "interfaces", "highs_c_api.h")
15+
libhighs_filename = joinpath(@__DIR__, "libhighs.jl")
1516

1617
Generators.build!(
1718
Generators.create_context(
1819
[c_api, joinpath(highs_src, "util", "HighsInt.h")],
1920
[Generators.get_default_args(); "-I$highs_src"; "-I$(@__DIR__)"],
2021
Dict{String,Any}(
2122
"general" => Dict{String,Any}(
22-
"output_file_path" => joinpath(@__DIR__, "libhighs.jl"),
23+
"output_file_path" => libhighs_filename,
2324
"library_name" => "libhighs",
2425
"print_using_CEnum" => false,
2526
"extract_c_comment_style" => "doxygen",
@@ -28,7 +29,15 @@ Generators.build!(
2829
),
2930
)
3031

31-
open(joinpath(@__DIR__, "libhighs.jl"), "a") do io
32+
write(
33+
libhighs_filename,
34+
replace(
35+
read(libhighs_filename, String),
36+
"[`HighsInt`](@ref)" => "`HighsInt`",
37+
),
38+
)
39+
40+
open(libhighs_filename, "a") do io
3241
for line in readlines(c_api)
3342
m = match(r"const HighsInt kHighs([a-zA-Z]+) = (-?[0-9]+);", line)
3443
if m === nothing

0 commit comments

Comments
 (0)