7.1 Environment and task¶
All interaction with Optimizer API for Rust proceeds through one of two entry points: the MOSEK tasks and, to a lesser degree the MOSEK environment .
7.1.1 Task¶
The MOSEK task Task
provides a representation of one optimization problem. It is the main interface through which all optimization is performed. Many tasks can be created and disposed of in one process.
A typical scenario for working with a task is shown below:
let mut task = mosek::Task::new().unwrap();
// Define and solve an optimization problem here
// ...
7.1.2 Environment¶
The MOSEK environment Env
coordinates access to MOSEK from the current process. It provides various general functionalities, in particular those related to license management, linear algebra, parallel optimization and certain other auxiliary functions. All tasks are explicitly or implicitly attached to some environment. It is recommended to have at most one environment per process.
Creating an environment is optional and only recommended for those users who will require some of the features it provides. Most users will NOT need their own environment and can skip this object. In this case MOSEK will internally create a global environment transparently for the user. The user can access this global environment by using the static variants (with no environment argument) of any function that otherwise belongs to the environment.
A typical scenario for working with MOSEK through an explicit environment is shown below:
let mut env = mosek::Env::new().unwrap();
// Create one or more tasks
let mut task = env.task().unwrap();
// Define and solve an optimization problem here
// ...