New features of Mosel in Release 7.5 Y. Colombani, S.Heipcke Xpress Team, FICO http://www.fico.com/xpress 1 Xpress-Mosel A high-level modeling language combined with standard functionality of programming languages implementation of models and solution algorithms in a single environment Open, modular architecture extensions to the language without any need for modifications to the core system Compiled language platform-independent compiled models for distribution to protect intellectual property...and also Mosel modules solvers: mmxprs, mmquad, mmxslp, mmnl, kalis data handling: mmetc, mmodbc, mmoci model handling, utilities: mmjobs, mmsystem graphics, GUI: mmive, mmxad, mminsight IVE: visual development environment (Windows) Library interfaces for embedding models into applications (C, Java, C#, VB) Tools: debugger, profiler Mosel modules MISLP XAD IVE Insight Kalis Mosel User extension SLP System, mmjobs LP MIP ODBC, OCI, XML, CSV,... MIQP QP MIP QCQP MI QCQP Solvers Modeling platform GUI Data interfaces Utilities Extensions Xpress-Mosel c Copyright 2013 Fair Isaac Corporation. All rights reserved. page 1
Highlights of Mosel development Launch in November 2001 Replacement of mp-model (Dash s modeling language since 1985) Mosel 1.2 (September 2002) Open access to Native Interface Mosel 1.4 (April 2004) Generalized file handling, I/O drivers; 64bit Mosel 1.6 (April 2005) Parallelism / multiple models; debugger and profiler Mosel 2.0 (April 2007) Data structures list and record; definition of user types; packages (Mosel libraries written with Mosel) Mosel 2.2 (October 2007) Enhancements to initializations functionality (evaluation of) Mosel 2.4 (July 2008) Module mmnl; creation of arrays "on the fly" (array) Mosel 3.0 (July 2009) Handling of multiple problems within a single model; mmxprs: indicator constraints; kalis: automatic linear relaxations Mosel 3.2 (November 2010) Framework for distributed computing; handling of matrices with more than 2 31 coefficients Mosel 3.4 (April 2012) Mosel remote launcher (XPRD) 2 New features of Mosel in Release 7.5 Major new features in Mosel Secure remote connections via SSH mmsheet: spreadsheet drivers on non-windows platforms mmxml: handling of XML documents Secure connections via SSH The xprmsrv server now accepts secure connections through an SSH tunnel (in addition to standard connections) mmjobs and XPRD define a new driver xssh (secure version of xsrv) to connect securely to an xprmsrv server without any additional software or settings Optionally, a client can authenticate the server on connection Documentation: Chapter mmjobs in the Mosel Language Reference XPRD: Mosel remote invocation library reference manual New features of Mosel in Release 7.5 c Copyright 2013 Fair Isaac Corporation. All rights reserved. page 2
mmsheet: Spreadsheet drivers The excel driver is now part of mmsheet usage: mmsheet.excel:myfile.xls New I/O drivers: xls XLS files xlsx XLSX and XLSM files csv CSV format files NB: The xls and xlsx drivers do not depend on Excel (including under Windows) Documentation: Chapter mmsheet in the Mosel Language Reference xls and xlsx have the same format and options as the excel driver initializations from "mmsheet.xls:mydata.xls" [A,B,C] as "MyRange"! Named range D1 as "[Sheet1$B3:E4]"! Cell reference D2 as "[Sheet1$R3C2:R4C5]"! Row-column notation A2 as "MyRange(#1,#4)"! Selecting columns end-initializations csv defines some additional formatting options and cannot use named ranges initializations from "mmsheet.csv:dsep=,;fsep=;;mydata.csv" D1 as "[B3:E4]"! Cell reference D2 as "[R3C2:R4C5]"! Row-column notation A2 as "[B3:E4](#1,#4)"! Selecting columns end-initializations Comparison of spreadsheet drivers excel xsl/xslx csv File type physical file physical file extended file Platforms Windows Windows, Linux, Mac all Xpress platforms Requirements Excel+open interactive session none, can be used remotely none, can be used remotely File creation for output no yes yes Output writing mechanism on-screen display without saving data saved into file data saved into file if application running, otherwise data saved into file Named ranges yes yes no Multiple sheets yes yes no VB macros yes yes no mmxml: XML handling The module mmxml provides an XML interface for the Mosel language. new type: xmldoc represents an XML document each node/element in the document is identified by a node number (an integer) that is attached to the document (i.e. a node number cannot be shared by different documents) Documentation: Chapter mmxml in the Mosel Language Reference New features of Mosel in Release 7.5 c Copyright 2013 Fair Isaac Corporation. All rights reserved. page 3
Example: Reading XML format data Data file folio.xml: <portfolio> <share name="treasury" ret="5" dev="0.1" country="canada" region="na" risk="low" /> <share name="hardware" ret="17" dev="19" country="usa" region="na" risk="high" />... <share name="electronics" ret="21" dev="16" country="japan" region="asia" risk="high" /> </portfolio> Example: Reading XML format data SHARES: set of string RISK: set of string RET: array(shares) of real AllData: xmldoc NodeList: list of integer! Set of shares! Set of high-risk values among shares! Estimated return in investment! XML document! List of XML nodes! Reading data from an XML file load(alldata, DATAFILE) getnodes(alldata, "portfolio/share", NodeList) RISK:= union(l in NodeList getattr(alldata,l,"risk")="high") {getstrattr(alldata,l,"name")} forall(l in NodeList) RET(getstrattr(AllData,l,"name")):= getintattr(alldata, l, "ret") Example: Outputting data in XML format SHARES: set of string frac: array(shares) of mpvar ResData: xmldoc Share,Root,Sol: integer! Set of shares! Fraction of capital used per share! XML document! XML nodes! Create solution representation in XML format Root:=addnode(ResData, 0, XML_ELT, "result")! Create root node Sol:= addnode(resdata, Root, XML_ELT, "solution")! Add "solution" node forall(s in SHARES) do Share:=addnode(ResData, Sol, XML_ELT,"share")! Add node to "solution" setattr(resdata, Share, "name", s)!...with attr. "name" setvalue(resdata, Share, frac(s).sol)!...and solution value end-do save(resdata, "result.xml") save(resdata, Sol, "")! Save solution to XML format file! Display XML format solution on screen Generated output file result.xml: <?xml version="1.0" encoding="iso-8859-1" standalone="yes"?> <result> <solution> <share name="treasury">0.3</share> <share name="hardware">0</share>... <share name="electronics">0</share> </solution> </result> New features of Mosel in Release 7.5 c Copyright 2013 Fair Isaac Corporation. All rights reserved. page 4
Example: XML paths DB: xmldoc Employees, AllEmployees, Names: list of integer! Check a property of a text node (start from document root) getnodes(db, "perslist/employee/language[position()=3]/..", Employees) forall(p in Employees) save(db, p, "")! Check a property of a text node (start path from a node) getnodes(db, "perslist/employee", AllEmployees) forall(n in AllEmployees) getnodes(db, n, "./name[starts-with(string(), J )]/..", Employees)! Check existence of an attribute getnodes(db, "perslist/employee[@parttime]", Employees) writeln("number of part-time workers: ", Employees.size)! Check a specific attribute value writeln("employee with id=t345: ", getvalue(db, getnode(db, "perslist/employee[@id= T345 ]/name")) Miscellaneous And also mmxprs: addmipsol + solnotify callback see example model mosel/whitepapers/moselpar/jobshopas.mos heursol: dynamic array(set of mpvar) of real public procedure solnotify(id:string, status:integer) writeln("optimiser loaded solution ",id," status=",status) end-procedure addmipsol(id,heursol) setcallback(xprs_cb_solnotify,"solnotify") setparam("xprs_heursearchrootselect",31) setparam("xprs_heursearchtreeselect",19)! Configure MIP heuristics! to use provided solutions New sizing options for mem and shmem I/O drivers (including incremental resizing) mem: see Mosel Libraries Reference shmem: see Chapter mmjobs in the Mosel Language Reference addresses efficiency problems on Windows platforms 3 Tips and Tricks Working with TAR archives Timestamp Structuring Mosel models Using assert Dates and times Indicator and logical constraints Deployment via an Excel VB macro Tips and Tricks c Copyright 2013 Fair Isaac Corporation. All rights reserved. page 5