Mosel Model Development Requirements
- You should develop your Mosel model to get its input from a file named
input
located in the model's working directory. Should there be any results, the Mosel model will write them to a file namedresult
. Both the input and result files should be read and written using thehelper
package namedfssappstudio
which comes with FICO Xpress. - The helper package reads and writes the input and results using an XML record format. The top-level element is
InputRecordList
(for inputs) orResultRecordList
(for results), which always contains a singleInputRecord
orResultRecord
. Scalars are represented as values enclosed in a named element, as shown in the following example:<?xml version="1.0"?> <InputRecordList xmlns="http://www.fico.com/input" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <InputRecord> <MyScalarValue>7.5</MyScalarValue> </InputRecord> </InputRecordList>
- Arrays are represented as a table comprised of a named element which contains multiple rec (_rec) elements that represent rows of the table. Each table row contains multiple elements representing individual cells. The following example has a table named Channels with three columns: Channel, Cost, and Capacity.
<?xml version="1.0"?> <InputRecordList xmlns="http://www.fico.com/input" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <InputRecord> <Channels> <Channels_rec> <Channel>1</Channel> <Cost>0.5</Cost> <Capacity>100</Capacity> </Channels_rec> <Channels_rec> <Channel>2</Channel> <Cost>1.2</Cost> <Capacity>50</Capacity> </Channels_rec> <Channels_rec> <Channel>3</Channel> <Cost>3</Cost> <Capacity>40</Capacity> </Channels_rec> </Channels> </InputRecord> </InputRecordList>
- Import this package by adding the following line to the top of your model:
uses "fssappstudio"
- Add the following line to register the inputs:
appsxml_import("input")
- If you have arrays named
ChannelCost
andChannelCapacity
that have a shared index setChannelIDs
, you could read them from the above XML example. To read an individual scalar value calledMyScalarValue
into the variablemyScalar
, add the following lines to your source:initialisations from appsxml_in("MyScalarValue") myScalar as "[](MyScalarValue)" end-initialisations
- Refer to the following code that displays the output:
initialisations to appsxml_out("MyResultScalarValue") myScalar as "[](MyResultScalarValue)" end-initialisations initialisations to appsxml_out("ResultChannels") [ChannelCost,ChannelCapacity] as "[](ResultChannel,ResultCost,ResultCapacity)" end-initialisations appsxml_export("result")
- The name in the brackets of
appsxml_out
refers to the table name, while the names in the as line refer to the column names. - The model results follow a similar format, except that it calls
appsxml_out
(rather thanappsxml_in
) andappsxml_export
when all the data has been written, as shown in the preceding example. - To test your model and run it locally, you will need to manually construct at least one input XML file. When running the model, two files are automatically created:
input.xsd
andresult.xsd
, which define the schemas of the input and result data-format respectively.
- The name in the brackets of
![]() |
Note: It is important that there be no overlap in the table or scalar names used in the input and result files.
|
For more information, see Mosel to Java Module reference manual and the Mosel Language Reference section on Running Models
© 2001-2023 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.