Thursday, September 21, 2023

Apple Silicon and Matlab R2023b

The MATLAB R2023b is the first stable release with native support for the Apple Silicon M1/M2 platform. 

The MOSEK Optimization Toolbox for MATLAB is available natively for Apple Silicon from MOSEK 10.1. It means that from version 10.1 there are two ways to use MOSEK in MATLAB on the M1/M2 platform:

  • (natively) Use the Apple Silicon release of MATLAB (version 2023b+, architecture MACA64) and the osxaarch64 MOSEK package, with its included toolbox for MATLAB.
  • (via Rosetta, the "old" way) Use the Intel release of MATLAB (any version, architecture MACI64) and the osx64x86 MOSEK package with its included toolbox for MATLAB. 
In other words, the architecture of MOSEK should match the architecture of the MATLAB installation.

The "old" way, with emulation via Rosetta, may be relevant for users of binary MATLAB packages which do not (yet) have native releases for M1/M2 but only for the Intel-based Macs. This is (currently) the case, for instance, with CVX.

Monday, September 18, 2023

MIP improvements in 10.1


In a previous blogpost we talked about additions made to MOSEK with the release of version 10.1. However, as usual with new releases improvements in the existing functionality have also been made.

One area where we have improved a lot with our latest release is with our mixed integer solver. On our internal benchmarking set we have seen an improvement of over 30 per cent on the geometric mean of the solution time compared to MOSEK 10.0.

Does this mean you will see a 30 per cent improvement on your mixed integer problems? No, or yes or maybe… It depends!

Mixed integer problems are hard, NP-complete in fact, and in the design of the solver algorithms there are tradeoffs to be made. These tradeoffs will make the solver good for certain problems and less so for others. Tuning the solver will determine which problems it will perform well on and on which it will not.  

At MOSEK we tune our solvers based on our internal benchmarking sets. These sets are mainly based on problems we have received from customers, and we feel they are representative of the problems being solved for practical applications.

So, does this mean you will see a 30 per cent improvement on your mixed integer problems? No, not for certain. But it might be worthwhile to upgrade to 10.1 and test and see!

Monday, September 11, 2023

Remote optimization with OptServer(Light)

Together with the recently released MOSEK 10.1 we introduced OptServerLight - a light version of a remote optimization server. Let us take this opportunity to write a few words about remote optimization in MOSEK and introduce the two variants of the OptServer.

In a typical scenario the user sets up an optimization problem in MOSEK (through an API, or by reading a file), solves it, and retrieves the solution. All steps are executed in one process, on the same machine. Under remote optimization the user still sets up the problem locally (in the client), but the optimization itself (the call to MSK_optimize(), optimize(), solve() or similar) is being executed on a remote machine (server), before the user can again retrieve the solution in the local process on the client. In practice the client submits the problem data to the server via HTTP/HTTPS, the server calls its own instance of MOSEK to solve the problem, and transmits the solution back to the client in response.

From the client's point of view the process is completely transparent. All it takes is to instruct MOSEK to contact the remote server instead of optimizing locally. Everything else - setting up the problem, retrieving the solution, printing log output - remain unchanged. Here is an illustration in Python Fusion:

The client code is the same for local and remote optimization, except for the one line which introduces the address of the remote OptServer. This code will, in fact, work, because the URL points to an existing OptServer which we made available online and which can solve small problems for demonstration purposes. See for more information and downloadable code samples.

Why/when use the remote OptServer?
  • One centralized computational server where all heavy computations are offloaded by clients.
  • The problems are too big/time consuming for weak client machines.
  • No need for the clients to have the MOSEK license, only the server requires a license.
  • Solving problems produced by a different source than a MOSEK client.
  • Load and user access control.
We provide two flavors of the OptServer:
  • OptServerLight - a minimalistic binary. Shipped in the distribution, started directly from command line with minimal or no configuration, works out-of-the-box, available for all platforms. Keeps no state, works in-memory, suitable as a simple solver service in container pipelines. Very basic load balancing and configuration are available. Recommended as a starting point and probably sufficient for a majority of applications. See the brief startup notes.
  • The full OptServer. In addition to the solver service provides a user API, job history, authentication, API tokens, various levels of permissions, administrator/user accounts, statistics, web interface and more. Requires a more elaborate setup, including configuring a database. See the demo docker image for a stand-alone container and installation instructions.