-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
readme cleanup and python example fix
- Loading branch information
Showing
2 changed files
with
36 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,27 +5,17 @@ | |
[![PyPi](https://img.shields.io/pypi/v/highspy.svg)](https://pypi.python.org/pypi/highspy) | ||
[![PyPi](https://img.shields.io/pypi/dm/highspy.svg)](https://pypi.python.org/pypi/highspy) | ||
|
||
## Table of Contents | ||
|
||
- [HiGHS - Linear optimization software](#highs---linear-optimization-software) | ||
- [Table of Contents](#table-of-contents) | ||
- [About HiGHS](#about-highs) | ||
- [Documentation](#documentation) | ||
- [Installation](#installation) | ||
- [Build from source using CMake](#build-from-source-using-cmake) | ||
- [Precompiled binaries](#precompiled-binaries) | ||
- [Compilation](#compilation) | ||
- [Meson](#meson) | ||
- [Python](#python) | ||
- [Interfaces](#interfaces) | ||
- [Python](#python-1) | ||
- [From PyPi](#from-pypi) | ||
- [Build directly from Git](#build-directly-from-git) | ||
- [Testing](#testing) | ||
- [Google Colab Example](#google-colab-example) | ||
- [Python](#python) | ||
- [Reference](#reference) | ||
|
||
## About HiGHS | ||
----------- | ||
|
||
HiGHS is a high performance serial and parallel solver for large scale sparse | ||
linear optimization problems of the form | ||
|
@@ -46,126 +36,83 @@ Documentation is available at https://ergo-code.github.io/HiGHS/. | |
|
||
## Installation | ||
|
||
There are various ways to install the HiGHS library. These are detailed below. | ||
|
||
### Precompiled binaries | ||
-------------------- | ||
|
||
Precompiled static executables are available for a variety of platforms at | ||
https://github.com/JuliaBinaryWrappers/HiGHSstatic_jll.jl/releases | ||
|
||
_These binaries are provided by the Julia community and are not officially supported by the HiGHS development team. If you have trouble using these libraries, please open a GitHub issue and tag `@odow` in your question._ | ||
|
||
See https://ergo-code.github.io/HiGHS/stable/installation/#Precompiled-Binaries. | ||
|
||
### Compilation | ||
--------------- | ||
|
||
HiGHS uses CMake as build system, and requires at least version 3.15. First setup a build folder and call CMake as follows | ||
|
||
mkdir build | ||
cd build | ||
cmake .. | ||
|
||
Then compile the code using | ||
|
||
cmake --build . | ||
### Build from source using CMake | ||
|
||
This installs the executable `bin/highs`. | ||
|
||
As an alternative it is also possible to let `cmake` create the build folder and thus build everything from the HiGHS directory, as follows | ||
HiGHS uses CMake as build system, and requires at least version 3.15. To generate build files in a new subdirectory called 'build', run: | ||
|
||
```sh | ||
cmake -S . -B build | ||
cmake --build build | ||
``` | ||
This installs the executable `bin/highs` and the library `lib/highs`. | ||
|
||
To test whether the compilation was successful, change into the build directory and run | ||
|
||
To test whether the compilation was successful, run | ||
|
||
```sh | ||
ctest | ||
``` | ||
|
||
HiGHS can read MPS files and (CPLEX) LP files, and the following command | ||
solves the model in `ml.mps` | ||
|
||
```sh | ||
highs ml.mps | ||
|
||
``` | ||
HiGHS is installed using the command | ||
|
||
cmake --install . | ||
|
||
with the optional setting of `--prefix <prefix> = The installation prefix CMAKE_INSTALL_PREFIX` if it is to be installed anywhere other than the default location. | ||
```sh | ||
cmake --install build | ||
``` | ||
|
||
### Meson | ||
----- | ||
with the optional setting of `--prefix <prefix>`, or the cmake option `CMAKE_INSTALL_PREFIX` if it is to be installed anywhere other than the default location. | ||
|
||
HiGHs can also use the `meson` build interface: | ||
|
||
As an alternative, HiGHS can be installed using the `meson` build interface: | ||
``` sh | ||
meson setup bbdir -Dwith_tests=True | ||
meson test -C bbdir | ||
``` | ||
_The meson build files are provided by the community and are not officially supported by the HiGHS development team._ | ||
|
||
### Precompiled binaries | ||
|
||
### Python | ||
----- | ||
Precompiled static executables are available for a variety of platforms at | ||
https://github.com/JuliaBinaryWrappers/HiGHSstatic_jll.jl/releases | ||
|
||
Installing from PyPI through your Python package manager of choice (e.g., `pip`) will also | ||
install the HiGHS library if not already present. HiGHS is available as `highspy` on [PyPi](https://pypi.org/project/highspy/). | ||
_These binaries are provided by the Julia community and are not officially supported by the HiGHS development team. If you have trouble using these libraries, please open a GitHub issue and tag `@odow` in your question._ | ||
|
||
If `highspy` is not already installed, run: | ||
See https://ergo-code.github.io/HiGHS/stable/installation/#Precompiled-Binaries. | ||
|
||
```bash | ||
$ pip install highspy | ||
``` | ||
|
||
## Interfaces | ||
|
||
There are HiGHS interfaces for C, C#, FORTRAN, and Python in [HiGHS/src/interfaces](https://github.com/ERGO-Code/HiGHS/blob/master/src/interfaces), with example driver files in [HiGHS/examples](https://github.com/ERGO-Code/HiGHS/blob/master/examples). More on language and modelling interfaces can be found at https://ergo-code.github.io/HiGHS/stable/interfaces/other/. | ||
|
||
We are happy to give a reasonable level of support via email sent to [email protected]. | ||
|
||
### Python | ||
#### Python | ||
|
||
The python package `highspy` is a thin wrapper around HiGHS and is available on [PyPi](https://pypi.org/project/highspy/). It can be easily installed via `pip` by running | ||
|
||
```bash | ||
```sh | ||
$ pip install highspy | ||
``` | ||
|
||
Alternatively, `highspy` can be built from source. Download the HiGHS source code and run | ||
|
||
```bash | ||
```sh | ||
pip install . | ||
``` | ||
|
||
from the root directory. | ||
|
||
The HiGHS C++ library no longer needs to be separately installed. The python package `highspy` depends on the `numpy` package and `numpy` will be installed as well, if it is not already present. | ||
|
||
#### Testing | ||
|
||
The installation can be tested using the small example [call_highs_from_python_highspy.py](https://github.com/ERGO-Code/HiGHS/blob/master/examples/call_highs_from_python_highspy.py), yielding the output | ||
|
||
Running HiGHS 1.7.0 (git hash: n/a): Copyright (c) 2024 HiGHS under MIT licence terms | ||
LP has 2 columns 2 rows and 4 nonzeros | ||
Solving... | ||
Problem solved. | ||
|
||
Model status = Optimal | ||
Optimal objective = 1.0 | ||
Iteration count = 0 | ||
Primal solution status = Feasible | ||
Dual solution status = Feasible | ||
Basis validity = Valid | ||
|
||
or the more didactic [call_highs_from_python.py](https://github.com/ERGO-Code/HiGHS/blob/master/examples/call_highs_from_python.py). | ||
|
||
#### Google Colab Example | ||
|
||
The [Google Colab Example Notebook](https://colab.research.google.com/drive/1JmHF53OYfU-0Sp9bzLw-D2TQyRABSjHb?usp=sharing) demonstrates how to call HiGHS via the Python interface `highspy`. | ||
The installation can be tested using the small example [call_highs_from_python_highspy.py](https://github.com/ERGO-Code/HiGHS/blob/master/examples/call_highs_from_python_highspy.py). | ||
|
||
The [Google Colab Example Notebook](https://colab.research.google.com/drive/1JmHF53OYfU-0Sp9bzLw-D2TQyRABSjHb?usp=sharing) also demonstrates how to call `highspy`. | ||
|
||
## Reference | ||
|
||
|
||
If you use HiGHS in an academic context, please acknowledge this and cite the following article. | ||
|
||
Parallelizing the dual revised simplex method | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters