4 Installation

In this section we discuss how to install and setup the MOSEK Optimizer API for Rust.

Important

Before running this MOSEK interface please make sure that you:

  • Installed MOSEK correctly. Some operating systems require extra steps. See the Installation guide for instructions and common troubleshooting tips.

  • Set up a license. See the Licensing guide for instructions.

Compatibility

The Optimizer API for Rust can currently be used with Rust 1.59 and later in 64bit platforms (Linux, Windows, macOS) supported by MOSEK.

The Optimizer API for Rust is not included in the MOSEK distribution, but should be installed from the crates.io package repository using Cargo.

Locating files in the MOSEK Optimization Suite

The relevant files of the Optimizer API for Rust are organized as reported in Table 4.1.

Table 4.1 Relevant files for the Optimizer API for Rust.

Relative Path

Description

Label

<MSKHOME>/mosek/11.0/tools/examples/rust

Examples

<EXDIR>

<MSKHOME>/mosek/11.0/tools/examples/data

Additional data

<MISCDIR>

where

  • <MSKHOME> is the folder in which the MOSEK Optimization Suite has been installed,

  • <PLATFORM> is the actual platform among those supported by MOSEK, i.e. win64x86, linux64x86, osxaarch64, linuxaarch64.

Installation

4.1 Setting up a project

The MOSEK Rust interface package is hosted at https://crates.io, and should be installed with Cargo. To use MOSEK in your project, add

mosek = "11.0"

to the [dependencies] section of the project Cargo.toml and run rust update.

If the MOSEK distribution is installed in your home directory, rust will pick it up automatically. Otherwise set the environment variable MOSEK_INST_BASE to the directory that contains the installation.

4.2 Testing distributed examples

To build and run the distributed Rust examples, open a prompt and go to the <EXDIR>. To build example lo1, type

cargo build --bin lo1

To run the example it is necessary to set the environment library path (PATH on Windows, DYLD_LIBRARY_PATH on OS X and LD_LIBRARY_PATH on Linux) to point the the bin directory in the MOSEK distro. Then type

cargo run --bin lo1