Skip to content

Commit

Permalink
Merge pull request #1826 from ERGO-Code/latest
Browse files Browse the repository at this point in the history
Latest for release
  • Loading branch information
galabovaa committed Jul 1, 2024
2 parents aadf029 + 449e33c commit 846ba0e
Show file tree
Hide file tree
Showing 57 changed files with 883 additions and 560 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/test-fortran-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: test-fortran-macos

on: [push, pull_request]

jobs:
fast_build_release:
runs-on: macos-12


steps:
- uses: actions/checkout@v4

- uses: fortran-lang/setup-fortran@v1.6
id: setup-fortran
with:
compiler: gcc
version: 11

# - name: Install GFortran
# run: brew install gfortran gcc

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
cmake --version
gfortran-11 --version
cmake $GITHUB_WORKSPACE -DFORTRAN=ON
- name: Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --parallel

- name: Test
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
ls
./bin/fortrantest
2 changes: 1 addition & 1 deletion .github/workflows/test-fortran-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test-fortran
name: test-fortran-ubuntu

on: [push, pull_request]

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ if (BUILD_CXX)
"but it is not supported by the compiler. The check failed with this output:\n"
"${check_ipo_support_output}")
endif()
elseif(NOT ipo_supported)
elseif(NOT ipo_supported OR (APPLE AND FORTRAN))
message(STATUS "IPO / LTO: disabled because it is not supported")
elseif(NOT BUILD_SHARED_LIBS)
# For a static library, we can't be sure whether the final linking will
Expand Down
43 changes: 12 additions & 31 deletions FEATURES.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,22 @@
## Build changes

### HiGHS on nixpkgs
The python wrapper highspy is now available for aarch64 on manylinux
This allows highs to be run through Python on AWS arm64

HiGHS now has a `flake.nix` to build the binary, allowing `nix` users to try it out

### Python build update

Highspy with setuptools from v1.7.0 only worked on Python 3.12
For v1.7.0 we have dropped setuptools and switched to scikit-build-core

### Windows versions

Fixed version info of shared library
Added version info to executable
Bug fix for fortran on macOS

## Code changes

Inserting `pdlp_iteration_count` into various structs (for v1.7.0) breaks the C API, so it has been moved to the end of those structs

`setBasis` has been added to `highspy`

`writePresolvedModel` has been added

Saved MIP solution pool is populated when presolve reduces MIP to empty

Compilation date has been removed improve build reproducibility. Methods to print compilation dates are deprecated

Logging and error return when user-supplied solution or basis is rejected on vector dimensions

Memory allocation errors in presolve are caught and `Highs::run()` returns `HighsStatus::kError` with `model_status_ = HighsModelStatus::kMemoryLimit`

QP solver logging is now neater and quieter

Any Hessian for the incumbent model is modified with zero entries when adding columns to the model, and rows/columns are removed when columns are deleted from the model.
The accessor function Highs_getCallbackDataOutItem in the C API means
that `pdlp_iteration_count` can be moved back to where it was inserted
into the `HighsCallbackDataOut` struct in v1.7.0, which broke the C
API. This fixes #1812

Minor bug fix in MIP presolve
Some duplicate code has been eliminated from the MIP solver, and
modifications made to eliminate compiler warnings

QP solver will now hot start given a basis and solution
Declaration of the (deprecated) method `char* highsCompilationDate()`
has been corrected

Fixed bug when describing integrality status during the human-readable solution write

2 changes: 1 addition & 1 deletion check/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,4 @@ if (NOT FAST_BUILD OR ALL_TESTS)
endforeach(setting)
endforeach()

endif()
endif()
26 changes: 22 additions & 4 deletions check/TestHighsVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ TEST_CASE("HighsVersion", "[highs_version]") {
const HighsInt major = highsVersionMajor();
const HighsInt minor = highsVersionMinor();
const HighsInt patch = highsVersionPatch();
const std::string compilation = highsCompilationDate();
const std::string githash = std::string(highsGithash());
std::stringstream ss;
ss << major << "." << minor << "." << patch;
std::string local_version = ss.str();
Expand All @@ -21,15 +23,31 @@ TEST_CASE("HighsVersion", "[highs_version]") {
printf("HiGHS major version %d\n", int(major));
printf("HiGHS minor version %d\n", int(minor));
printf("HiGHS patch version %d\n", int(patch));
printf("HiGHS githash: %s\n", highsGithash());
// Compilation date is deprecated.
// printf("HiGHS compilation date: %s\n", highsCompilationDate());
printf("HiGHS githash: %s\n", githash.c_str());
// Compilation date is deprecated, but make sure that the
// deprecated method is still tested.
printf("HiGHS compilation date: %s\n", compilation.c_str());
printf("HiGHS local version: %s\n", local_version.c_str());
}
REQUIRE(major == HIGHS_VERSION_MAJOR);
REQUIRE(minor == HIGHS_VERSION_MINOR);
REQUIRE(patch == HIGHS_VERSION_PATCH);
REQUIRE(local_version == version);
REQUIRE(githash == std::string(HIGHS_GITHASH));
REQUIRE(version == local_version);
// Check that the corresponding methods
Highs highs;
const std::string version0 = highs.version();
REQUIRE(version0 == version);
const HighsInt major0 = highs.versionMajor();
REQUIRE(major0 == major);
const HighsInt minor0 = highs.versionMinor();
REQUIRE(minor0 == minor);
const HighsInt patch0 = highs.versionPatch();
REQUIRE(patch0 == patch);
const std::string githash0 = highs.githash();
REQUIRE(githash0 == githash);
const std::string compilation0 = highs.compilationDate();
REQUIRE(compilation == compilation);
}

TEST_CASE("sizeof-highs-int", "[highs_version]") {
Expand Down
2 changes: 1 addition & 1 deletion cmake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
| OS | C++ | Fortran | Python | CSharp Example | .NET |
|:-------- | :---: | :------: | :----: | :----: | :----: |
| Linux | [![Status][linux_cpp_svg]][linux_cpp_link] | [![Status][linux_fortran_svg]][linux_fortran_link] | [![Status][linux_python_svg]][linux_python_link] | *(1)* | [![Status][linux_dotnet_svg]][linux_dotnet_link] |
| MacOS | [![Status][macos_cpp_svg]][macos_cpp_link] | *(2)* | [![Status][macos_python_svg]][macos_python_link] | *(1)* |[![Status][macos_dotnet_svg]][macos_dotnet_link] |
| MacOS | [![Status][macos_cpp_svg]][macos_cpp_link] | [![Status][macos_fortran_svg]][macos_fortran_link] | [![Status][macos_python_svg]][macos_python_link] | *(1)* |[![Status][macos_dotnet_svg]][macos_dotnet_link] |
| Windows | [![Status][windows_cpp_svg]][windows_cpp_link] | *(2)* | [![Status][windows_python_svg]][windows_python_link] | [![Status][windows_csharp_svg]][windows_csharp_link] | [![Status][windows_dotnet_svg]][windows_dotnet_link] |

[linux_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake-linux-cpp.yml/badge.svg
Expand Down
19 changes: 11 additions & 8 deletions docs/src/guide/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ and [classes](@ref classes-overview), and are referred to below.

#### [Enums](@id guide-basic-enums)

Enums are scalar identifier types that can take only a limited range of values.????

#### The
advantage using these classes is that many fewer parameters are
needed when passing data to and from HiGHS. However, the use of
classes is not necessary for the basic use of `highspy`. As with the
`C` and `Fortran` interfaces, there are equivalent methods that use
simple scalars and vectors of data.
Enums are scalar identifier types that can take only a limited range of values.

#### [Classes](@id guide-basic-classes)

The advantage of using the native `C++` classes in HiGHS is that many fewer parameters are needed
when passing data to and from HiGHS. The binding of the data members
of these classes to `highspy` structures allows them to be used when
calling HiGHS from Python, although they are not necessary for the
basic use of `highspy`. As with the `C` and `Fortran` interfaces,
there are equivalent methods that use simple scalars and vectors of
data.

## Defining a model

Expand Down
2 changes: 1 addition & 1 deletion docs/src/interfaces/python/example-py.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ print('Basis validity = ', h.basisValidityToString(info.basis_validity))
* `changeColCost`
* `changeColBounds`
* `changeRowBounds`
* `changeColsCosts`
* `changeColsCost`
* `changeColsBounds`
* `changeRowsBounds`
* `changeCoeff`
Expand Down
12 changes: 12 additions & 0 deletions docs/src/options/definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,15 @@
- Range: [1e-12, inf]
- Default: 0.0001

## qp\_iteration\_limit
- Iteration limit for QP solver
- Type: integer
- Range: {0, 2147483647}
- Default: 2147483647

## qp\_nullspace\_limit
- Nullspace limit for QP solver
- Type: integer
- Range: {0, 2147483647}
- Default: 4000

2 changes: 2 additions & 0 deletions docs/src/structures/enums.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ This defines the status of the model after a call to `run`
* `kTimeLimit`: The run time limit has been reached
* `kIterationLimit`: The iteration limit has been reached
* `kSolutionLimit`: The MIP solver has reached the limit on the number of LPs solved
* `kInterrupt`: The solver has been interrupted by the user
* `kMemoryLimit`: The solver has been unable to allocate sufficient memory
* `kUnknown`: The model status is unknown

## HighsBasisStatus
Expand Down
2 changes: 1 addition & 1 deletion extern/zstr/strict_fstream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace strict_fstream
{

// Help people out a bit, it seems like this is a common recommenation since
// Help people out a bit, it seems like this is a common recommendation since
// musl breaks all over the place.
#if defined(__NEED_size_t) && !defined(__MUSL__)
#warning "It seems to be recommended to patch in a define for __MUSL__ if you use musl globally: https://www.openwall.com/lists/musl/2013/02/10/5"
Expand Down
9 changes: 5 additions & 4 deletions src/Highs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1212,11 +1212,7 @@ class Highs {

// Start of deprecated methods

/**
* @brief Return compilation date
*/
std::string compilationDate() const { return "deprecated"; }
const char* highsCompilationDate();

HighsStatus setLogCallback(void (*user_log_callback)(HighsLogType,
const char*, void*),
Expand Down Expand Up @@ -1525,4 +1521,9 @@ class Highs {
const double ill_conditioning_bound);
bool infeasibleBoundsOk();
};

// Start of deprecated methods not in the Highs class

const char* highsCompilationDate();

#endif
2 changes: 1 addition & 1 deletion src/io/HMPSIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ HighsStatus writeModelAsMps(const HighsOptions& options,
HighsStatus row_name_status =
normaliseNames(options.log_options, "row", lp.num_row_, local_row_names,
max_row_name_length);
if (row_name_status == HighsStatus::kError) return col_name_status;
if (row_name_status == HighsStatus::kError) return row_name_status;
warning_found = row_name_status == HighsStatus::kWarning || warning_found;

HighsInt max_name_length = std::max(max_col_name_length, max_row_name_length);
Expand Down
6 changes: 3 additions & 3 deletions src/io/HMpsFF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2036,12 +2036,12 @@ double HMpsFF::getValue(const std::string& word, bool& is_nan,
const HighsInt id) const {
// Lambda to replace any d or D by E
auto dD2e = [&](std::string& word) {
HighsInt ix = word.find("D");
if (ix >= 0) {
size_t ix = word.find("D");
if (ix != std::string::npos) {
word.replace(ix, 1, "E");
} else {
ix = word.find("d");
if (ix >= 0) word.replace(ix, 1, "E");
if (ix != std::string::npos) word.replace(ix, 1, "E");
}
};

Expand Down
17 changes: 13 additions & 4 deletions src/io/HighsIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,23 @@ struct HighsLogOptions {
bool* output_flag;
bool* log_to_console;
HighsInt* log_dev_level;
void (*user_log_callback)(HighsLogType, const char*, void*) = nullptr;
void* user_log_callback_data = nullptr;
void (*user_log_callback)(HighsLogType, const char*, void*);
void* user_log_callback_data;
std::function<void(int, const std::string&, const HighsCallbackDataOut*,
HighsCallbackDataIn*, void*)>
user_callback;
void* user_callback_data = nullptr;
bool user_callback_active = false;
void* user_callback_data;
bool user_callback_active;
void clear();
HighsLogOptions()
: log_stream(nullptr),
output_flag(nullptr),
log_to_console(nullptr),
log_dev_level(nullptr),
user_log_callback(nullptr),
user_log_callback_data(nullptr),
user_callback_data(nullptr),
user_callback_active(false){};
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ipm/ipx/crossover.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Crossover {
// as long as the Crossover object is used.
Crossover(const Control& control);

// First runs the dual push phase; if this was succesful, then runs the
// First runs the dual push phase; if this was successful, then runs the
// primal push phase.
//
// weights: Must either be NULL or an array of size n+m.
Expand Down
2 changes: 1 addition & 1 deletion src/ipm/ipx/forrest_tomlin.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace ipx {

// Generic implementation of the Forrest-Tomlin update [1] that can be used with
// any LU factorization. The implementation does not exploit hypersparsity,
// which exludes its use for such problems. For non-hypersparse problems the
// which excludes its use for such problems. For non-hypersparse problems the
// implementation is better suited than BASICLU, however, because it stores L
// and U in compressed form with permuted indices; hence solving triangular
// systems with a dense rhs/lhs accesses memory contiguously. BASICLU could not
Expand Down
2 changes: 1 addition & 1 deletion src/ipm/ipx/indexed_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace ipx {
// otherwise.
//
// When modifying the vector changes its pattern (e.g. by writing to v[i] for an
// arbitray index i), you have to invalidate the pattern or provide the new one.
// arbitrary index i), you have to invalidate the pattern or provide the new one.

class IndexedVector {
public:
Expand Down
2 changes: 1 addition & 1 deletion src/ipm/ipx/iterate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void Iterate::Postprocess() {

// For fixed variables compute xl[j] and xu[j] from x[j]. If the lower and
// upper bound are equal, set zl[j] or zu[j] such that the variable is dual
// feasibile. Otherwise leave them zero.
// feasible. Otherwise leave them zero.
for (Int j = 0; j < n+m; j++) {
if (StateOf(j) == State::fixed) {
xl_[j] = x_[j] - lb[j];
Expand Down
4 changes: 2 additions & 2 deletions src/ipm/ipx/iterate.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Iterate {
double zl(Int j) const { return zl_[j]; }
double zu(Int j) const { return zu_[j]; }

// Returns const rerefences to the residual vectors
// Returns const references to the residual vectors
// rb = b-AI*x,
// rl = lb-x+xl,
// ru = ub-x-xu,
Expand Down Expand Up @@ -155,7 +155,7 @@ class Iterate {
double presidual() const;
double dresidual() const;

// copmlementarity() returns the sum of the pairwise complementarity
// complementarity() returns the sum of the pairwise complementarity
// products xl[j]*zl[j] and xu[j]*zu[j] from all barrier terms. mu()
// returns the average, mu_min() the minimum and mu_max() the maximum.
double complementarity() const;
Expand Down
2 changes: 1 addition & 1 deletion src/ipm/ipx/lu_factorization.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class LuFactorization {
// kLuDependencyTol as absolute pivot tolerance and to
// remove columns from the active submatrix
// immediately when all entries became smaller than
// the abolute pivot tolerance. Need not be supported
// the absolute pivot tolerance. Need not be supported
// by the implementation.
// @L, @U: return the matrix factors with sorted indices. The objects are
// resized as necessary.
Expand Down
2 changes: 1 addition & 1 deletion src/ipm/ipx/lu_update.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LuUpdate {
// kLuDependencyTol as absolute pivot tolerance and to
// remove columns from the active submatrix
// immediately when all entries became smaller than
// the abolute pivot tolerance. Need not be supported
// the absolute pivot tolerance. Need not be supported
// by the implementation.
//
// Factorize() cannot fail other than for out of memory, in which case
Expand Down
2 changes: 1 addition & 1 deletion src/ipm/ipx/sparse_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace ipx {
// have previously been unmarked; they are marked now and newtop
// is returned.
// @marked, @marker Node i is "marked" iff @marked[i] == @marker.
// @work worksapce of size # rows of A.
// @work workspace of size # rows of A.
//
// The code has been copied and adapted from cs_dfs.c, included in the CSPARSE
// package [1].
Expand Down
Loading

0 comments on commit 846ba0e

Please sign in to comment.