6.1 The Basics Tutorial

The simplest program using the MOSEK Matlab interface can be described shortly:

  1. Load a problem into a problem structure (a task).
  2. Optimize the problem.
  3. Fetch the result.
Listing 3 A simple script that reads a problem from file and solves it. Click here to download.
%  Copyright : Copyright (c) MOSEK ApS, Denmark. All rights reserved.
%  File :      simple.m
%  Purpose :   To demonstrate how solve a problem
%              read from file.

function simple(inputfile, solfile)

cmd      = sprintf('read(%s)', inputfile)
% Read the problem from file
[rcode, res] = mosekopt(cmd)

% Perform the optimization.
[r,res] = mosekopt('minimize', res.prob); 

% Show the optimal x solution.