8.1 Accessing the solution

This section contains important information about the status of the solver and the status of the solution, which must be checked in order to properly interpret the results of the optimization.

8.1.1 Solver termination

If an error occurs during optimization then the method Model.solve will throw an exception of type OptimizeError. The method FusionRuntimeException.toString will produce a description of the error, if available. More about exceptions in Sec. 8.2 (Errors and exceptions).

If a runtime error causes the program to crash during optimization, the first debugging step is to enable logging and check the log output. See Sec. 8.3 (Input/Output).

If the optimization completes successfully, the next step is to check the solution status, as explained below.

8.1.2 Available solutions

MOSEK uses three kinds of optimizers and provides three types of solutions:

  • basic solution (BAS, from the simplex optimizer),
  • interior-point solution (ITR, from the interior-point optimizer),
  • integer solution (ITG, from the mixed-integer optimizer).

Under standard parameters settings the following solutions will be available for various problem types:

Table 4 Types of solutions available from MOSEK
  Simplex optimizer Interior-point optimizer Mixed-integer optimizer
Linear problem SolutionType.Basic SolutionType.Interior  
Conic (nonlinear) problem   SolutionType.Interior  
Problem with integer variables     SolutionType.Integer

For linear problems the user can force a specific optimizer choice making only one of the two solutions available. For example, if the user disables basis identification, then only the interior point solution will be available for a linear problem. Numerical issues may cause one of the solutions to be unknown even if another one is feasible.

Not all components of a solution are always available. For example, there is no dual solution for integer problems.

The user will always need to specify which solution should be accessed.

Moreover, the user may be oblivious to the actual solution type by always referring to SolutionType.Default, which will automatically select the best available solution, if there is more than one. Moreover, the method Model.selectedSolution can be used to fix one solution type for all future references.

8.1.3 Problem and solution status

Assuming that the optimization terminated without errors, the next important step is to check the problem and solution status. There is one for every type of solution, as explained above.

Problem status

Problem status (ProblemStatus, retrieved with Model.getProblemStatus) determines whether the problem is certified as feasible. Its values can roughly be divided into the following broad categories:

  • feasible — the problem is feasible. For continuous problems and when the solver is run with default parameters, the feasibility status should ideally be ProblemStatus.PrimalAndDualFeasible.
  • primal/dual infeasible — the problem is infeasible or unbounded or a combination of those. The exact problem status will indicate the type of infeasibility.
  • unknown — the solver was unable to reach a conclusion, most likely due to numerical issues.

Solution status

Solution status (SolutionStatus, retrieved with Model.getPrimalSolutionStatus and Model.getDualSolutionStatus) provides the information about what the solution values actually contain. The most important broad categories of values are:

  • optimal (SolutionStatus.Optimal) — the solution values are feasible and optimal.
  • near optimal (SolutionStatus.NearOptimal) — the solution values are feasible and they were certified to be at least nearly optimal up to some accuracy.
  • certificate — the solution is in fact a certificate of infeasibility (primal or dual, depending on the solution).
  • unknown/undefined — the solver could not solve the problem or this type of solution is not available for a given problem.

The solution status determines the action to be taken. For example, in some cases a suboptimal solution may still be valuable and deserve attention. It is the user’s responsibility to check the status and quality of the solution.

Typical status reports

Here are the most typical optimization outcomes described in terms of the problem and solution statuses. Note that these do not cover all possible situations that can occur.

Table 5 Continuous problems (solution status for SolutionType.Interior or SolutionType.Basic)
Outcome Problem status Solution status (primal) Solution status (dual)
Optimal ProblemStatus.PrimalAndDualFeasible SolutionStatus.Optimal SolutionStatus.Optimal
Primal infeasible ProblemStatus.PrimalInfeasible SolutionStatus.Unknown SolutionStatus.Certificate
Dual infeasible ProblemStatus.DualInfeasible SolutionStatus.Certificate SolutionStatus.Unknown
Uncertain (stall, numerical issues, etc.) ProblemStatus.Unknown SolutionStatus.Unknown SolutionStatus.Unknown
Table 6 Integer problems (solution status for SolutionType.Integer, others undefined)
Outcome Problem status Solution status (primal) Solution status (dual)
Integer optimal ProblemStatus.PrimalFeasible SolutionStatus.Optimal SolutionStatus.Unknown
Infeasible ProblemStatus.PrimalInfeasible SolutionStatus.Unknown SolutionStatus.Unknown
Integer feasible point ProblemStatus.PrimalFeasible SolutionStatus.Feasible SolutionStatus.Unknown
No conclusion ProblemStatus.Unknown SolutionStatus.Unknown SolutionStatus.Unknown

8.1.4 Retrieving solution values

After the meaning and quality of the solution (or certificate) have been established, we can query for the actual numerical values. They can be accessed with methods such as:


By default only at least near optimal solutions are returned. An attempt to access a solution with a weaker status will result in an exception. This can be changed by choosing another level of acceptable solutions with the method Model.acceptedSolutionStatus. In particular, this method must be called to enable retrieving suboptimal solutions and infeasibility certificates. For instance, one could write


The current setting of acceptable solutions can be checked with Model.getAcceptedSolutionStatus.