Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ cc_library(
cc_library(
name = "highs-runtime-opts",
hdrs = [
"app/CLI11.hpp",
"extern/CLI11.hpp",
"app/HighsRuntimeOptions.h",
],
visibility = ["//visibility:public"],
Expand Down
10 changes: 10 additions & 0 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ The upstream source code is available at:

To avoid compiling this code into HiGHS, use `-DHIPO=OFF`.

## cli

The source code in `/extern/CLI11.hpp` is distributed under a license stated in the source code. Although the license is not named, the text appears to correspond to the [BSD-3 license](https://opensource.org/license/bsd-3-clause).

The upstream source code is available at:

* https://github.com/CLIUtils/CLI11

CLI11 is only used to parse command line input for the HiGHS executable, so does not affect the license status of the HiGHS library or language interfaces to it.

## filereaderlp

The source code in `/extern/filereaderlp` is distributed under the [MIT license](https://opensource.org/license/MIT)
Expand Down
2 changes: 1 addition & 1 deletion app/HighsRuntimeOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <cassert>

#include "CLI11.hpp"
#include "../extern/CLI11.hpp"
#include "HConfig.h"
#include "io/HighsIO.h"
#include "io/LoadOptions.h"
Expand Down
24 changes: 21 additions & 3 deletions app/RunHighs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,21 @@
#include "Highs.h"
#include "HighsRuntimeOptions.h"

static bool written_cli_copyright_line = false;

void cliCopyrightLine(const HighsLogOptions& log_options) {
if (written_cli_copyright_line) return;
highsLogUser(log_options, HighsLogType::kInfo,
"Command line parsed using CLI11 %s: Copyright (c) 2017-2025 "
"University of Cincinnati\n",
CLI11_VERSION);
written_cli_copyright_line = true;
}

int runHighsReturn(Highs& highs, const int status) {
// Possibly write out the HiGHS and CLI copyright lines
highs.logHeader();
cliCopyrightLine(highs.getOptions().log_options);
// Close any log file explicitly
highs.closeLogFile();
// Check that the log file has been closed
Expand All @@ -35,9 +49,9 @@ int main(int argc, char** argv) {
HighsCommandLineOptions cmd_options;
HighsOptions loaded_options;

// Set "HiGHS.log" as the default log_file for the app so that
// Set kHighsRunLogFile as the default log_file for the app so that
// log_file has this value if it isn't set in the file
loaded_options.log_file = "HiGHS.log";
loaded_options.log_file = kHighsRunLogFile;
// When loading the options file, any messages are reported using
// the default HighsLogOptions

Expand Down Expand Up @@ -86,9 +100,13 @@ int main(int argc, char** argv) {

// Pass the option settings to HiGHS. Only error-checking produces
// output, but values are checked in loadOptions, so it's safe to
// call this first so that printHighsVersionCopyright uses reporting
// call this first so that Highs::logHeader() uses reporting
// settings defined in any options file.
highs.passOptions(loaded_options);

highs.logHeader();
// Acknowledge use of CLI for command line parsing
cliCopyrightLine(log_options);
// Log changes from the default option settings
highs.writeOptions("", true);

Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions highs/lp_data/HighsOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,16 @@ void reportOptions(FILE* file, const HighsLogOptions& log_options,
HighsInt num_options = option_records.size();
for (HighsInt index = 0; index < num_options; index++) {
HighsOptionType type = option_records[index]->type;
if (option_records[index]->name == kLogFileString) {
// Default HiGHS log file name is "" so that deviations from it
// trigger opening the log file. However, it's unnecessary to
// report the deviation to kLogFileString, which is the default
// non-empty log file name in HighsRun.cpp
if (*((OptionRecordString*)option_records[index])[0].value ==
kHighsRunLogFile)
continue;
}

// Only report non-advanced options
if (option_records[index]->advanced) {
// Possibly skip the advanced options when creating Md file
Expand Down
2 changes: 2 additions & 0 deletions highs/lp_data/HighsOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ void reportOption(FILE* file, const HighsLogOptions& report_log_options,
const bool report_only_deviations,
const HighsFileType file_type);

const string kHighsRunLogFile = "Highs.log";

const string kSimplexString = "simplex";
const string kIpmString = "ipm";
const string kHipoString = "hipo";
Expand Down
Loading