Crates.io | mosek |
lib.rs | mosek |
version | 11.0.0-beta.0 |
source | src |
created_at | 2021-06-17 09:54:35.161953 |
updated_at | 2024-11-06 20:03:26.144795 |
description | Rust API for MOSEK optimization tools |
homepage | https://mosek.com |
repository | https://github.com/MOSEK/Mosek.rust |
max_upload_size | |
id | 411282 |
size | 1,164,552 |
The package should work on
Building the API requires the MOSEK library.
MOSEK_INST_BASE
, the build
script will look for mosek $MOSEK_INST_BASE/mosek
,$HOME/mosek
.curl
, tar
and bzip2
). On Windows it will fail.For example
export MOSEK_INST_BASE=$HOME/local
cargo build
or
export MOSEK_BINDIR_110=$HOME/local/mosek/11.0/tools/platform/linux64x86/bin
cargo build
The MOSEK Rust API currently depends only on libc
and itertools
, and the
MOSEK library.
cargo doc
will build the simple API documentation for all functions, objects and constants. For a more complete documentation, see https://docs.mosek.com/latest/capi/index.html.
Examples are located under examples/
To compile examples, run
cargo build --examples
To run example binaries it is necessary to add the path to the MOSEK
library to the LD_LIBRARY_PATH
(linux), DYLD_LIBRARY_PATH
(OS X)
or PATH
(Windows) environment variable.
To use MOSEK from another Rust project, add "mosek" to the dependencies. Normally, it will be a good idea to specify an exact major and minor version for the dependency since there is no guarantee that the MOSEK API will not change between minor versions (though usually it will not change much).
For example, add to your Cargo.toml
:
[dependencies]
mosek = "11.0"
When running a project that uses mosek
, the mosek library must be in the
library search path (PATH
for Windows, LD_LIBRARY_PATH
for linux,
DYLD_LIBRARY_PATH
for OS X).
Rust has many advantages over other languages supported directly by MOSEK. For data wrangling it is faster than Python, Java or .NET, and it is significantly safer than C or C++. When building non-trivial models, the time it takes to form the input data for a problem may become non-trivial as well. When efficiency is critical, the traditional language of choice would have been C or C++, but now Rust provides a much safer alternative.
Compared to Java and .NET Rust is in many cases somewhat faster when e.g. building complex constraint matrixes.
Finally, it looks good. Rust language facilities allow us to write many array operations very compactly, yielding concise and readable model code.