MOSEK Provides a plug-in to the Microsoft Solver Foundation (MSF). This enables Solver foundation Services to use MOSEK as a solver to solve LP,QP and MIP problems. The current implementation does not include the following features:
The MSF plug-in is available in the dll mosekmsflink.dll which must be installed in the Global Assembly Cache (GAC) or placed in the same directory as the executable at run-time. The MOSEK dotnet dll (mosekdotnet.dll) must also be available along with the MOSEK native libraries. The above mentioned files are distributed with MOSEK and can be found in:
mosek\5\tools\platform\win\bin
.
The dll Microsoft.Solver.Foundation.dll contains the MSF functionality and is provided by the MSF distribution.
The following sections gives an example of how to call MOSEK from the MSF layer.
The code example below reads an mps file and solves it using MOSEK.
mosek\5\tools\examples\dotnet\msfcmd.cs
The solver is selected by parsing the appropriate subclass of Directive to the Solve function. The following Directive classes are available:
Selects the Simplex algorithm.
Selects the MIP solver.
Selects the interior point solver.
For the program to run a App.config file must be present containing the code shown below.
mosek\5\tools\examples\dotnet\msfcmd.exe.config
<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="MsfConfig" type="Microsoft.SolverFoundation.Services.MsfConfigSection, Microsoft.Solver.Foundation, Version=1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" allowLocation="true" allowDefinition="Everywhere" allowExeDefinition="MachineToApplication" restartOnExternalChanges="true" requirePermission="true" /> </configSections> <MsfConfig> <MsfPluginSolvers> <MsfPluginSolver name="MosekMip" capability="MILP" assembly="mosekmsflink" solverclass="SolverFoundation.Plugin.Mosek.MosekMipSolver" directiveclass="SolverFoundation.Plugin.Mosek.MosekMipDirective" parameterclass="SolverFoundation.Plugin.Mosek.MosekMipSolverParams"/> <MsfPluginSolver name="MosekIP" capability="QP" assembly="mosekmsflink" solverclass="SolverFoundation.Plugin.Mosek.MosekInteriorPointSolver" directiveclass="SolverFoundation.Plugin.Mosek.MosekInteriorPointMethodDirective" parameterclass="SolverFoundation.Plugin.Mosek.MosekInteriorPointSolverParams"/> <MsfPluginSolver name="MosekSimplex" capability="LP" assembly="mosekmsflink" solverclass="SolverFoundation.Plugin.Mosek.MosekSimplexSolver" directiveclass="SolverFoundation.Plugin.Mosek.MosekSimplexDirective" parameterclass="SolverFoundation.Plugin.Mosek.MosekSimplexSolverParams"/> </MsfPluginSolvers> </MsfConfig> </configuration>
The App.config file must be placed in the same directory as the executable (in this case msfcmd.exe) and have the name name EXENAME.exe.config where EXENAME is replace by the name of the executable.
The files for this example can be found in
mosek\5\tools\examples\dotnet\
A template for visual studio 2008 containing the relevant App.config file and references can be installed by running
mosek\5\tools\examples\dotnet\MsfMosekPluginTemplate.vsi
. The template should now be available from within Visual Studio.