Reference manual

FICO Xpress Optimization
R

Xpress Mosel Libraries
Reference manual
Release 4.8

Last update October 2017www.fico.com

Make every decision countTM

This material is the confidential, proprietary, and unpublished property of Fair Isaac Corporation.
Receipt or possession of this material does not convey rights to divulge, reproduce, use, or allow
others to use it without the specific written authorization of Fair Isaac Corporation and use must
conform strictly to the license agreement.
The information in this document is subject to change without notice. If you find any problems inthis documentation, please report them to us in writing. Neither Fair Isaac Corporation nor its
affiliates warrant that this documentation is error-free, nor are there any other warranties withrespect to the documentation except as may be provided in the license agreement.
©2001–2017 Fair Isaac Corporation. All rights reserved. Permission to use this software and its
documentation is governed by the software license agreement between the licensee and Fair Isaac
Corporation (or its affiliate). Portions of the program may contain copyright of various authors andmay be licensed under certain third-party licenses identified in the software, documentation, orboth.
In no event shall Fair Isaac Corporation or its affiliates be liable to any person for direct, indirect,
special, incidental, or consequential damages, including lost profits, arising out of the use of thissoftware and its documentation, even if Fair Isaac Corporation or its affiliates have been advised ofthe possibility of such damage. The rights and allocation of risk between the licensee and Fair Isaac
Corporation (or its affiliates) are governed by the respective identified licenses in the software,
documentation, or both.
Fair Isaac Corporation and its affiliates specifically disclaim any warranties, including, but not limited
to, the implied warranties of merchantability and fitness for a particular purpose. The software andaccompanying documentation, if any, provided hereunder is provided solely to users licensed under
the Fair Isaac Software License Agreement. Fair Isaac Corporation and its affiliates have no
obligation to provide maintenance, support, updates, enhancements, or modifications except as
required to licensed users under the Fair Isaac Software License Agreement.
FICO and Fair Isaac are trademarks or registered trademarks of Fair Isaac Corporation in the UnitedStates and may be trademarks or registered trademarks of Fair Isaac Corporation in other countries.
Other product and company names herein may be trademarks of their respective owners.
Xpress Mosel
Deliverable Version: A
Last Revised: October 2017
Version 4.8

Contents
Introduction

1

1 Mosel Run Time Library
1.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.1.1 Initialization and termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMinit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetlicerrmsg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMfinish, XPRMfree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetdefworkdir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetlibpath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMfreelibpath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMsetdefworkdir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMsetlocaledir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMsetrestrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMsetsdmax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMremovetmpdir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetlocaledir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetsdmax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.1.2 Model management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMloadmod, XPRMloadmodsec . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMsetdefstream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMresetmod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMrunmod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMisrunmod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMstoprunmod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMtermrunmod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMunloadmod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetannotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetmodprop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetnextdep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetnextmod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMfindmod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 Post processing interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMdsotyptostr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMfindident . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMfindattrdesc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMfindtypecode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetattr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetnextanident . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetnextident . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetnextparam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetnextpbcomp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XPRMgetnextproc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2
3
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
37
38
39
40
41
42
43
44

Fair Isaac Corporation Confidential and Proprietary Informationi

Contents

XPRMgetnextreq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
XPRMgetnextattrdesc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
XPRMgetprocinfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
XPRMgettypeprop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
1.2.1 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
XPRMgetlistsize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
XPRMgetlisttype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
XPRMgetnextlistelt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
XPRMgetprevlistelt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
1.2.2 Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
XPRMgetsetsize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
XPRMgetsettype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
XPRMgetelsetval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
XPRMgetelsetndx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
XPRMgetfirstsetndx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
XPRMgetlastsetndx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
1.2.3 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
XPRMgetarrdim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
XPRMgetarrtype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
XPRMgetarrsize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
XPRMgetarrsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
XPRMgetfirstarrentry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
XPRMgetlastarrentry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
XPRMgetnextarrentry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
XPRMgetfirstarrtruentry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
XPRMgetnextarrtruentry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
XPRMchkarrind . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
XPRMcmpindices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
XPRMgetarrval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
1.2.4 Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
XPRMgetnextfield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
XPRMgetfieldval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
1.2.5 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
XPRMgetprobstat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
XPRMexportprob . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
XPRMgetobjval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
XPRMgetvsol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
XPRMgetcsol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
XPRMgetrcost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
XPRMgetdual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
XPRMgetslack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
XPRMgetact . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
XPRMgetvarnum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
XPRMgetctrnum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
XPRMselectprob . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
1.2.6 Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
XPRMfreememblk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
XPRMdate2jdn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
XPRMjdn2date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
XPRMtime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
XPRMpathcheck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
XPRMcb_sendint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
XPRMcb_sendreal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
XPRMcb_sendstring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
XPRMcb_sendctrl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

Fair Isaac Corporation Confidential and Proprietary Informationii

Contents

1.3 Debugger interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
XPRMdbg_runmod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
XPRMdbg_getnextlocal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
XPRMdbg_getlndx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
XPRMdbg_getnblndx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
XPRMdbg_getlocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
XPRMdbg_findproclndx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
XPRMdbg_setbrkp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
XPRMdbg_clearbrkp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
XPRMdbg_setstacklev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
1.4 Handling of modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
XPRMsetdsopath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
XPRMgetdsopath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
XPRMregstatdso . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
XPRMautounloaddso . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
XPRMfinddso . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
XPRMflushdso . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
XPRMgetdsoannotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
XPRMgetdsoparam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
XPRMgetnextdso . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
XPRMgetnextdsoconst . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
XPRMgetnextdsodep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
XPRMgetnextdsotype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
XPRMgetnextdsoparam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
XPRMgetnextdsoproc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
XPRMgetdsoprop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
XPRMgetnextiodrv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
XPRMpreloaddso . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
1.5 Using IO drivers for data exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
1.5.1 sysfd driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
1.5.2 cb driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
1.5.2.1 Handling of general streams . . . . . . . . . . . . . . . . . . . . . . . . 131
1.5.2.2 Handling of initializations blocks . . . . . . . . . . . . . . . . . . . . . . 132
1.5.3 mem driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
1.5.4 raw driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
1.5.5 bin driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
2 Mosel Model Compiler Library136
2.1 Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
XPRMcompmod, XPRMcompmodsec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
XPRMexecmod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

Appendix

140

A Contacting FICO
140
Product support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Product education . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Product documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Sales and maintenance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Related services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
About FICO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

Index

Fair Isaac Corporation Confidential and Proprietary Information

142

iii

Introduction
The Mosel libraries may be used to embed the Mosel environment in applications developed in a
programming language such as C.
The functions provided enable the user to:

compile source model files into binary model (bim) files

load and unload bim files handling several models at a time

execute models

access the Mosel internal database through the Post Processing Interfacemanage the dynamic shared objects used by Mosel

Two libraries are provided. The first one, the Run Time Library, contains the functionality required
to load and run models that are already compiled. The second one, the Model Compiler Library, isthe Mosel compiler that can be used to produce binary model files from source model files. In
general, only the first library is used in an application, the models being provided in their binary
form (which can be obtained using the Mosel executable).
This document gives a description of all functions included in the two libraries. For more details
about how to compile and link programs with the Mosel libraries, please refer to the examples inthe distribution of this software.

Fair Isaac Corporation Confidential and Proprietary Information

1

C HAPTER 1

Mosel Run Time Library
The Mosel Run Time (xprm_rt) Library provides a set of functions that may be used to load models
in the form of bim files, execute them and access model objects.
Programs using this library must include the header file xprm_rt.h that defines the following
types:
XPRMmodel:

reference to a model stored in core memory

XPRMdsolib:

reference to a dynamic shared object descriptor

XPRMattrdesc:

reference to an attribute descriptor

XPRMmpvar:

reference to a decision variable

XPRMlinctr:

reference to a linear constraint

XPRMset:reference to a set

XPRMlist:reference to a list

XPRMarray:reference to an array

XPRMproc:reference to a procedure or function

The following basic types are also defined for completeness:
XPRMinteger:

integer value (C type int)

XPRMreal:

real value (C type double)

XPRMboolean:

Boolean value (C type int: 0 = false, 1 = true)

XPRMstring:text string value (C type const char *)Note that all text strings handled by functions of this library are encoded in UTF-8. It is therefore
required to convert text strings to alternate encodings when exchanging data with other libraries
not working with UTF-8. In particular the C library supports either wide characters (wchar_t type)or the default system encoding (that depends on the localisation of the system). These encoding
conversions can be achieved with the help of the XPRNLS library (please refer to the XPRNLS
Reference Manual for further details).

Fair Isaac Corporation Confidential and Proprietary Information

2

Mosel Run Time Library

1.1

General1.1.1

Initialization and termination
Each program using the Mosel libraries must start with a call to XPRMinit. If a Mosel library is
loaded and unloaded dynamically at run time, the termination function XPRMfinish must be
called before unloading the library in order to release the resources Mosel is using.
XPRMfinish, XPRMfree

Finish Mosel.

p. 6

XPRMfreelibpath

Release the memory allocated by XPRMgetlibpath.

p. 9

XPRMgetdefworkdir

Get default current working directory.

p. 7

XPRMgetlibpath

Get the location of the Mosel runtime library.

p. 8

XPRMgetlicerrmsg

Get license error message.

p. 5

XPRMgetlocaledir

Get the location of the translated messages.

p. 15

XPRMgetsdmax

Get the maximum depth of a stack dump.

p. 16

XPRMgetversion

Get the version number of Mosel.

p. 17

XPRMgetversions

Get version numbers.

p. 18

XPRMinit

Initialize Mosel.

p. 4

XPRMremovetmpdir

Remove the Mosel temporary directory.

p. 14

XPRMsetdefworkdir

Set default current working directory.

p. 10

XPRMsetlocaledir

Set the location of the translated messages.

p. 11

XPRMsetrestrictions

Set execution restrictions.

p. 12

XPRMsetsdmax

Set the maximum depth of a stack dump.

p. 13

Fair Isaac Corporation Confidential and Proprietary Information

3

Mosel Run Time Library

XPRMinit
Purpose
Initialize Mosel.
Synopsis
int XPRMinit(void);
Return value
0 if executed successfully, 32 if Mosel is running in “trial mode”, other values indicate a license
error.
Further information
This function initializes Mosel. It needs to be called before any other function described in thisdocument may be executed. In case of failure, the function XPRMgetlicerrmsg may be used toobtain further information.
Related topics
XPRMfinish, XPRMgetlicerrmsg.

Fair Isaac Corporation Confidential and Proprietary Information

4

Mosel Run Time Library

XPRMgetlicerrmsg
PurposeGet license error message.
Synopsis
int XPRMgetlicerrmsg(char *msg, int maxlen);
Arguments
msg
maxlenPointer to an area where the error message is stored
Size of msg

Return value
Error code.
Further information
This function returns the last license error message.
Related topics
XPRMinit.

Fair Isaac Corporation Confidential and Proprietary Information

5

Mosel Run Time Library

XPRMfinish, XPRMfree
PurposeFinish Mosel.
Synopsis
int XPRMfinish(void);
Return value
0 if executed successfully, a non-zero value otherwise.
Further information
This function finishes a Mosel session. It unloads all modules that have been loaded, deletes theMosel temporary directory and completely frees the memory used by Mosel.
Related topics
XPRMinit.

Fair Isaac Corporation Confidential and Proprietary Information

6

Mosel Run Time Library

XPRMgetdefworkdir
PurposeGet default current working directory.
Synopsisconst char *XPRMgetdefworkdir(void);
Return value
The current working directory or NULL.
Further information
1. The returned value may be NULL indicating that the process wide current working directory isused for this parameter.
2. This information can also be obtained using XPRMgetdsoparam asking for the "workdir" parameter.
Related topics
XPRMsetdefworkdir.

Fair Isaac Corporation Confidential and Proprietary Information

7

Mosel Run Time Library

XPRMgetlibpath
PurposeGet the location of the Mosel runtime library.
Synopsisconst char *XPRMgetlibpath(void);
Return value
The directory where the Mosel runtime library is stored.
Further information
1. The returned string is statically allocated the first time the function is called: the routines
XPRMinit (upon failure) and XPRMfinish will release this memory block. It is also possible to free
the allocated memory explicitly by calling XPRMfreelibpath.
2. This function may be called before Mosel has been initialised with XPRMinit.
Related topics
XPRMgetdsopath.

Fair Isaac Corporation Confidential and Proprietary Information

8

Mosel Run Time Library

XPRMfreelibpath
Purpose
Release the memory allocated by XPRMgetlibpath.
Synopsisvoid XPRMfreelibpath(void);
Further information
This function is automatically called by XPRMinit (when it fails) and XPRMfinish.
Related topics
XPRMsetdsopath.

Fair Isaac Corporation Confidential and Proprietary Information

9

Mosel Run Time Library

XPRMsetdefworkdir
PurposeSet default current working directory.
Synopsis
int XPRMsetdefworkdir(const char *path);Argumentpath

New working directory or NULL

Return value
0 if successful, 1 otherwise.
Further information
1. Except for absolute file names, path resolution is relative to the current working directory
defined by a call to this routine. This parameter is also used as the initial working directory whenstarting the execution of a model.
2. If the provided path is NULL (the default value after library initialisation) or an empty string, thesystem uses the current working directory of the process as provided by the operating system.
Using this routine has no effect on the process wide current working directory.
3. The provided path is expanded (i.e. it can be relative to the current directory) and tested
according to the current restriction settings (see XPRMsetrestrictions). If the restriction NoRead is
active, this routine always fails and the current working directory is automatically set to theMosel temporary directory.
Related topics
XPRMgetdefworkdir.

Fair Isaac Corporation Confidential and Proprietary Information

10

Mosel Run Time Library

XPRMsetlocaledir
PurposeSet the location of the translated messages.
Synopsisvoid XPRMsetlocaledir(const char *localedir);Argument
localedir

Path to the NLS directory

Further information
This function can be used to specify the location of the translated messages (native language
support) if they are not stored in the usual place.
Related topics
XPRMgetlocaledir.

Fair Isaac Corporation Confidential and Proprietary Information

11

Mosel Run Time Library

XPRMsetrestrictions
PurposeSet execution restrictions.
Synopsis
int XPRMsetrestrictions(unsigned int restr);
Argument
restr

Restrictions as a bit encoded integer. The following values can be combined:
XPRM_RESTR_NOWRITE
Disable write access
XPRM_RESTR_NOREAD
Disable read access (implies XPRM_RESTR_NOWRITE)
XPRM_RESTR_NOEXECDisable routines allowing to execute external commands
XPRM_RESTR_WDONLY
Restrict disk access to current working directory
XPRM_RESTR_NOTMPDisable temporary directory
XPRM_RESTR_NODBDisable database access

Return value
0 if successful, 1 otherwise.
Further information
1. This routine activates the restricted mode by setting the restrictions to be applied. Retrictions canbe set only once just after the library has been initialised (using XPRMinit), the routine will fail ifcalled at a later stage.
2. If XPRM_RESTR_NOREAD is used, the restriction XPRM_RESTR_NOWRITE is implicitly selected and accessto the local disk is disabled except for the temporary directory which becomes the current
working directory. To disable entirely disk access to the local system, XPRM_RESTR_NOTMP has also to
be selected.
3. The current active restrictions can be obtained using XPRMgetdsoparam asking for parameter"restrict".
Related topics
XPRMsetdefworkdir.

Fair Isaac Corporation Confidential and Proprietary Information

12

Mosel Run Time Library

XPRMsetsdmax
PurposeSet the maximum depth of a stack dump.
Synopsisvoid XPRMsetsdmax(int sdmax);
Argument
sdmax

maximum number of levels to report

Further information
After a runtime error Mosel may report the content of the call stack for debugging purposes. Thisfunction defines the maximum number of levels to display in such a case. Using a value smaller
than 1 disables stack dumps (this is the default).
Related topics
XPRMgetsdmax.

Fair Isaac Corporation Confidential and Proprietary Information

13

Mosel Run Time Library

XPRMremovetmpdir
PurposeRemove the Mosel temporary directory.
Synopsis
int XPRMremovetmpdir(void);
Return value
0 if successful, 1 otherwise
Further information
1. This function can be called only when no model is being executed and if the default working
directory is not a subdirectory of the temporary directory.
2. The Mosel temporary directory is also removed by XPRMfinish.
Related topics
XPRMsetdefworkdir.

Fair Isaac Corporation Confidential and Proprietary Information

14

Mosel Run Time Library

XPRMgetlocaledir
PurposeGet the location of the translated messages.
Synopsisconst char *XPRMgetlocaledir(void);
Return value
Path to the NLS directory
Related topics
XPRMsetlocaledir.

Fair Isaac Corporation Confidential and Proprietary Information

15

Mosel Run Time Library

XPRMgetsdmax
PurposeGet the maximum depth of a stack dump.
Synopsis
int XPRMgetsdmax(void);
Return value
Maximum number of levels reported in a stack dump
Related topics
XPRMsetsdmax.

Fair Isaac Corporation Confidential and Proprietary Information

16

Mosel Run Time Library

XPRMgetversion
PurposeGet the version number of Mosel.
Synopsisconst char *XPRMgetversion(void);
Return value
The version number of Mosel as a text string.
Further information
This function returns the version number of Mosel.

Fair Isaac Corporation Confidential and Proprietary Information

17

Mosel Run Time Library

XPRMgetversions
PurposeGet version numbers.
Synopsis
int XPRMgetversions(int whichone);
Argument
whichone

Version number to return:0
Version of Mosel
1
Version of BIM format
2
Version of Native Interface

Return value
The version number requested or 0 in case of error.
Further information
This function returns the version number of Mosel, the Native Interface or BIM file format innumerical form. For instance for the Mosel version 1.2.1, the returned value is 1002001.

Fair Isaac Corporation Confidential and Proprietary Information

18

Mosel Run Time Library

1.1.2

Model management
The following functions are required to manipulate models loaded in core memory: loading,running or unloading a model, getting information. Several models may be loaded in a single
session of Mosel and used alternatively: each function requires a model (type XPRMmodel) as
parameter to designate on which of the loaded models the operation is to be performed. Thisobject of type XPRMmodel is returned by the function XPRMloadmod when a model has beensuccessfully read from a bim (= binary model) file1 .
XPRMfindmod

Find a model by its name or order number.

p. 32

XPRMgetannotations

Retrieve annotations of a model.

p. 28

XPRMgetmodprop

Get a property of a model.

p. 29

XPRMgetnextdep

Enumerate dependencies of a model.

p. 30

XPRMgetnextmod

Get the next model.

p. 31

XPRMisrunmod

Check if a model is running.

p. 24

XPRMloadmod, XPRMloadmodsec Load a Binary Model file.

p. 20

XPRMresetmod

Reset a model.

p. 22

XPRMrunmod

Run a model.

p. 23

XPRMsetdefstream

Set default input/output streams.

p. 21

XPRMstoprunmod

Stop a running model.

p. 25

XPRMtermrunmod

Terminate execution of a model.

p. 26

XPRMunloadmod

Unload a model.

p. 27

1 bim files are produced by the Mosel compiler either by using the command line interpreter or with the Model Compiler
Library.

Fair Isaac Corporation Confidential and Proprietary Information

19

Mosel Run Time Library

XPRMloadmod, XPRMloadmodsec
PurposeLoad a Binary Model file.
Synopsis
XPRMmodel XPRMloadmod(const char *bname, const char *intname);
XPRMmodel XPRMloadmodsec(const char *bname, const char *intname, const char *flags,
const char *passfile, const char *privkey, const char *keys);
Arguments
bname
intnameflags

passfile
privkeykeys

Name of a binary model file
Internal name (may be NULL)
Loading options (may be NULL, options may be separated by spaces or ’-’ symbols):"c"
Check signature (if the file is signed)"V"
If the file is signed, load it only if the signature is valid"T"
Load only signed files with a valid signature"F"
The argument passfile is a file name (not the password itself)
Password or password file (for encrypted bim files)
Private key file (for encrypted bim files)
File of public keys

Return value
Reference to the model that has been loaded or NULL.
Further information
1. This function returns the reference of a new model instance created from a binary model file. The
second form of the function will be used to load encrypted and/or signed bim files if additional
information has to be provided. While loading a model from a file, Mosel also automatically
opens any additional modules that are required by this model. If an internal name is provided, it
is used in place of the name stored in the bim file. If a model already existing in core memory (i.e.
with the same internal name) is loaded a second time, the first instance of this model is deleted
and a reference to the newly created model is returned. If model name or provided internalname is "*", a unique name is automatically generated using pattern "model_#" where # is ahexadecimal number. If the loaded model has no name (empty string) and no internal name isprovided, string "(none)" is used as a default.
2. The argument keys is a list of public key files (i.e. each line of the file is a key file name): when asigned bim file is loaded, its signature is checked with the keys listed in this file. If this argument
is not specified, the signing key is searched in the default public keys directory located at
getparam("ssl_dir")+"/pubkeys".
Related topics
XPRMrunmod, XPRMdbg_runmod, XPRMunloadmod.

Fair Isaac Corporation Confidential and Proprietary Information

20

Mosel Run Time Library

XPRMsetdefstream
PurposeSet default input/output streams.
Synopsis
int XPRMsetdefstream(XPRMmodel model, int wmd, const char *filename);
Arguments
model
wmd

filename

Reference to a model or NULL
Stream to set. Possible values:
XPRM_F_READ
Default input stream
XPRM_F_WRITE
Default output stream
XPRM_F_ERROR
Default error stream
XPRM_F_LINBUF
Use line buffering
Extended file name to be used for the stream.

Return value
0 if successful, 1 otherwise.
Further information
1. This function sets default IO streams to be used by a model or by the entire system. Model
streams can be changed only when the model is not running. Each stream is associated to an
extended file name (i.e. IO drivers can be used). For output streams, XPRM_F_LINBUF may be
specified (e.g.XPRM_F_WRITE+XPRM_F_LINBUF) in order to enable line buffering for thecorresponding stream (the error stream is always open using line buffering).
2. For input and output streams, the filename is stored and streams are actually open when
execution of the model starts: in case of an invalid file name, the error is not reported by thisfunction. The error stream is immediately opened so in the case of an invalid file name isdetected by this function. If the first parameter is NULL, this function defines the corresponding
global stream: it is used as the default when a model is loaded and whenever no model
information is available (e.g. compilation errors, error on modules, etc.). This option can be used
only if no model is currently loaded in memory.
3. Using an empty string as the file name implies resetting to the original default stream: for amodel this is the corresponding global stream, if no model is provided, this is the operating
system stream.

Fair Isaac Corporation Confidential and Proprietary Information

21

Mosel Run Time Library

XPRMresetmod
PurposeReset a model.
Synopsisvoid XPRMresetmod(XPRMmodel model);Argument
model

Reference to a model

Further information
This function resets a model after its execution: all resources it has allocated are released. The
model returns to its state just after it has been loaded into memory. Note that this function is
automatically called before a model is unloaded or run.
Related topics
XPRMrunmod, XPRMdbg_runmod, XPRMunloadmod.

Fair Isaac Corporation Confidential and Proprietary Information

22

Mosel Run Time Library

XPRMrunmod
PurposeRun a model.
Synopsis
int XPRMrunmod(XPRMmodel model, int *returned, const char *parlist);
Arguments
model
returnedparlistReference to a model
Pointer to an area where the result value is returned
String composed of model parameter initializations separated by commas, may be
NULL

Return value
XPRM_RT_OK Normal termination
XPRM_RT_ERROR An error occured during execution
XPRM_RT_MATHERR Mathematical error (e.g. division by zero)
XPRM_RT_IOERR Input/output error (e.g. cannot open file)
XPRM_RT_NULL A NULL reference error occurred
XPRM_RT_LICERR Execution could not start because no license was available
XPRM_RT_STOP Bit set if execution has been interrupted
XPRM_RT_BREAK Interruption because of a breakpoint (see Section 1.3)
Further information
This function executes the given model. The parameter parlist may be used to initialize themodel parameters of the model/program (e.g. "PAR1=12,PAR2=’tutu’"). The special model
parameter workdir defines the initial working directory of the model. The parameter returned
receives the result of the execution (e.g. parameter value of the “exit” procedure). The bit
XPRM_RT_STOP is set if the execution of the model has been interrupted by a call to the function
XPRMstoprunmod.
Related topics
XPRMdbg_runmod, XPRMisrunmod, XPRMstoprunmod.

Fair Isaac Corporation Confidential and Proprietary Information

23

Mosel Run Time Library

XPRMisrunmod
PurposeCheck if a model is running.
Synopsis
int XPRMisrunmod(XPRMmodel model);Argument
model

Reference to a model

Return value
1 if the model is running, 0 otherwise.
Further information
This function checks if the given model is being run.
Related topics
XPRMrunmod, XPRMdbg_runmod, XPRMstoprunmod.

Fair Isaac Corporation Confidential and Proprietary Information

24

Mosel Run Time Library

XPRMstoprunmod
PurposeStop a running model.
Synopsisvoid XPRMstoprunmod(XPRMmodel model);Argument
model

Reference to a model

Further information
This function interrupts the execution of a model.
Related topics
XPRMisrunmod, XPRMrunmod, XPRMdbg_runmod, XPRMtermrunmod.

Fair Isaac Corporation Confidential and Proprietary Information25

Mosel Run Time Library

XPRMtermrunmod
PurposeTerminate execution of a model.
Synopsisvoid XPRMtermrunmod(XPRMmodel model);Argument
model

Reference to a model

Further information
This function terminates the execution of a model. The termination is effective even if adebugger is controlling the model.
Related topics
XPRMisrunmod, XPRMrunmod, XPRMstoprunmod, XPRMdbg_runmod.

Fair Isaac Corporation Confidential and Proprietary Information

26

Mosel Run Time Library

XPRMunloadmod
Purpose
Unload a model.
Synopsis
int XPRMunloadmod(XPRMmodel model);Argument
model

Reference to a model

Return value
0 if successful, 1 otherwise.
Further information
This function unloads the given model. All resources used by this model, including modules, arereleased. The function fails if the model is being run.
Related topics
XPRMloadmod.

Fair Isaac Corporation Confidential and Proprietary Information

27

Mosel Run Time Library

XPRMgetannotations
PurposeRetrieve annotations of a model.
Synopsis
int XPRMgetannotations(XPRMmodel model, const char *ident, const char *prefix, const
char **ann, int maxann);
Arguments
model
ident
prefixannmaxannReference to a model
Symbol to be considered or NULL for global declarations
Filtering prefix
Array of size maxann where to store the annotations (can be NULL)
Size of ann (to get up to maxann/2 annotations)

Return value
Size of the array required to get all annotations (two times the number of found annotations).
Further information
1. This function retrieves the annotations associated to the given symbol using a prefix as a filter(e.g. use "doc." to get all the documentation annotations). The result is stored in the provided
array: each annotation occupies 2 entries in the array (the first one for the name of theannotation and the following one for its value).
2. The returned value may exceed maxann (but no more than maxann entries are recorded in thearray). To get the required size for ann the function may be called with a NULL array.
Related topics
XPRMgetnextanident, XPRMgetdsoannotations.

Fair Isaac Corporation Confidential and Proprietary Information

28

Mosel Run Time Library

XPRMgetmodprop
PurposeGet a property of a model.
Synopsis
int XPRMgetmodprop(XPRMmodel model, int prop, XPRMalltypes *value);
Arguments
model
prop

value

Reference to a model
Property to retrieve. Possible values:
XPRM_PROP_NAME
Model name (cf. model statement)
XPRM_PROP_ID
Order number
XPRM_PROP_VERSION
Model version
XPRM_PROP_SYSCOM
System comment
XPRM_PROP_USRCOM
User comment
XPRM_PROP_SIZE
Amount of memory (in bytes) used by the model
XPRM_PROP_DATECompilation date
XPRM_PROP_SECSTATSecurity status
XPRM_PROP_SKEYFP
Key fingerprint (if the bim file was signed)
XPRM_PROP_NBTYPES
Number of types
XPRM_PROP_UNAME
Unique model name
Pointer to an area where the model property is returned

Return value
0 if successful, 1 otherwise.
Further information
1. This function returns information about a given model. The type of the property (specified via
the prop argument) decides how the argument value is interpreted: the field integer is used for
ID, VERSION, SECSTAT and NBTYPES; size for SIZE and DATE (should be casted to the C type time_t);
and string for the other properties. The returned version number is coded as an integer, forexample, 1.2.3 is coded as 1002003.
2. The security status is a bit encoded integer indicating whether the bim file was encrypted (value
XPRM_SECSTAT_CRYPTED); signed (value XPRM_SECSTAT_SIGNED). If the bimfile was signed, the bits
XPRM_SECSTAT_VERIFIED and XPRM_SECSTAT_UNVERIFIED indicate whether the signature was valid(if none of these bits is set the signature was not checked).

Fair Isaac Corporation Confidential and Proprietary Information

29

Mosel Run Time Library

XPRMgetnextdep
PurposeGet the next dependency (module or package) of a model.
Synopsisvoid *XPRMgetnextdep(XPRMmodel model, void *ref, const char **name,int *version, int *dso_pkg);
Arguments
model
ref
name
versiondso_pkg

Reference to a model
Reference pointer or NULL
Returned name of the package/module
Returned version of the package/module
Returned type of the dependency: 1 for a package and 0 for a module

Return value
Reference pointer for the next call to XPRMgetnextdep.
Further information
This function returns the next dependency of a model: model dependencies are the packages it
includes and the modules it requires. The second parameter is used to store the current locationin the table of dependencies; if this parameter is NULL, the first dependency of the table isreturned. This function returns NULL if it is called with the reference to the last dependency
defined by the given model. Otherwise, the returned value can be used as the input parameter
ref to get the following dependency and so on. Note that this function allocates memory when it
is called for the first time and releases the allocated data when all items have been returned (i.e.
the function returns NULL).

Fair Isaac Corporation Confidential and Proprietary Information

30

Mosel Run Time Library

XPRMgetnextmod
PurposeGet the next model.
Synopsis
XPRMmodel XPRMgetnextmod(XPRMmodel model);Argument
model

Reference to a model or NULL

Return value
Reference to a model or NULL .
Further information
Mosel maintains a list of loaded models. This function returns the next model held in the internal
list after the given model. If the input parameter is set to NULL, the first model in the list isreturned. If the given model is the last in the list, NULL is returned.

Fair Isaac Corporation Confidential and Proprietary Information

31

Mosel Run Time Library

XPRMfindmod
PurposeFind a model by its name or order number.
Synopsis
XPRMmodel XPRMfindmod(const char *name, int number);
Arguments
namenumberName of a model or NULL
Model order number or -1

Return value
Reference to a model or NULL if the model does not exist.
Further information
In the list of loaded models, each model is characterised by its internal name (the name stored in
the bim file, not the filename) and an order number (this number is automatically assigned to themodel when it is loaded). This function returns a model that is identified either by its name(number = -1) or by its order number (name = NULL). If both parameters are defined, the function
returns a pointer to the model defined by name.
Related topics
XPRMfindmod.

Fair Isaac Corporation Confidential and Proprietary Information

32

Mosel Run Time Library

1.2

Post processing interface
The post processing interface gives easy access to the internal database of Mosel. This database iscomposed of all model objects that are defined in a bim file (like constants) or created during theexecution of a model (like arrays). Obviously the dynamically created objects are only available
after the model has been run.
Note that the dictionary is not available if the model has been compiled with the option “s” (strip
symbols) and no identifier has been explicitly published (refer to the description of the public
qualifier in declarations): such a model cannot be accessed through the post processing interface.
XPRMdsotyptostr

Get a string representation from an external type reference.

p. 34

XPRMfindattrdesc

Find an attribute descriptor from its name.

p. 37

XPRMfindident

Find an identifier in the dictionary.

p. 35

XPRMfindtypecode

Find the code associated to a type.

p. 38

XPRMgetattr

Get an attribute of an entity.

p. 39

XPRMgetnextanident

Get the next annotated identifier in the dictionary.

p. 40

XPRMgetnextattrdesc

Get the next attribute descriptor.

p. 46

XPRMgetnextident

Get the next identifier in the dictionary.

p. 41

XPRMgetnextparamGet the next parameter of the model.

p. 42

XPRMgetnextpbcomp

Enumerate components of a problem type.

p. 43

XPRMgetnextproc

Get the next overloaded version of a procedure or function.

p. 44

XPRMgetnextreq

Enumerate requirements of a package.

p. 45

XPRMgetprocinfo

Get the procedure/function information.

p. 47

XPRMgettypeprop

Get a property of a type.

p. 48

Fair Isaac Corporation Confidential and Proprietary Information

33

Mosel Run Time Library

XPRMdsotyptostr
PurposeGet a string representation from an external type reference.
Synopsis
int XPRMdsotyptostr(XPRMmodel model,int type, void *value, char *str,
int size);
Arguments
model
type
value
str
size

Reference to a model
Code of the external type
Entity to convert
Destination string
Maximum length of the string

Return value
Size of the generated string or -1 in case of error.
Further information
1. This function converts an entity of an external type into its textual representation. If the typedoes not support this convertion, the function produces a string using the address of the entity.
2. The returned length might be larger than size. In this case this return value is the minimum
buffer size required to generate the text representation and the destination string str is not
populated.

Fair Isaac Corporation Confidential and Proprietary Information

34

Mosel Run Time Library

XPRMfindident
PurposeFind an identifier in the dictionary.
Synopsis
int XPRMfindident(XPRMmodel model, const char *text,
XPRMalltypes *value);
Arguments
model
text
value

Reference to a model
Identifier
Pointer to an area where the dictionary entry is returned

Return value
Type and structure of the returned dictionary entry, or 0 if the identifier is not registered.
Further information
This function returns the dictionary entry of a given identifier for a given model, together withthe type and structure of the entry. Type and structure are bit encoded and can be extractedusing the macros XPRM_TYP(t) and XPRM_STR(t).
The possible structures are:
XPRM_STR_CONST the object is a constant
XPRM_STR_REF the object is a reference to a scalar
XPRM_STR_LIST the object is a list
XPRM_STR_SET the object is a set
XPRM_STR_ARR the object is an array
XPRM_STR_PROC the object is a procedure or function
XPRM_STR_MEM the object is a memory block
XPRM_STR_UTYP the object is a user defined type
Depending on the structure, the possible types are:
XPRM_TYP_NOT no type (procedure or list)
XPRM_TYP_INT integer (constant, reference, list, set, array, function)
XPRM_TYP_REAL real (constant, reference, list, set, array, function)
XPRM_TYP_STRING text string (constant, reference, set, array, function)
XPRM_TYP_BOOL Boolean (constant, reference, list, set, array, function)
XPRM_TYP_MPVAR decision variable (reference, list, set, array)
XPRM_TYP_LINCTR linear constraint (reference, list, set, array)
Any other value designates an external type (type provided by a module or defined in the model).
Moreover, if the structure is XPRM_STR_UTYP, the identifier is the name of a user type and the value(an integer) corresponds to the expanded code of this type (see XPRMgettypeprop). Otherwise, thefunction XPRMgettypeprop can be used to get the name and the properties of this type.
The union XPRMalltypes groups all possible types and the result of a call to XPRMfindident is
decoded as follows depending on the structure:value.integer for constant, reference or user typevalue.real for constant or reference
value.string for constant or reference
value.boolean for constant or reference
value.mpvar for reference
value.linctr for reference

Fair Isaac Corporation Confidential and Proprietary Information

35

Mosel Run Time Libraryvalue.list for list (to be used as input for list functions)value.set for set (to be used as input for set functions)value.array for array (to be used as input for array functions)value.ref for a reference to an external type (available operations depend on the actual type)value.proc for procedure and function
value.memblk for memory block
Memory blocks are generated by the mem IO driver when used with a label. Blocks created this way
can be found using the label: the name is linked to the following structure describing the block:
typedef struct{
void *ref;size_t size;} XPRMmemblk;/* Base address of the block *//* Size of the block */Note that memory blocks allocated by Mosel are managed by the memory manager of the IO
driver and must not be explicitly released.
Related topics
XPRMgetnextident, XPRMdbg_getnextlocal, XPRMgettypeprop.

Fair Isaac Corporation Confidential and Proprietary Information

36

Mosel Run Time Library

XPRMfindattrdesc
PurposeFind an attribute descriptor from its name.
Synopsis
XPRMattrdesc XPRMfindattrdesc(XPRMmodel model, int type, const char **name, int*atype);Arguments
model
type
name

Reference to a modelType number for the attributeName of the attribute

Return value
Reference pointer to an attribute descriptor or NULL if no corresponding function could be found.
Further information
The attribute att of an entity of type T is obtained by calling the function getatt returning an
integer, a string, a real or a Boolean and taking as its only argument an entity of type T. Thisroutine returns a descriptor of such a function that can be used with XPRMgetattr in order toretrieve the corresponding attribute of an entity of the corresponding type.
Related topics
XPRMgetnextattrdesc, XPRMgetattr.

Fair Isaac Corporation Confidential and Proprietary Information

37

Mosel Run Time Library

XPRMfindtypecode
PurposeFind the code associated to a type.
Synopsis
int XPRMfindtypecode(XPRMmodel model, const char *name);
Arguments
model
name

Reference to a model
Name of a type

Return value
The type code or -1 if the type cannot be found.
Further information
Each external type (user defined or coming from a module) is identified by a type code. Thisroutine returns the code corresponding to a type name.
Related topics
XPRMgettypeprop.

Fair Isaac Corporation Confidential and Proprietary Information

38

Mosel Run Time Library

XPRMgetattr
PurposeGet an attribute of an entity.
Synopsis
int XPRMgetattr(XPRMmodel model, XPRMattrdesc attrdesc, void *ref, XPRMalltypes*value);Arguments
model
attrdescrefvalue

Reference to a model
An attribute descriptor
An entity of the type associated to the attribute
Pointer to an area where the value of the attribute is returned

Return value
Type number of the returned value or 0 in case of error.
ExampleThe following example displays the reduced cost of variable x.
XPRMalltypes x,rcost;
XPRMattrdesc getrcost;
XPRMfindident(model,"x",&x);
getrcost=XPRMfindattrdesc(model,XPRM_TYP_MPVAR,"rcost");
XPRMgetattr(model,getrcost,x.ref,&rcost);
printf("getrcost(x)=%g\n",rcost.real);
Further information
1. This function makes it possible to retrieve an attribute of an entity using a type descriptor as
returned by XPRMfindattrdesc.
2. The internal list of types attributes is deleted each time the model is run or reset: descriptors
obtained before a model execution should not be used after the model has been run.
Related topics
XPRMgetnextattrdesc, XPRMfindattrdesc.

Fair Isaac Corporation Confidential and Proprietary Information

39

Mosel Run Time Library

XPRMgetnextanident
PurposeGet the next annotated identifier in the dictionary.
Synopsisconst char *XPRMgetnextanident(XPRMmodel model, void **ref);Arguments
model
ref

Reference to a model
Pointer to an area where current location is stored

Return value
An identifier of the symbol table or NULL if all identifiers have been returned.
Further information
This function returns the next identifier for which annotations are available. The second
parameter is used to store the current location in the table; this reference is updated with every
call to this function. If this parameter references a NULL pointer, the first identifier of the table isreturned. This function returns NULL if it is called with the reference to the last identifier in theinternal table.
Related topics
XPRMgetnextident, XPRMgetannotations.

Fair Isaac Corporation Confidential and Proprietary Information

40

Mosel Run Time Library

XPRMgetnextident
PurposeGet the next identifier in the dictionary.
Synopsisconst char *XPRMgetnextident(XPRMmodel model, void **ref);Arguments
model
ref

Reference to a model
Pointer to an area where current location is stored

Return value
An identifier of the symbol table or NULL if all identifiers have been returned.
Further information
1. This function returns the next identifier held in the internal table of symbols. The second
parameter is used to store the current location in the table; this reference is updated with every
call to this function. If this parameter references a NULL pointer, the first identifier of the table isreturned. This function returns NULL if it is called with the reference to the last identifier in theinternal table.
2. The compiler generates automatic names for constant sets (identifiers start with "@") andanonymous types (identifiers start with "%"). This function reports only automatic names of sets,
however the other symbols can be accessed using XPRMfindident.
3. When the model or package is compiled with debug information included, local symbols ofimported packages are also available (and listed through this function). In order to avoid namecollisions each symbol local to a package is prefixed by the package name and the symbol ˜. For
instance the symbol myctr defined in the package mypkg is stored as mypkg˜myctr.
4. This function enumerates only globally defined symbols. To get a list of local symbols (like a loop
index) during a debugging session use XPRMdbg_getnextlocal.
Related topics
XPRMdbg_getnextlocal, XPRMfindident.

Fair Isaac Corporation Confidential and Proprietary Information

41

Mosel Run Time Library

XPRMgetnextparam
PurposeGet the next parameter of the model.
Synopsisconst char *XPRMgetnextparam(XPRMmodel model, void **ref);Arguments
model
ref

Reference to a model
Pointer to an area where current location is stored

Return value
The name of the parameter or NULL if there is no subsequent parameter.
Further information
This function returns the next parameter of the given model. The second argument is used tostore the current location in the list of parameters; this reference is updated with every call to thisfunction. If this argument references a NULL pointer, the first parameter of the model is returned.
This function returns NULL if it is called with the reference to the last parameter in the model as
its second argument.

Fair Isaac Corporation Confidential and Proprietary Information

42

Mosel Run Time Library

XPRMgetnextpbcomp
PurposeGet the next component of a problem type.
Synopsisvoid *XPRMgetnextpbcomp(XPRMmodel model, void *ref, int typcode,
int *type);
Arguments
model
reftypcodetype

Reference to a model
Reference pointer or NULL
Type code
Returned type of the component

Return value
Reference pointer for the next call to XPRMgetnextpbcomp.
Further information
1. Problem types are composed by a collection of components (typically one or more main types andthe associated extensions) each of which being a native problem type. This function returns thenext component of a problem type. The type returned by the function can be decoded in thesame way as for a type returned by XPRMfindident. The second parameter is used to store thecurrent location in the table of components of the type; if this parameter is NULL, the firstcomponent of the table is returned. This function returns NULL if it is called with the reference tothe last component for the given problem type. Otherwise, the returned value can be used as the
input parameter ref to get the following component and so on.
2. The routine will return a type 0 as the first component of problem types including an mpproblem
component.
3. A problem type has at least one component: the first component of a native type is the type itself(i.e. the parameter type receives the value of typcode).

Fair Isaac Corporation Confidential and Proprietary Information

43

Mosel Run Time Library

XPRMgetnextproc
PurposeGet the next overloaded version of a procedure or function.
Synopsis
XPRMproc XPRMgetnextproc(XPRMproc proc);
Argument
proc

Reference to a procedure or function

Return value
A procedure or function reference or NULL if no overloading subroutine is defined.
Further information
This function returns the following overloading defined for the given subroutine. A subroutine
may be defined several times in a model with different sets of parameters. This function gives
access to all the defined overloaded versions of a subroutine.
Related topics
XPRMgetprocinfo.

Fair Isaac Corporation Confidential and Proprietary Information

44

Mosel Run Time Library

XPRMgetnextreq
PurposeGet the next requirement of a package.
Synopsisvoid *XPRMgetnextreq(XPRMmodel model, void *ref, const char **name,int *type,void **data);
Arguments
model
ref
name
type
data

Reference to a model
Reference pointer or NULL
Returned name of the requirement
Returned type
Returned extra data for the type

Return value
Reference pointer for the next call to XPRMgetnextreq.
Further information
This function returns the next requirement of a package: requirements of a package are thesymbols it declares but that must be defined by the model using it. The type returned by thefunction can be decoded in the same way as for a type returned by XPRMfindident. The
information returned via the last argument depends on the type: for a scalar, a set or a list a NULL
pointer is returned; for an array the list of the names of the indexing sets is returned through atext string (for instance the array a:array(S1,S2) has the following data string: "S1,S2"). In thecase of a subroutine, an XPRMproc reference is provided: this can be used with XPRMgetprocinfo
for getting information on the required routine. The second parameter is used to store thecurrent location in the table of requirements; if this parameter is NULL, the first requirement of
the table is returned. This function returns NULL if it is called with the reference to the lastrequirement defined by the given model. Otherwise, the returned value can be used as the input
parameter ref to get the following requirement and so on.

Fair Isaac Corporation Confidential and Proprietary Information

45

Mosel Run Time Library

XPRMgetnextattrdesc
PurposeGet the next attribute descriptor.
Synopsis
XPRMattrdesc XPRMgetnextattrdesc(XPRMmodel model,XPRMattrdesc ref,int *ntype,const
char **name,int *atype);
Arguments
model
ref
ntype
name
atype

Reference to a model
Reference an attribute descriptor or NULL
Type number supporting the attribute (may be NULL)
Name of the attribute (may be NULL)
Type of the attribute (may be NULL)

Return value
Reference pointer for the next attribute descriptor or NULL if no further descriptor is available.
Further information
1. This function is used to enumerate attribute descriptors of a model. The second parameter is used
to store the current location in the list of descriptors; if this parameter is NULL, the first descriptorof the list is returned. This function returns NULL if it is called with the reference to the lastdescriptor. Otherwise, the returned value can be used as the input parameter ref to get thefollowing descriptor and so on.
2. The name, ntype and atype are the returned attribute properties associated to the provided
descriptor ref.
Related topics
XPRMfindattrdesc, XPRMgetattr.

Fair Isaac Corporation Confidential and Proprietary Information

46

Mosel Run Time Library

XPRMgetprocinfo
PurposeGet the procedure/function information.
Synopsis
int XPRMgetprocinfo(XPRMproc proc, const char **partyp, int *nbpar,
int *type);
Arguments
proc
partypnbpar
type

Reference to a procedure or function
Returned string of parameter types
Returned number of parameters
Returned type of the function or XPRM_TYP_NOT for a procedure

Return value
0 if successful, 1 otherwise.
Further information
This function provides information about a procedure or function. The type can be decoded likefor any other identifier of a model. Note that a procedure has no return type
(type=XPRM_TYP_NOT). The string of parameter types is a text string describing which parameters
are expected by the function, it is its signature. This string is composed with the following
characters:ian integerra realsa text stringba Booleanv
a decision variable (type mpvar)ca linear constraint (type linctr)Ia range setaan array (of any kind)ea set (of any type)l
a list (of any type)|xxx| external type named ‘xxx’. A type code may also be given as ‘%???’ where ‘???’ (3hexadecimal digits) is the code number!xxx! the set named ‘xxx’
Andx.t an array indexed by ‘ndx’ of the type ‘t’. ‘ndx’ is a string describing the type of eachindexing set. ‘ndx’ may be omitted in which case any array of type ‘t’ is a valid parameter.
Et
a set of type ‘t’Lt
a list of type ‘t’*function with variable number of parameters (this character is the last one of the string)
For instance, the procedure:proc(n:integer,
tab:array(range, set of real, myset) of string,
flag:boolean)

has the signature “iAIr!myset!.sb”.
Related topics
XPRMgetnextproc.

Fair Isaac Corporation Confidential and Proprietary Information

47

Mosel Run Time Library

XPRMgettypeprop
PurposeGet a property of a type.
Synopsisvoid *XPRMgettypeprop(XPRMmodel model, int type,
int prop, XPRMalltypes *value);
Arguments
model
type
prop

value

Reference to a model
Code of a type
Property to retrieve. Possible values:
XPRM_TPROP_NAME
Name of the type
XPRM_TPROP_FEAT
Encoded features
XPRM_TPROP_EXP
Expanded code
XPRM_TPROP_PBID
Problem index (-1 if the type is not a problem)
Pointer to an area where the type property is returned

Return value
0 if successful, -1 if type is not valid and 1 if prop is not supported.
Further information
1. This function returns a property of an external type (types provided by modules or user defined).
For the property XPRM_TPROP_NAME, the type name is returned in value->string, for the 3 otherproperties, the result is returned in value->integer.
2. The type features are bit encoded as follows:
XPRM_MTP_CREAT Creation function available for this type
XPRM_MTP_DELET Deletion function available for this type
XPRM_MTP_TOSTR Type can be converted to a string
XPRM_MTP_FRSTR Type can be initialized from a string
XPRM_MTP_PRTBL Type can be converted to a string after execution
XPRM_MTP_RFCNT Type implements reference count
XPRM_MTP_COPY Type implements copy: it may be used in assignments
XPRM_MTP_APPND The copy function of this type supports appending
XPRM_MTP_ORSET The copy function of this type can only be used to reset an object
XPRM_MTP_PROB Type is a problem
3. The expanded code is available for user defined types only: it corresponds to the actual type code
associated to a user defined type. For instance, assuming the type myset is defined as a set of
integer, getting the type expansion for the code associated to myset will give
XPRM_STR_SET|XPRM_TYP_INT indicating that a reference to an entity of type myset has to behandled with functions for sets.
4. Trying to get the expanded code of a module type or the features of a user defined type is anerror: the function returns 1. This can be used to identify module types.
5. A user type which expanded code is XPRM_STR_REC is a record type. The public fields of a record
type may be enumerated with XPRMgetnextfield.
6. A user type which expanded code is XPRM_STR_PROB is a problem type. The components of aproblem type may be enumerated with XPRMgetnextpbcomp. Note that problem types are also
implemented as native types. In this case, the flag XPRM_MTP_PROB will be set in the type features.

Fair Isaac Corporation Confidential and Proprietary Information48

Mosel Run Time Library

Related topics
XPRMgetnextfield, XPRMgetnextpbcomp, XPRMfindtypecode.

Fair Isaac Corporation Confidential and Proprietary Information

49

Mosel Run Time Library

1.2.1

Lists
Lists are an ordered collection of objects. The functions available here allows to get properties ofa list (size and type) as well as enumerate all elements it contains.
XPRMgetlistsize

Get the size of a list.

p. 51

XPRMgetlisttype

Get the type of a list.

p. 52

XPRMgetnextlistelt

Get the next element of a list.

p. 53

XPRMgetprevlistelt

Get the previous element of a list.

p. 54

Fair Isaac Corporation Confidential and Proprietary Information50

Mosel Run Time Library

XPRMgetlistsize
PurposeGet the size of a list.
Synopsis
int XPRMgetlistsize(XPRMlist list);
Argument
list

Reference to a list

Return value
Size (=number of elements) of the list.
Further information
This function returns the size, that is the number of elements, of a given list.
Related topics
XPRMgetlisttype.

Fair Isaac Corporation Confidential and Proprietary Information

51

Mosel Run Time Library

XPRMgetlisttype
PurposeGet the type of a list.
Synopsis
int XPRMgetlisttype(XPRMlist list);
Argument
list

Reference to a list

Return value
List type.
Further information
The type of a list is both the type of all elements of the list and the storage class used for the list.
The element type can be extracted using the macro XPRM_TYP(type). Note that a list with no type
(XPRM_TYP_NOT) contains elements of different types. In this case the type of each element has tobe checked when enumerating the content of the list with XPRMgetnextlistelt. The storage classcan be extracted using the macro XPRM_GRP(type). If the bit XPRM_GRP_DYN is set, the list is
dynamic and may be modified.
Related topics
XPRMgetlistsize,XPRMgetnextlistelt.

Fair Isaac Corporation Confidential and Proprietary Information

52

Mosel Run Time Library

XPRMgetnextlistelt
PurposeGet the next element of a list.
Synopsisvoid *XPRMgetnextlistelt(XPRMlist list, void *ref, int *type, XPRMalltypes *value);
Arguments
list
ref
type
value

Reference to a list
Reference pointer or NULL
Returned type
Pointer to an area where the result is returned

Return value
Reference pointer for the next call to XPRMgetnextlistelt.
Further information
This function is used to enumerate elements of a list. The second parameter is used to store thecurrent location in the list; if this parameter is NULL, the first element of the list is returned. Thisfunction returns NULL if it is called with the reference to the last element. Otherwise, thereturned value can be used as the input parameter ref to get the following element and so on.
The function returns in the third argument the type of the object stored in value: this correspondto the value returned by XPRMgetlisttype if all elements have the same type.
Related topics
XPRMgetlisttype,XPRMgetprevlistelt.

Fair Isaac Corporation Confidential and Proprietary Information

53

Mosel Run Time Library

XPRMgetprevlistelt
PurposeGet the previous element of a list.
Synopsisvoid *XPRMgetprevlistelt(XPRMlist list, void *ref, int *type, XPRMalltypes *value);
Arguments
list
ref
type
value

Reference to a list
Reference pointer or NULL
Returned type
Pointer to an area where the result is returned

Return value
Reference pointer for the next call to XPRMgetnextlistelt.
Further information
This function is used to enumerate elements of a list in reverse order. The second parameter isused to store the current location in the list; if this parameter is NULL, the last element of the list isreturned. This function returns NULL if it is called with the reference to the first element.
Otherwise, the returned value can be used as the input parameter ref to get the following
element and so on. The function returns in the third argument the type of the object stored invalue: this correspond to the value returned by XPRMgetlisttype if all elements have the same
type.
Related topics
XPRMgetlisttype,XPRMgetnextlistelt.

Fair Isaac Corporation Confidential and Proprietary Information

54

Mosel Run Time Library

1.2.2

Sets
Sets are used to index arrays: any model using arrays also uses sets even if no set has been
defined explicitly. Note that a range is a special case of a set of integers which contains allconsecutive integers in a given interval.
XPRMgetelsetndx

Get the index of a set element.

p. 59

XPRMgetelsetval

Get the value of an element of a set.

p. 58

XPRMgetfirstsetndx

Get the first index of a set.

p. 60

XPRMgetlastsetndx

Get the last index of a set.

p. 61

XPRMgetsetsize

Get the size of a set.

p. 56

XPRMgetsettype

Get the type of a set.

p. 57

Fair Isaac Corporation Confidential and Proprietary Information

55

Mosel Run Time Library

XPRMgetsetsize
PurposeGet the size of a set.
Synopsis
int XPRMgetsetsize(XPRMset set);
Argument
set

Reference to a set

Return value
Size (=number of elements) of the set.
Further information
This function returns the size, that is the number of elements, of a given set.
Related topics
XPRMgetsettype.

Fair Isaac Corporation Confidential and Proprietary Information

56

Mosel Run Time Library

XPRMgetsettype
PurposeGet the type of a set.
Synopsis
int XPRMgetsettype(XPRMset set);
Argument
set

Reference to a set

Return value
Set type.
Further information
The type of a set is both the type of all elements of the set and the storage class used for the set.
The element type can be extracted using the macro XPRM_TYP(type). The storage class can beextracted using the macro XPRM_GRP(type). If the bit XPRM_GRP_GEN is set then the set is a general
set as opposed to a range set. If the bit XPRM_GRP_DYN is set, the set is dynamic and may be
extended.
Related topics
XPRMgetsetsize.

Fair Isaac Corporation Confidential and Proprietary Information

57

Mosel Run Time Library

XPRMgetelsetval
PurposeGet the value of an element of a set.
Synopsis
XPRMalltypes *XPRMgetelsetval(XPRMset set, int ind, XPRMalltypes *value);
Arguments
set
ind
value

Reference to a set
Index number
Pointer to an area where the result is returned

Return value
The third argument or NULL.
Further information
This function returns the value of the element of a given set denoted by the given index number.
The result is copied to the argument value.
Related topics
XPRMgetelsetndx.

Fair Isaac Corporation Confidential and Proprietary Information

58

Mosel Run Time Library

XPRMgetelsetndx
PurposeGet the index of a set element.
Synopsis
int XPRMgetelsetndx(XPRMmodel model, XPRMset set, XPRMalltypes *elt);
Arguments
model
set
elt

Reference to a model
Reference to a set
Reference to the element

Return value
Index of a set element or a negative value if the element is not contained in the set.
Further information
This function returns the index of a given element of a set.
Related topics
XPRMgetfirstsetndx, XPRMgetlastsetndx, XPRMgetelsetndx.

Fair Isaac Corporation Confidential and Proprietary Information

59

Mosel Run Time Library

XPRMgetfirstsetndx
PurposeGet the first index of a set.
Synopsis
int XPRMgetfirstsetndx(XPRMset set);
Argument
set

Reference to a set

Return value
Index of the first element in the set.
Further information
This function returns the index of the first element of a given set.
In a range set, the lowest value (lower range bound) is returned. In a set of strings, the firstelement always has the index (= order number) 1. It is recommended to test whether the set is
not empty (using function XPRMgetsetsize) before calling this function.
Related topics
XPRMgetlastsetndx, XPRMgetsetsize.

Fair Isaac Corporation Confidential and Proprietary Information

60

Mosel Run Time Library

XPRMgetlastsetndx
PurposeGet the last index of a set.
Synopsis
int XPRMgetlastsetndx(XPRMset set);
Argument
set

Reference to a set

Return value
Index of the last element in the set.
Further information
This function returns the index of the last element of a given set.
In a range set the highest value (upper range bound) is returned. In a set of strings the index of
the last element always corresponds to the number of elements in the set. It is recommended totest whether the set is not empty (using function XPRMgetsetsize) before calling this function.
Related topics
XPRMgetfirstsetndx, XPRMgetsetsize.

Fair Isaac Corporation Confidential and Proprietary Information

61

Mosel Run Time Library

1.2.3

ArraysIn Mosel, arrays are used to store any kind of object, including other arrays or sets. The type of
the array is also the type of the collected objects. The storage class indicates how these objects
are stored in memory. In most cases this information can be ignored as all functions accessing
arrays automatically handle each special case.
The storage class is encoded in two bits:
XPRM_GRP_DYN

The array is a dynamic array: there is no range defined for its indexing sets
(i.e. there cannot be any “out of range error” for this array as the indexing
sets may grow on demand).

XPRM_GRP_GEN

The array is a general (= dynamic bounded) array: the number of elements
may be augmented up to the range limits specified at its creation.

Typically a “sparse table” uses a storage class of XPRM_GRP_DYN or XPRM_GRP_DYN|XPRM_GRP_GEN(dynamic or fixed ranges). The Mosel compiler may decide which storage class should be used foreach array: even a “dense table” may be created using a storage class of XPRM_GRP_DYN if themodel does not provide enough information for deciding the actual size of the array at compiletime.
For dynamic arrays one may distinguish between logical and true entries. Assuming an array has
been created with the range 1..5, but only entry 3 has been defined, this array has 5 logicalentries but only a single true entry. This difference is mainly noticeable in the functions provided
for enumerating arrays.
Note that at the library level all arrays are indexed by integers (negative value are allowed). To
use text index values, the conversion from the text to the order number must be performed using
the function XPRMgetelsetndx.
XPRMchkarrind

Check whether an index tuple of an array is valid.

p. 72

XPRMcmpindicesCompare two index tuples.

p. 73

XPRMgetarrdim

Get the number of dimensions of an array.

p. 63

XPRMgetarrsets

Get the index sets of an array.

p. 66

XPRMgetarrsize

Get the size of an array.

p. 65

XPRMgetarrtypeGet the type of an array.

p. 64

XPRMgetarrval

Get the value of an array entry.

p. 74

XPRMgetfirstarrentry

Get the list of indices of the first entry of an array.

p. 67

XPRMgetfirstarrtruentry

Get the list of indices of the first true entry of an array.

p. 70

XPRMgetlastarrentry

Get the list of indices of the last entry of an array.

p. 68

XPRMgetnextarrentry

Get the list of indices of the next entry of an array.

p. 69

XPRMgetnextarrtruentry

Get the list of indices of the next true entry of an array.

p. 71

Fair Isaac Corporation Confidential and Proprietary Information

62

Mosel Run Time Library

XPRMgetarrdim
PurposeGet the number of dimensions of an array.
Synopsis
int XPRMgetarrdim(XPRMarray array);
Argument
array

Reference to an array

Return value
Number of dimensions of the array.
Further information
This function returns the number of dimensions of a given array.
Related topics
XPRMgetarrsets, XPRMgetarrsize, XPRMgetarrtype.

Fair Isaac Corporation Confidential and Proprietary Information

63

Mosel Run Time Library

XPRMgetarrtype
PurposeGet the type of an array.
Synopsis
int XPRMgetarrtype(XPRMarray array);
Argument
array

Reference to an array

Return value
Type of the array.
Further information
This function returns the type of a given array. The type of an array designates both the type ofall entries of the array and the storage class used for that array. The entry’s type can be extractedusing the macro XPRM_TYP(type). The storage class can be extracted using the macro
XPRM_GRP(type). The macro XPRM_ARR_DENSE can be used to characterize a “dense table” (e.g.
XPRM_GRP(type) == XPRM_ARR_DENSE).
Related topics
XPRMgetarrdim, XPRMgetarrsets, XPRMgetarrsize.

Fair Isaac Corporation Confidential and Proprietary Information

64

Mosel Run Time Library

XPRMgetarrsize
PurposeGet the size of an array.
Synopsis
int XPRMgetarrsize(XPRMarray array);
Argument
array

Reference to an array

Return value
Size (= total number of true entries) of the array.
Further information
This function returns the total number of true entries contained in the array.
Related topics
XPRMgetarrdim, XPRMgetarrsets, XPRMgetarrtype.

Fair Isaac Corporation Confidential and Proprietary Information

65

Mosel Run Time Library

XPRMgetarrsets
PurposeGet the index sets of an array.
Synopsisvoid XPRMgetarrsets(XPRMarray array, XPRMset sets[]);Arguments
array
sets

Reference to an arrayn-tuple of set references where n is the number of dimensions of the array array

Further information
This function returns in the parameter sets the list of sets that index the array array. Each set
corresponds to one dimension of the array.
Related topics
XPRMgetarrdim, XPRMgetarrsize, XPRMgetarrtype.

Fair Isaac Corporation Confidential and Proprietary Information

66

Mosel Run Time Library

XPRMgetfirstarrentry
PurposeGet the list of indices of the first entry of an array.
Synopsis
int XPRMgetfirstarrentry(XPRMarray array, int indices[]);Arguments
array
indices

Reference to an arrayn-tuple (n is the dimension of array array) where the index values of the first logicalelement in the array are returned

Return value
0 if executed succesfully, a positive value otherwise.
Further information
This function returns the index tuple of the first entry of a given array.
Related topics
XPRMgetfirstarrtruentry, XPRMgetlastarrentry, XPRMgetnextarrentry.

Fair Isaac Corporation Confidential and Proprietary Information

67

Mosel Run Time Library

XPRMgetlastarrentry
PurposeGet the list of indices of the last entry of an array.
Synopsis
int XPRMgetlastarrentry(XPRMarray array, int indices[]);Arguments
array
indices

Reference to an arrayn-tuple (n is the dimension of array array) where the index values of the last logicalelement in the array are returned

Return value
0 if executed succesfully, a positive value otherwise.
Further information
This function returns the index tuple of the last entry in the given array.
Related topics
XPRMgetfirstarrentry, XPRMgetfirstarrtruentry.

Fair Isaac Corporation Confidential and Proprietary Information

68

Mosel Run Time Library

XPRMgetnextarrentry
PurposeGet the list of indices of the next entry of an array.
Synopsis
int XPRMgetnextarrentry(XPRMarray array, int indices[]);Arguments
array
indices

Reference to an arrayn-tuple (n is the dimension of array array); the input values denote the tuple for which
the next (logical) array entry is required; the returned values are the next array entry

Return value
0 if executed succesfully, a positive value otherwise (end of array).
Further information
This function returns the index tuple of the entry following the given tuple in the given array.
The next entry in an array is determined by enumerating the last index of the tuple first. The
parameter indices serves for input and return values at the same time. It is modified by thefunction to return the tuple corresponding to the next array entry after the tuple that has been
input.
Related topics
XPRMgetfirstarrentry, XPRMgetfirstarrtruentry, XPRMgetnextarrtruentry.

Fair Isaac Corporation Confidential and Proprietary Information

69

Mosel Run Time Library

XPRMgetfirstarrtruentry
PurposeGet the list of indices of the first true entry of an array.
Synopsis
int XPRMgetfirstarrtruentry(XPRMarray array, int indices[]);Arguments
array
indices

Reference to an arrayn-tuple (n is the dimension of array array) where the index values of the first definedelement in the array are returned

Further information
If the given array has a fixed size (dense array), this function behaves like XPRMgetfirstarrentry.
With a dynamic array, this function returns the index tuple of the first true entry.
Related topics
XPRMgetfirstarrentry, XPRMgetlastarrentry, XPRMgetnextarrentry.

Fair Isaac Corporation Confidential and Proprietary Information70

Mosel Run Time Library

XPRMgetnextarrtruentry
PurposeGet the list of indices of the next true entry of an array.
Synopsis
int XPRMgetnextarrtruentry(XPRMarray array, int indices[]);Arguments
array
indices

Reference to an arrayn-tuple (n is the dimension of array array), the input values denote the tuple for which
the next true array entry is required; the returned values are the next array entry

Return value
0 if executed succesfully, a positive value otherwise (end of array) .
Further information
If the given array has a fixed size (dense array), this function behaves like XPRMgetnextarrentry.
With a dynamic array, this function returns the index tuple of the next true entry.
Related topics
XPRMgetfirstarrentry, XPRMgetfirstarrtruentry, XPRMgetnextarrentry.

Fair Isaac Corporation Confidential and Proprietary Information

71

Mosel Run Time Library

XPRMchkarrind
PurposeCheck whether an index tuple of an array is valid.
Synopsis
int XPRMchkarrind(XPRMarray array, int indices[]);Arguments
array
indices

Reference to an arrayn-tuple of indices where n is the dimension of array array

Return value
0 if the index tuple lies within the ranges for which the array is defined, a positive value
otherwise.
Further information
This function checks whether the given index tuple lies within the range bounds of an array.
Related topics
XPRMcmpindices.

Fair Isaac Corporation Confidential and Proprietary Information

72

Mosel Run Time Library

XPRMcmpindices
PurposeCompare two index tuples.
Synopsis
int XPRMcmpindices(int nbdim, int ind1[], int ind2[]);
Arguments
nbdim
ind1, ind2
Return value-10
1

number of dimensions (= size of tuples ind1 and ind2)
Index tuples of size nbdim

Tuple ind1 comes before tuple ind2
Tuples are identical
Tuple ind2 comes before tuple ind1

Further information
This function compares two index tuples.
Related topics
XPRMchkarrind.

Fair Isaac Corporation Confidential and Proprietary Information73

Mosel Run Time Library

XPRMgetarrval
PurposeGet the value of an array entry.
Synopsis
int XPRMgetarrval(XPRMarray array, int indices[], void *adr);
Arguments
array
indices
adr

Reference to an arrayn-tuple of indices where n is the number of dimensions of the array array
Pointer to the area where the value of the array entry denoted by the index-tuple isreturned.

Return value
0 if executed successfully, a positive value otherwise.
Further information
1. This function returns the value of an array entry that corresponds to a given tuple of indices for agiven array. The address passed must reference an area large enough to receive data of thearray’s type: for instance, for an array of reals (type = XPRM_TYP_REAL) the adr parameter must beof type double*.
2. The returned value is 0 (integer, real or Boolean) or NULL (other types) if the requested entry does
not exist when referencing a dynamic array.
Related topics
XPRMgetfirstarrentry, XPRMgetfirstarrtruentry, XPRMgetnextarrentry,
XPRMgetnextarrtruentry.

Fair Isaac Corporation Confidential and Proprietary Information

74

Mosel Run Time Library

1.2.4

Records
Records are a special kind of user defined types that associate to a an entity a collection of fields.
Thanks to the following functions one can enumerate these fields and get the value of a specificfield of given record.
XPRMgetfieldval

Get the value of a field of a record.

p. 77

XPRMgetnextfieldGet the next field of a record type.

p. 76

Fair Isaac Corporation Confidential and Proprietary Information75

Mosel Run Time Library

XPRMgetnextfield
PurposeGet the next field of a record type.
Synopsisvoid *XPRMgetnextfield(XPRMmodel model, void *ref, int code, const char **name, int*type, int *number);
Arguments
model
ref
code
name
type
number

Reference to a model
Reference pointer or NULL
Code of the record type
Field nameField type
Field number (in the record)

Return value
Reference pointer for the next call to XPRMgetnextfield.
Further information
1. This function is used to enumerate fields of a record type. The second parameter is used to store
the current location in the list of fields; if this parameter is NULL, the first field of the record isreturned. This function returns NULL if it is called with the reference to the last field. Otherwise,
the returned value can be used as the input parameter ref to get the following field and so on.
2. The name, type and number are the returned field properties. The field number is used by thefunction XPRMgetfieldval to retrieve the value of the corresponding field in an object of thisrecord type.
Related topics
XPRMgetfieldval.

Fair Isaac Corporation Confidential and Proprietary Information76

Mosel Run Time Library

XPRMgetfieldval
PurposeGet the value of a field of a record.
Synopsisvoid XPRMgetfieldval(XPRMmodel model, int code, void *ref, int number, XPRMalltypes*value);Arguments
model
ref
code
numbervalue

Reference to a model
Reference to the record
Type code of the record
Field number (in the record)
Pointer to an area where the field value is returned

Further information
The field number must be obtained from the function XPRMgetnextfield. Its value is valid as longas the model is loaded in memory.
Related topics
XPRMgetnextfield.

Fair Isaac Corporation Confidential and Proprietary Information

77

Mosel Run Time Library

1.2.5

Problems
Like all statements of a model, the routines presented in this section are executed in the context
of an active problem. By default, at the beginning of the processing of a model an initial problem
is created: the “main problem”. After the end of the execution of a model, this particular
problem is active but a different problem can be selected using the routine XPRMselectprob. The
following functions enable the user to access various information related to linear constraints
and decision variables created or used in the context of the active problem. With the exception of
the XPRMexportprob function, all operations in this section require the problem to be loaded into
an optimizer either explicitly (e.g. procedure ‘loadprob’ of the module “mmxprs”) or implicitly byusing an optimization operation (e.g. procedure ‘maximize’ of the module “mmxprs”) in themodel. If no problem is available (model not run, no constraint created by the model or problem
not loaded in an optimizer) a specific default value is returned by each function.
XPRMexportprob

Export the active problem to a file.

p. 80

XPRMgetact

Get the activity value of a linear constraint.

p. 87

XPRMgetcsol

Get the solution value of a linear constraint.

p. 83

XPRMgetctrnum

Get the row number of a linear constraint.

p. 89

XPRMgetdual

Get the dual value of a linear constraint.

p. 85

XPRMgetobjval

Get the objective function value.

p. 81

XPRMgetprobstat

Get the problem status of a model.

p. 79

XPRMgetrcost

Get the reduced cost value of a variable.

p. 84

XPRMgetslack

Get the slack value of a linear constraint.

p. 86

XPRMgetvarnum

Get the column number of a decision variable.

p. 88

XPRMgetvsol

Get the solution value of a variable.

p. 82

XPRMselectprob

Select the active problem.

p. 90

Fair Isaac Corporation Confidential and Proprietary Information

78

Mosel Run Time Library

XPRMgetprobstat
PurposeGet the problem status of a model.
Synopsis
int XPRMgetprobstat(XPRMmodel model);Argument
model

Reference to a model

Return value
Problem status.
Further information
This function returns the status of the active problem of the given model, or 0 if no problem isavailable.
The problem status is bit encoded as follows:
XPRM_PBCHG Problem loaded in the optimizer (if any) is not valid
XPRM_PBSOL A solution is available
The solution status can be obtained by checking the XPRM_PBRES bits of the problem status.
Possible values are:
XPRM_PBOPT optimal solution found
XPRM_PBUNF optimization unfinished
XPRM_PBINF problem is infeasible
XPRM_PBUNB problem is unbounded
XPRM_PBOTH optimization failed (any other cause)
Related topics
XPRMgetobjval.

Fair Isaac Corporation Confidential and Proprietary Information

79

Mosel Run Time Library

XPRMexportprob
PurposeExport the active problem to a file.
Synopsis
int XPRMexportprob(XPRMmodel model, const char *options,const char *fname, XPRMlinctr obj);
Arguments
model
optionsfname
obj

Reference to a model
Format of the output. Possible value are:""LP output format, minimization (default)"m"
MPS output format"p"Maximization (default is minimization)"s"
Use scrambled names
File name, may be NULL
Objective to use for optimization, or NULL (no objective) or XPRM_KEEPOBJ (lastobjective used)

Return value
0 if executed successfully, XPRM_RT_ERROR if no problem is available or XPRM_RT_IOERR in case of IO
error.
Further information
This function exports the active problem to an MPS or LP format matrix file. If the filename is set
to NULL, the output is printed to the console. If the filename is given without an extension, theextension .mps for MPS files or .lp for LP format files is added. The output format options can be
combined in a single string (e.g. "sp"). This function is disabled (i.e. it succeeds but performs nooperation) when Mosel is running in trial mode.
When exporting matrices in MPS format any possibly specified lower bounds on semi-continuousor semi-continuous integer variables are lost. LP format matrices maintain the complete
information.

Fair Isaac Corporation Confidential and Proprietary Information

80

Mosel Run Time Library

XPRMgetobjval
PurposeGet the objective function value.
Synopsisdouble XPRMgetobjval(XPRMmodel model);Argument
model

Reference to a model

Return value
Objective function value.
Further information
This function returns the value of the objective function if the problem has been solved
successfully.
Related topics
XPRMgetprobstat.

Fair Isaac Corporation Confidential and Proprietary Information81

Mosel Run Time Library

XPRMgetvsol
PurposeGet the solution value of a variable.
Synopsisdouble XPRMgetvsol(XPRMmodel model, XPRMmpvar var);
Arguments
model
var

Reference to a model
Reference to a decision variable

Return value
Solution value or 0.
Further information
This function returns the value of a given variable if the problem has been solved successfully (LP:
optimal LP solution or 0, global: last integer solution or 0).
Related topics
XPRMgetrcost.

Fair Isaac Corporation Confidential and Proprietary Information82

Mosel Run Time Library

XPRMgetcsol
PurposeGet the solution value of a linear constraint.
Synopsisdouble XPRMgetcsol(XPRMmodel model, XPRMlinctr ctr);
Arguments
model
ctr

Reference to a model
Reference to a linear constraint

Return value
Solution value.
Further information
This function returns the evaluation of the given contraint using the current solution (thiscorresponds to the Mosel getsol function applied to a linear constraint).
Related topics
XPRMgetdual, XPRMgetslack.

Fair Isaac Corporation Confidential and Proprietary Information

83

Mosel Run Time Library

XPRMgetrcost
PurposeGet the reduced cost value of a variable.
Synopsisdouble XPRMgetrcost(XPRMmodel model, XPRMmpvar var);
Arguments
model
var

Reference to a model
Reference to a decision variable

Return value
Reduced cost value or 0.
Further information
This function returns the reduced cost value of a given variable if the problem has been solved
successfully (otherwise 0).
Related topics
XPRMgetvsol.

Fair Isaac Corporation Confidential and Proprietary Information

84

Mosel Run Time Library

XPRMgetdual
PurposeGet the dual value of a linear constraint.
Synopsisdouble XPRMgetdual(XPRMmodel model, XPRMlinctr ctr);
Arguments
model
ctr

Reference to a model
Reference to a linear constraint

Return value
Dual value or 0.
Further information
This function returns the dual value of a given linear constraint if the problem has been solved
successfully and the constraint is contained in the problem (otherwise 0).
Related topics
XPRMgetact, XPRMgetcsol, XPRMgetslack.

Fair Isaac Corporation Confidential and Proprietary Information

85

Mosel Run Time Library

XPRMgetslack
PurposeGet the slack value of a linear constraint.
Synopsisdouble XPRMgetslack(XPRMmodel model, XPRMlinctr ctr);
Arguments
model
ctr

Reference to a model
Reference to a linear constraint

Return value
Slack value or 0.
Further information
This function returns the slack value of a given linear constraint if the problem has been solved
successfully (otherwise 0).
Related topics
XPRMgetcsol, XPRMgetdual.

Fair Isaac Corporation Confidential and Proprietary Information

86

Mosel Run Time Library

XPRMgetact
PurposeGet the activity value of a linear constraint.
Synopsisdouble XPRMgetact(XPRMmodel model, XPRMlinctr ctr);
Arguments
model
ctr

Reference to a model
Reference to a linear constraint

Return value
Activity value.
Further information
This function returns the activity value of a given linear constraint if the problem has been solved
successfully.
Related topics
XPRMgetcsol, XPRMgetslack.

Fair Isaac Corporation Confidential and Proprietary Information

87

Mosel Run Time Library

XPRMgetvarnum
PurposeGet the column number of a decision variable.
Synopsis
int XPRMgetvarnum(XPRMmodel model, XPRMmpvar var);
Arguments
model
var

Reference to a model
Reference to a variable

Return value
The column number (≥ 0) of the decision variable, or a negative value.
Further information
This function returns the column number of a decision variable. A negative value is returned if noproblem is available or if the variable does not belong to the active problem.
Related topics
XPRMgetctrnum.

Fair Isaac Corporation Confidential and Proprietary Information

88

Mosel Run Time Library

XPRMgetctrnum
PurposeGet the row number of a linear constraint.
Synopsis
int XPRMgetctrnum(XPRMmodel model, XPRMlinctr ctr);
Arguments
model
ctr

Reference to a model
Reference to a linear constraint

Return value
The row number (≥ 0) of the linear constraint, or a negative value.
Further information
This function returns the row number of a linear constraint. A negative value is returned if noproblem is available or if the constraint does not belong to the active problem.
Related topics
XPRMgetvarnum.

Fair Isaac Corporation Confidential and Proprietary Information

89

Mosel Run Time Library

XPRMselectprob
Purpose
Select the active problem.
Synopsis
int XPRMselectprob(XPRMmodel model, int typcode, void *prob);
Arguments
model
typcodeprob

Reference to a modelType code of the object problem (0 to activate the main problem)
Reference to the object problem (ignored if typcode is 0)

Return value
0 if successful, 1 otherwise.
Further information
1. This function activates a problem: after a successful call, all functions accessing problem
information will refer to the selected problem. The function will fail if the requested problem has
not been initialised or is empty (for instance before execution of the model).
2. This function cannot be used while the model is running, in particular it will fail if called from thedebugger interface (see Section 1.3).
Related topics
XPRMfindident.

Fair Isaac Corporation Confidential and Proprietary Information

90

Mosel Run Time Library

1.2.6

Miscellaneous
XPRMcb_sendctrl

Send a control character to an initialization stream.

p. 100

XPRMcb_sendint

Send an integer value to an initialization stream.

p. 97

XPRMcb_sendreal

Send a real value to an initialization stream.

p. 98

XPRMcb_sendstring

Send a text string value to an initialization stream.

p. 99

XPRMdate2jdn

Convert a date into a Julian Day Number (JDN).

p. 93

XPRMfreememblk

Release a memory block allocated by the mem: IO driver.

p. 92

XPRMjdn2dateConvert a Julian Day Number (JDN) into a calendar date.

p. 94

XPRMpathcheck

Expand a path name and check whether it can be accessed.

p. 96

XPRMtime

Get the current date and time.

p. 95

Fair Isaac Corporation Confidential and Proprietary Information

91

Mosel Run Time Library

XPRMfreememblk
Purpose
Release a memory block allocated by the mem: IO driver.
Synopsis
int XPRMfreememblk(XPRMmemblk *memblk);
Argument
memblkReference to a memory block

Return value
0 if successful, 1 otherwise.
Further information
This function can be used to release a memory block allocated by the "mem:" IO driver used withan XPRMmemblk object (see Section 1.5.3)

Fair Isaac Corporation Confidential and Proprietary Information

92

Mosel Run Time Library

XPRMdate2jdn
PurposeConvert a date into a Julian Day Number (JDN).
Synopsis
int XPRMdate2jdn(int year,int month, int day);Arguments
year
month
day

Year number
Month number (1-12)
Day number (1-31)

Return value
The JDN corresponding to the provided date.
Further information
The value returned by this function corresponds to the number of days elapsed since 1/1/1970.
Related topics
XPRMjdn2date,XPRMtime.

Fair Isaac Corporation Confidential and Proprietary Information

93

Mosel Run Time Library

XPRMjdn2date
PurposeConvert a Julian Day Number (JDN) into a calendar date.
Synopsisvoid XPRMjdn2date(int jdn, int *year,int *month, int *day);Arguments
jdn
year
month
day

The Julian Day Number to decode
Returned year number
Returned month number (1-12)
Returned day number (1-31)

Further information
This function decodes a date represented using a JDN as returned by the functions XPRMdate2jdn
or XPRMtime.
Related topics
XPRMdate2jdn,XPRMtime.

Fair Isaac Corporation Confidential and Proprietary Information

94

Mosel Run Time Library

XPRMtime
PurposeGet the current date and time.
Synopsisvoid XPRMtime(int *jdn, int *t,int *tz);
Arguments
jdnttz

Returned Julian Day Number
Returned current time (in milliseconds)
Time zone. Possible values are:
XPRM_TIME_LOCALTime is expressed in local time
XPRM_TIME_UTC
Time is expressed in Coordinated Universal Time (UTC)

Return value
0 if successful, 1 otherwise.
Further information
1. This function returns the current date as a JDN (number of days since 1/1/1970) and a number ofmilliseconds since midnight. The JDN may be decoded using the function jdn2date.
2. The date returned by this function can be converted to a Unix time (type time_t) using theexpression: jdn*86400+t/1000. Similarly a Windows file time (type FILETIME) can be obtainedusing: ((__int64)jdn+134774)*864000000000i64+(__int64)t*10000i64).
Related topics
XPRMjdn2date,XPRMdate2jdn.

Fair Isaac Corporation Confidential and Proprietary Information

95

Mosel Run Time Library

XPRMpathcheck
PurposeExpand a path name and check whether it can be accessed.
Synopsis
int XPRMpathcheck(const char *path,char *fullpath,int maxlen,int acc);
Arguments
path
fullpathmaxlenacc

Path (or file name) to be processed
Buffer to return the expanded path
Size of fullpath
Operation to perform. Possible values:
XPRM_RCHK_READ
Check whether path or file can be read
XPRM_RCHK_WRITE
Check whether path or file can be written
XPRM_RCHK_NOCHK
Only expand the path without testing access

Return value
0 if successful, 1 if access is denied and a negative value in case of error (e.g. buffer too small).
Further information
1. This routine returns an absolute path to the file name it gets as input and optionally checks
whether access is allowed according to the current restrictions.
2. The string "tmp:" beginning a path name will be replaced by the path to the Mosel temporary
directory.
Related topics
XPRMsetdefworkdir, XPRMsetrestrictions.

Fair Isaac Corporation Confidential and Proprietary Information

96

Mosel Run Time Library

XPRMcb_sendint
PurposeSend an integer value to an initialization stream.
Synopsis
int XPRMcb_sendint(XPRMcbinit cbinit,int i,int flush);
Arguments
cbiniti
flush
Return value
0
1
2
-1

Stream context
Integer value to send
If 0, the data will be processed when the queue of tokens is full, otherwise processing
occurs immediately.
Normal termination
All tokens have been processed and no more data is expected
No more data is expected but the queue of tokens is not empty
An error occurred

Further information
1. A boolean value can also be sent using this routine: 1 for true and 0 for false.
2. This function can only be used from a callback stream (see Section 1.5.2) during the execution of
an initializations from block.
3. If the flush argument is 0, the information sent is queued and the function returns 0. The queueis flushed when it is full or if the flush argument is non-zero.
Related topics
XPRMcb_sendreal,XPRMcb_sendstring,XPRMcb_sendctrl.

Fair Isaac Corporation Confidential and Proprietary Information

97

Mosel Run Time Library

XPRMcb_sendreal
PurposeSend a real value to an initialization stream.
Synopsis
int XPRMcb_sendreal(XPRMcbinit cbinit,double r,int flush);
Arguments
cbinitr
flush
Return value
0
1
2
-1

Stream context
Real value to send
If 0, the data will be processed when the queue of tokens is full, otherwise processing
occurs immediately.
Normal termination
All tokens have been processed and no more data is expected
No more data is expected but the queue of tokens is not empty
An error occurred

Further information
1. This function can only be used from a callback stream (see Section 1.5.2) during the execution of
an initializations from block.
2. If the flush argument is 0, the information sent is queued and the function returns 0. The queueis flushed when it is full or if the flush argument is non-zero.
Related topics
XPRMcb_sendint,XPRMcb_sendstring,XPRMcb_sendctrl.

Fair Isaac Corporation Confidential and Proprietary Information

98

Mosel Run Time Library

XPRMcb_sendstring
PurposeSend a text string value to an initialization stream.
Synopsis
int XPRMcb_sendstring(XPRMcbinit cbinit,const char *text, int len,int flush);
Arguments
cbinit
text
len
flush
Return value
0
1
2
-1

Stream context
Text string value to send
Length of the string (or -1)
If 0, the data will be processed when the queue of tokens is full, otherwise processing
occurs immediately.
Normal termination
All tokens have been processed and no more data is expected
No more data is expected but the queue of tokens is not empty
An error occurred

Further information
1. This function can only be used from a callback stream (see Section 1.5.2) during the execution of
an initializations from block.
2. If the flush argument is 0, the information sent is queued and the function returns 0. The queueis flushed when it is full or if the flush argument is non-zero.
Related topics
XPRMcb_sendint,XPRMcb_sendreal,XPRMcb_sendctrl.

Fair Isaac Corporation Confidential and Proprietary Information99

Mosel Run Time Library

XPRMcb_sendctrl
PurposeSend a control character to an initialization stream.
Synopsis
int XPRMcb_sendctrl(XPRMcbinit cbinit,int ctrl,int flush);
Arguments
cbinitctrl

flush
Return value
0
1
2
-1

Stream context
Control character code. Possible values:
XPRM_CBC_SKIP
Skip the next record (same as * in an ASCII file)
XPRM_CBC_OPENLST
Begin a list of values (same as [ in an ASCII file)
XPRM_CBC_CLOSELSTEnd a list of values (same as ] in an ASCII file)
XPRM_CBC_OPENNDXBegin a list of indices (same as ( in an ASCII file)
XPRM_CBC_CLOSENDXEnd a list of indices (same as ) in an ASCII file)If 0, the data will be processed when the queue of tokens is full, otherwise processing
occurs immediately.
Normal termination
All tokens have been processed and no more data is expected
No more data is expected but the queue of tokens is not empty
An error occurred

Further information
1. This function can only be used from a callback stream (see Section 1.5.2) during the execution of
an initializations from block.
2. If the flush argument is 0, the information sent is queued and the function returns 0. The queueis flushed when it is full or if the flush argument is non-zero.
Related topics
XPRMcb_sendint,XPRMcb_sendreal,XPRMcb_sendstring.

Fair Isaac Corporation Confidential and Proprietary Information

100

Mosel Run Time Library

1.3

Debugger interface
The Mosel debugger interface provides the necessary functionality for controling the executionof a program (execution step by step, breakpoints, access to local symbols, stack frame change)that may be used, for instance, to implement an interactive debugger. This interface relies on
debugging information stored in the bim file which is generated at compile time depending oncompilation options (see Section 2.1):
correspondence between a global symbol and its value: this information is available as longas the source is not compiled with option "s";

correspondence between a local symbol (e.g. index of a loop or variable local to a function)and its value: this information is generated when model is compiled with option "g";

correspondence between source code and compiled code: the source location information is
also constructed if option "g" was used for compilation;



tracing facility to enable the Mosel virtual machine to suspend execution at a specified
location (breakpoint) or execute one statement at a time: as opposed to the previous
features, this information requires insertion of instructions in the compiled code (and mayalter the execution speed of a model). To enable this extension, option "G" has to be used
when compiling the source model.

A model to be run through the debugger interface should be compiled with flag "g" or "G".
For the functions described below, the source location is indicated by means of line indices: eachof these indices is associated to a statement, a data structure declaration or an end of subroutine(just before it returns). The function XPRMdbg_getlocation makes the correspondence between aline index and an actual source location (i.e. file name and line number). The first statement of
the program has always index 0 and the total number of indices can be obtained using
XPRMdbg_getnblndx. It is also possible to retrieve all indices at once using XPRMdbg_getlndx. The
index of the first statement of a function is returned by XPRMdbg_findproclndx.
The execution of a program normally terminates when an error occurs or simply when all
instructions have been run. Using the function XPRMdbg_setbrkp, it is possible to specify locationsin the program where execution must be suspended. From these breakpoints, one can examine
current value of variables, install new breakpoints then continue or cancel execution for instance.
Before procedures (or functions) are called during execution of a program, the execution context
of the system (mainly local symbols and a reference to the next instruction) is saved on top of a
stack. This way, after the routine returns, the state of the machine can be restored and theexecution resumed. When the execution of the program is suspended, it may be interesting tochange the current position in the stack, or stack frame, in order to view variables that are notdefined at the current level because they are declared by the calling procedure. This can beachieved using function XPRMdbg_setstacklev.
In order to use the debugger interface, the program has to be run with the function
XPRMdbg_runmod: this special version of XPRMrunmod requires an extra parameter specifying afunction reference, Mosel calls this function whenever the program has to be interrupted. If
there is no error condition, the return value of the function decides whether execution should
continue or not. During the interruption, most functions listed in this manual can be used toretrieve information about the current state of the program. Moreover, XPRMfindident returns
references to locally defined symbols when called from the debugger interface.
XPRMdbg_clearbrkp

Clear a breakpoint at the given line index.

p. 111

XPRMdbg_findproclndx

Find the line index of a procedure or function.

p. 109Fair Isaac Corporation Confidential and Proprietary Information

101

Mosel Run Time Library

XPRMdbg_getlndx

Retrieve all line indices.

p. 106

XPRMdbg_getlocation

Get a source file location associated to a given line index.

p. 108

XPRMdbg_getnblndx

Get the number of line indices.

p. 107

XPRMdbg_getnextlocal

Get the next local identifier in the dictionary.

p. 105

XPRMdbg_runmod

Run a model through the debugger interface.

p. 103

XPRMdbg_setbrkp

Set a breakpoint at the given line index.

p. 110

XPRMdbg_setstacklev

Set the current stack frame to the specified level.

p. 112

Fair Isaac Corporation Confidential and Proprietary Information

102

Mosel Run Time Library

XPRMdbg_runmod
PurposeRun a model through the debugger interface.
Synopsis
int XPRMdbg_runmod(XPRMmodel model, int *returned, const char *parlist,
int (MM_RTC *dbgcb)(void *dctx, int vmstat, int lndx), void *dbgctx);
Arguments
model
returnedparlist
dbgcb
dbgctx

Reference to a model
Pointer to an area where the result value is returned
String composed of model parameter initializations separated by commas, may be
NULL
user defined debugger callback
debug context: it is used as the first argument of dbgcb

Return value
XPRM_RT_OK Normal termination
XPRM_RT_ERROR An error occured during execution
XPRM_RT_MATHERR Mathematical error (e.g. division by zero)
XPRM_RT_IOERR Input/output error (e.g. cannot open file)
XPRM_RT_STOP Bit set if execution has been interrupted

Fair Isaac Corporation Confidential and Proprietary Information

103

Mosel Run Time Library

Further information
1. The parameter parlist may be used to initialize the model parameters of the model/program(e.g. "PAR1=12,PAR2=’tutu’"). The parameter returned receives the result of the execution (e.g.
parameter value of the “exit” procedure). The bit XPRM_RT_STOP is set if the execution of themodel has been interrupted by a call to the function XPRMstoprunmod.
2. If the function pointer dbgcb if NULL XPRMdbg_runmod behaves like XPRMisrunmod; otherwisefunction dbgcb is called whenever the model is interrupted (breakpoint, error or function
XPRMstoprunmod called). The first argument, dctx, is the value of dbgctx; the second, vmstat, is thevirtual machine status (i.e. XPRM_RT_*) and the last argument, lndx, is the line index
corresponding to the statement being executed (asynchronous interruption) or to be executed(breakpoint). In this context the virtual machine status may take value XPRM_RT_BREAK ifinterruption is due to a breakpoint and value XPRM_RT_NIFCT if the program was executing anative function when interruption occurred.
3. If a breakpoint at line -1 has been set (see XPRMdbg_setbrkp) the debugger callback dbgcb is called
just before program termination when no error has occurred. In this case the virtual machine
status takes value XPRM_RT_ENDING for a normal termination and value XPRM_RT_EXIT if the laststatement is a call to procedure exit.
4. If the program is interrupted because of an error, the return value of dbgcb is ignored, otherwise
it indicates how to continue execution. If vmstat is not XPRM_RT_NIFCT, the following values canbe returned:
XPRM_DBG_STOP terminate execution
XPRM_DBG_NEXT stop before the next statement skipping function calls
XPRM_DBG_STEP stop before the next statement stepping into function calls
XPRM_DBG_CONT continue executionj>0
stop before the statement at line index j
5. If the interruption occurs during the execution of a native function (for instance when the
optimizer is solving a problem), vmstat is XPRM_RT_NIFCT and execution of the function can becanceled (execution continues after the NI call) by returning XPRM_DBG_STOP (in this case thedebugger callback is called again just after the native function call completes). Other values
returned by dbgcb imply the continuation of the execution.
Related topics
XPRMrunmod, XPRMisrunmod, XPRMstoprunmod.

Fair Isaac Corporation Confidential and Proprietary Information

104

Mosel Run Time Library

XPRMdbg_getnextlocal
PurposeGet the next local identifier in the dictionary.
Synopsisconst char *XPRMdbg_getnextlocal(XPRMmodel model, void **ref);Arguments
model
ref

Reference to a model
Pointer to an area where current location is stored

Return value
An identifier of the symbol table or NULL if all local identifiers have been returned.
Further information
This function is used in the same way as XPRMgetnextident except that it returns the identifiers
locally defined in the current context. These symbols are not reported by XPRMgetnextident.
Related topics
XPRMgetnextident, XPRMfindident.

Fair Isaac Corporation Confidential and Proprietary Information

105

Mosel Run Time Library

XPRMdbg_getlndx
PurposeRetrieve all line indices.
Synopsisvoid XPRMdbg_getlndx(XPRMmodel model, int *nbl, int *lines, int *nbf, const char**fnames);
Arguments
model
nbl
lines
nbf
fnamesReference to a model
Pointer to an area where the number of indices is returned (can be NULL)
Pointer to an area where the encoded line numbers are returned (can be NULL)
Pointer to an area where the number of file names is returned (can be NULL)
Pointer to an area where the file names are returned (can be NULL)

Further information
1. If no debugging information is available (e.g. program has not been compiled with option "G")nbl takes value -1 and nbf is set to 0.
2. lines and fnames can be NULL: in this case the function still returns the sizes of these arrays.
3. Each entry of the lines array represents at the same time a line number (coded on 24 bits) and afile number (coded on 8bits) that is a reference in the fnames array. Macros XPRM_DBGL_LINE and
XPRM_DBGL_FILE can be used to extract these references from the encoded index.
Related topics
XPRMdbg_getnblndx, XPRMdbg_findproclndx.

Fair Isaac Corporation Confidential and Proprietary Information

106

Mosel Run Time Library

XPRMdbg_getnblndx
PurposeGet the number of line indices.
Synopsis
int XPRMdbg_getnblndx(XPRMmodel model);Argument
model

Reference to a model

Return value
Number of line indices or -1.
Further information
1. When a program is compiled with option "g" or "G", each statement in the source code isassociated with a line index in the bim file. This function returns the total number of line indicesstored: a line index ranges between 0 and XPRMdbg_getnblndx()-1.
2. If no debugging information is included in the bim file, this function return -1.
Related topics
XPRMdbg_getlndx,XPRMdbg_getlocation, XPRMdbg_findproclndx.

Fair Isaac Corporation Confidential and Proprietary Information

107

Mosel Run Time Library

XPRMdbg_getlocation
PurposeGet a source file location associated to a given line index.
Synopsis
int XPRMdbg_getlocation(XPRMmodel model, int lndx, int *line, const char **fname);
Arguments
model
lndx
line
fname

Reference to a modelLine index, -1 for current location or -2 for the last location of the model
Pointer to an area where the line number is returned
Pointer to an area where the file name is returned

Return value
0 if successful, 1 otherwise (invalid parameters)
Further information
1. This funtion returns the source location (file name and line number) corresponding to a given line
index. If the provided index is -1 and an execution context is available, the function returns
information related to the statement being executed. If this value is -2, the location of the laststatement is returned.
2. If parameter fname is NULL, the function returns in line the current line index (i.e. the value oflndx or its updated value if it was given as a negative number).
3. If the returned line number is 0, the machine is currently executing a portion of the code forwhich there is no debugging information (i.e. a package compiled without option -g or -G). In
this case the fname information corresponds to the package name.
Related topics
XPRMdbg_getnblndx, XPRMdbg_getlndx, XPRMdbg_findproclndx.

Fair Isaac Corporation Confidential and Proprietary Information

108

Mosel Run Time Library

XPRMdbg_findproclndx
PurposeFind the line index of a procedure or function.
Synopsis
int XPRMdbg_findproclndx(XPRMmodel model, XPRMproc proc);
Arguments
model
proc

Reference to a model
Reference to a procedure or function

Return value
Line index of the first statement of the routine, 0 if proc is NULL or -1 in case of error.
Further information
This funtion returns the line index corresponding to the first statement of the provided
procedure or function (as returned by XPRMfindident).
Related topics
XPRMdbg_getnblndx, XPRMdbg_getlndx, XPRMdbg_getlocation.

Fair Isaac Corporation Confidential and Proprietary Information

109

Mosel Run Time Library

XPRMdbg_setbrkp
PurposeSet a breakpoint at the given line index.
Synopsis
int XPRMdbg_setbrkp(XPRMmodel model, int lndx);
Arguments
model
lndx

Reference to a modelLine index

Return value
0 if successful, 1 otherwise (invalid parameters)
Further information
1. After a breakpoint has been established, execution of the program is interrupted just before thespecified location. A breakpoint remains active as long as it is not removed.
2. Breakpoints can be set before execution of the program but are automatically deleted after the
execution terminates. A breakpoint may be explicitly removed by calling the function
XPRMdbg_clearbrkp.
3. The line index value -1 is a special code to establish a breakpoint just before the execution
terminates (when there is no error). The debugger function is therefore called on the laststatement of the program or at a call to the exit function.
Related topics
XPRMdbg_clearbrkp, XPRMdbg_getnblndx.

Fair Isaac Corporation Confidential and Proprietary Information

110Mosel Run Time Library

XPRMdbg_clearbrkp
PurposeClear a breakpoint at the given line index.
Synopsis
int XPRMdbg_clearbrkp(XPRMmodel model, int lndx);
Arguments
model
lndx

Reference to a modelLine index or -1 for all breakpoints

Return value
0 if successful, 1 otherwise (invalid parameters)
Further information
This function deletes a breakpoint previously set using XPRMdbg_setbrkp. If no breakpoint was
installed at the given location, the function has no effect; if the line index is -1, all defined
breakpoints are cleared.
Related topics
XPRMdbg_setbrkp, XPRMdbg_getnblndx.

Fair Isaac Corporation Confidential and Proprietary Information

111

Mosel Run Time Library

XPRMdbg_setstacklev
PurposeSet the current stack frame to the specified level.
Synopsis
int XPRMdbg_setstacklev(XPRMmodel model, int level);Arguments
model
level

Reference to a model
Stack level

Return value
Line index or -1 if the level does not exist
Further information
This function changes the current stack frame of the program: the initial level is 0, positive values
indicate higher levels. The line index returned corresponds to the location of the function call or
the current location if the level is 0. If no location can be found for the selected stack frame thevalue INT_MAX is returned. Changing the stack frame modifies the behaviour of XPRMfindident
regarding local symbols: symbols returned are those of the specified stack level and not those of
the interruption (level 0).
Related topics
XPRMdbg_runmod, XPRMfindident.

Fair Isaac Corporation Confidential and Proprietary Information

112

Mosel Run Time Library

1.4

Handling of modules
The functionalities of Mosel may be extended by using native libraries or modules implemented
as dynamic shared objects (DSO). The module manager of Mosel keeps a list of all loaded
modules and maintains a list of references for each of them. Using the following functions it ispossible to know which modules are currently loaded and what are the provided features, and toaccess the values of their control parameters.
XPRMautounloaddso

Disable/enable automatic unloading of modules.

p. 117

XPRMfinddso

Find a DSO descriptor from a module name.

p. 118

XPRMflushdso

Unload unused dynamic shared objects.

p. 119

XPRMgetdsoannotations

Retrieve annotations defined by a module.

p. 120

XPRMgetdsoparamGet the current value of a control parameter.

p. 121

XPRMgetdsopath

Get the directory list where DSO files are searched for.

p. 115

XPRMgetdsoprop

Get a property of a dynamic shared object.

p. 128

XPRMgetnextdso

Get next dynamic shared object.

p. 122

XPRMgetnextdsoconst

Enumerate constants of a module.

p. 123

XPRMgetnextdsodep

Enumerate dependencies of a module.

p. 124

XPRMgetnextdsoparam

Enumerate control parameters of a module.

p. 126

XPRMgetnextdsoproc

Enumerate procedures and functions of a module.

p. 127

XPRMgetnextdsotype

Enumerate native types of a module.

p. 125

XPRMgetnextiodrv

Get the next IO driver in the list of available drivers.

p. 129

XPRMpreloaddso

Explicitly load the named module.

p. 130

XPRMregstatdso

Declare a module as static.

p. 116

XPRMsetdsopath

Set the directory list where DSO files are stored.

p. 114

Fair Isaac Corporation Confidential and Proprietary Information

113

Mosel Run Time Library

XPRMsetdsopath
PurposeSet the directory list where DSO files are stored.
Synopsisvoid XPRMsetdsopath(const char *paths);
Argument
paths

List of directories

Further information
By default, Mosel looks for its modules in the directories defined by the environment variable
MOSEL_DSO and then in a path deduced from the location (rtdir) of the Mosel runtime library:"rtdir\..\dso" Under Windows if rtdir terminates by "\bin" and "rtdir\..\dso" exists or"rtdir/../dso" On Unix compatible systems if rtdir terminates by "/lib" and "rtdir/../dso"
exists or"rtdir/dso""rtdir"if this directory exists or

if none of the above rules apply

This function may be used to replace the directory list defined by MOSEL_DSO. Note that thedirectory separator is ‘:’ under Unix (for example,"/opt/Mosel/dso:/tmp") and ‘;’ under Win32 (for example, "E:\Mosel\Dso;C:\Temp").
Related topics
XPRMgetlibpath,XPRMgetdsopath.

Fair Isaac Corporation Confidential and Proprietary Information

114

Mosel Run Time Library

XPRMgetdsopath
PurposeGet the directory list where DSO files are searched for.
Synopsis
int XPRMgetdsopath(char *path, int len);
Arguments
path
len

Array of chars where the path is returned
The size of the array path

Return value
0 if successful, 1 if path is truncated, -1 in case of error.
Further information
This function returns the path currently used by Mosel for searching modules. Note that thereturned path includes both the default search path (deduced from the location of the Mosel
runtime library) and the path set up either via the environment variable MOSEL_DSO or thefunction XPRMsetdsopath.
Related topics
XPRMsetdsopath.

Fair Isaac Corporation Confidential and Proprietary Information

115

Mosel Run Time Library

XPRMregstatdso
Purpose
Declare a module as static.
Synopsis
int XPRMregstatdso(const char *name, int (*dsoinit)(XPRMnifct, int *,int *, XPRMdsointer **));
Arguments
namedsoinitName of the module
Address of the module initialization function

Return value
0 if successful, 1 otherwise.
Further information
This function declares a module as static. If parameter dsoinit is NULL, the module is loaded andwill not be unloaded until the termination of the program. Otherwise the module is
implemented in the current program (instead of being an external library) and dsoinit is theinitialization function of the module (see Mosel Native Interface Reference Manual).

Fair Isaac Corporation Confidential and Proprietary Information

116

Mosel Run Time Library

XPRMautounloaddso
PurposeDisable or enable automatic unloading of dynamic shared objects.
Synopsisvoid XPRMautounloaddso(int yesno);
Argument
yesno

Disable if 0, enable otherwise

Further information
Modules are loaded by the system whenever they are required. By default, each unused moduleis automatically unloaded after a fixed period of time. Using this function it is possible to disable
this automatic unloading; in which case, unused modules have to be unloaded explicitly using
XPRMflushdso.
Related topics
XPRMflushdso.

Fair Isaac Corporation Confidential and Proprietary Information

117

Mosel Run Time Library

XPRMfinddso
PurposeFind a DSO descriptor from a module name.
Synopsis
XPRMdsolib XPRMfinddso(const char *libname);
Argument
libnameName of the module to find

Return value
A reference to a DSO descriptor or NULL if the requested module has not been loaded.
Further information
This function returns the DSO pointer of a module that has been loaded previously.
Related topics
XPRMgetnextdso.

Fair Isaac Corporation Confidential and Proprietary Information

118

Mosel Run Time Library

XPRMflushdso
Purpose
Unload unused dynamic shared objects.
Synopsisvoid XPRMflushdso(void);
Further information
Each unused module is automatically unloaded after a fixed period of time. This function forces
the manager to unload all unused modules.
Related topics
XPRMautounloaddso.

Fair Isaac Corporation Confidential and Proprietary Information

119

Mosel Run Time Library

XPRMgetdsoannotations
PurposeRetrieve annotations defined by a module.
Synopsis
int XPRMgetdsoannotations(XPRMdsolib dso, const char *prefix, const char **ann, int
maxann);Arguments
dso
prefixannmaxannReference to a dynamic shared object loaded by Mosel
Filtering prefix
Array of size maxann where to store the annotations (can be NULL)
Size of ann (to get up to maxann/2 annotations)

Return value
Size of the array required to get all annotations (two times the number of found annotations).
Further information
1. This function retrieves the annotations defined by a module using a prefix as a filter (e.g. use"doc." to get all the documentation annotations). The result is stored in the provided array: eachannotation occupies 2 entries in the array (the first one for the name of the annotation and thefollowing one for its value).
2. The returned value may exceed maxann (but no more than maxann entries are recorded in thearray). To get the required size for ann the function may be called with a NULL array.
Related topics
XPRMgetannotations.

Fair Isaac Corporation Confidential and Proprietary Information120

Mosel Run Time Library

XPRMgetdsoparam
PurposeGet the current value of a control parameter.
Synopsis
int XPRMgetdsoparam(XPRMmodel model, XPRMdsolib dso, const char *name,int *type, XPRMalltypes *value);
Arguments
model
dso
name
type
value

Reference to a model
Reference to a dynamic shared object loaded by Mosel or NULL
Name of the control parameter (lower case only)
Returned type of the control parameter
Returned value of the control parameter

Return value
0 if successful, 1 otherwise.
Further information
1. This function returns the current value of a control parameter of the given module in the context
of the given model. This function requires that the model has been executed and uses therequested module.
2. If the argument dso is NULL, the function looks for the value of a Mosel parameter (like"realfmt").
3. If both arguments dso and model are NULL, the function looks for the default value of a Mosel
parameter (like "realfmt").
4. The type can be decoded using the macro XPRM_TYP. Moreover, the bits XPRM_CPAR_READ and
XPRM_CPAR_WRITE are set to indicate if the parameter can be read or written respectively (using
getparam and setparam).

Fair Isaac Corporation Confidential and Proprietary Information

121

Mosel Run Time Library

XPRMgetnextdso
PurposeGet next dynamic shared object.
Synopsis
XPRMdsolib XPRMgetnextdso(XPRMdsolib dso);
Argument
dso

Reference to a dynamic shared object loaded by Mosel or NULL

Return value
Next dynamic shared object loaded by Mosel or NULL.
Further information
This function returns the next module held in the list of modules loaded by Mosel. If the given
module is at the end of the list, the function returns NULL, if the input parameter is set to NULL,
the function returns the first module in the list.
Related topics
XPRMfinddso.

Fair Isaac Corporation Confidential and Proprietary Information

122

Mosel Run Time Library

XPRMgetnextdsoconst
PurposeGet the next constant in the list of constants defined by the given module.
Synopsisvoid *XPRMgetnextdsoconst(XPRMdsolib dso, void *ref, const char **name,int *type, XPRMalltypes *value);
Arguments
dso
ref
name
type
value

Reference to a dynamic shared object loaded by Mosel
Reference pointer or NULL
Returned name of the constant
Returned type of the constant
Returned value of the constant

Return value
Reference pointer for the next call to XPRMgetnextdsoconst.
Further information
This function returns the next constant defined by the given module. The second parameter isused to store the current location in the table of constants; if this parameter is NULL, the first
constant of the table is returned. This function returns NULL if it is called with the reference to thelast constant defined by the given module. Otherwise, the returned value can be used as the
input parameter ref to get the following constant and so on. The returned information abouttype and value of the constant can be decoded in the same way as for the model identifiers (seeXPRMfindident).
Related topics
XPRMgetnextdsoparam, XPRMgetnextdsoproc, XPRMgetnextdsotype, XPRMgetnextiodrv.

Fair Isaac Corporation Confidential and Proprietary Information

123

Mosel Run Time Library

XPRMgetnextdsodep
PurposeGet the next required module of a module.
Synopsisvoid *XPRMgetnextdsodep(XPRMdsolib dso, void *ref, const char **name);
Arguments
dso
ref
name

Reference to a dynamic shared object loaded by Mosel
Reference pointer or NULL
Returned name of the module

Return value
Reference pointer for the next call to XPRMgetnextdsodep.
Further information
This function returns the next dependency of a module: module dependencies are the othermodules it requires. The second parameter is used to store the current location in the table ofdependencies; if this parameter is NULL, the first dependency of the table is returned. Thisfunction returns NULL if it is called with the reference to the last dependency defined by the given
module. Otherwise, the returned value can be used as the input parameter ref to get thefollowing dependency and so on.

Fair Isaac Corporation Confidential and Proprietary Information

124

Mosel Run Time Library

XPRMgetnextdsotype
PurposeGet the next type in the list of types defined by the given module.
Synopsisvoid *XPRMgetnextdsotype(XPRMdsolib dso, void *ref, const char **name,unsigned int *props);
Arguments
dso
ref
name
props

Reference to a dynamic shared object loaded by Mosel
Reference pointer or NULL
Returned name of the type
Returned properties of the type (may be NULL)

Return value
Reference pointer for the next call to XPRMgetnextdsotype.
Further information
This function returns the name and properties of the next type defined by the given module. The
type properties corresponds to the information returned by function XPRMgettypeprop. The
second parameter is used to store the current location in the table of types; if this parameter is
NULL, the first type of the table is returned. This function returns NULL if it is called with thereference to the last type defined by the given module. Otherwise, the returned value can beused as the input parameter ref to get the following type and so on.
Related topics
XPRMgetnextdsoconst, XPRMgetnextdsoparam, XPRMgetnextdsoproc, XPRMgetnextiodrv,
XPRMgettypeprop.

Fair Isaac Corporation Confidential and Proprietary Information

125

Mosel Run Time Library

XPRMgetnextdsoparam
PurposeGet the next control parameter in the list of the given module.
Synopsisvoid *XPRMgetnextdsoparam(XPRMdsolib dso, void *ref, const char **name,const char **desc, int *type);
Arguments
dso
ref
name
desc
type

Reference to a dynamic shared object loaded by Mosel or NULL
Reference pointer or NULL
Returned name of the control parameter
Returned description of the control parameter
Returned type of the control parameter

Return value
Reference pointer for the next call to XPRMgetnextdsoparam.
Further information
This function returns the next control parameter of the given module. If the argument dso is
NULL, the function returns Mosel control parameters. The second parameter is used to store thecurrent location in the table of control parameters; if this parameter is NULL, the first control
parameter of the table is returned. This function returns NULL if it is called with the reference tothe last parameter of the given module. Otherwise, the returned value can be used as the input
parameter ref to get the following control parameter and so on. The type can be decoded using
the macro XPRM_TYP. Moreover, the bits XPRM_CPAR_READ and XPRM_CPAR_WRITE are set to indicate
if the parameter can be read or written respectively (using getparam and setparam). The
parameter desc is a textual description of the function of the parameter — this information is notnecessarily available (that is, it may be NULL or an empty string). Note that not all modules
implement the required functionality for enumerating control parameters.
Related topics
XPRMgetnextdsoconst, XPRMgetnextdsoproc, XPRMgetnextdsotype XPRMgetnextiodrv.

Fair Isaac Corporation Confidential and Proprietary Information

126

Mosel Run Time Library

XPRMgetnextdsoproc
PurposeGet the next subroutine in the list of the given module.
Synopsisvoid *XPRMgetnextdsoproc(XPRMdsolib dso, void *ref, const char **name,const char **partyp, int *nbpar, int *type);
Arguments
dso
ref
name
partypnbpar
type

Reference to a dynamic shared object loaded by Mosel
Reference pointer or NULL
Returned name of the routine (procedure or function)
Returned string describing the parameters of the routine
Returned number of parameters expected by the routine
Returned type of the result of the routine

Return value
Reference pointer for the next call to XPRMgetnextdsoproc.
Further information
This function returns the next subroutine defined by the given module. The second parameter isused to store the current location in the table of subroutines; if this parameter is NULL, the firstsubroutine of the table is returned. This function returns NULL if it is called with the reference tothe last subroutine defined by the given module. Otherwise, the returned value can be used as
the input parameter ref to get the following subroutine and so on. The type and parameter
string can be decoded in the same way as for the model procedures and functions (seeXPRMgetprocinfo) except that native functions may return objects of native type. In this case, thefunction type is XPRM_TYP_EXTN and the parameter string partyp begins with the name of thefunction type followed by ‘:’ (e.g. "mytype:|mytype|" is the signature of a function of type‘mytype’ expecting an object of type ‘mytype’ as parameter. Note that the same subroutine namemay be returned several times if a subroutine has been defined with different types ofparameters (overloading).
Related topics
XPRMgetnextdsoconst, XPRMgetnextdsoparam, XPRMgetnextdsotype, XPRMgetnextiodrv.

Fair Isaac Corporation Confidential and Proprietary Information

127

Mosel Run Time Library

XPRMgetdsoprop
PurposeGet a property of a dynamic shared object.
Synopsis
int XPRMgetdsoprop(XPRMdsolib dso, int prop, XPRMalltypes *value);
Arguments
dso
prop

value

Reference to a module loaded by Mosel
Property to retrieve. Possible values:
XPRM_PROP_NAME
Module name
XPRM_PROP_ID
Internal number of the module
XPRM_PROP_VERSION
Version number
XPRM_PROP_SYSCOM
Identity of the provider
XPRM_PROP_NBREF
Number of loaded models that use the module
XPRM_PROP_PATHPath to the actual module file
XPRM_PROP_PRIORITY
Priority of the module
XPRM_PROP_NBTYPES
Number of types
Pointer to an area where the model property is returned

Further information
This function returns information about a given module. The type of the property (specified via
the prop argument) decides how the argument value is interpreted: the field string is used for
NAME, SYSCOM and PATH; and integer for the other properties. The returned version number iscoded as an integer, for example, 1.2.3 is coded as 1002003. The module is currently not in use if
the property NBREF is 0.

Fair Isaac Corporation Confidential and Proprietary Information

128

Mosel Run Time Library

XPRMgetnextiodrv
PurposeGet the next IO driver in the list of available drivers.
Synopsisvoid *XPRMgetnextiodrv(void *ref, const char **name,const char **module, const char **info);
Arguments
refnamemoduleinfo

Reference pointer or NULL
Name of the driver (may be NULL)
Name of the module publishing the driver (may be NULL)
Information about the driver (may be NULL)

Return value
Reference pointer for the next call to XPRMgetnextiodrv.
Further information
This function returns the next IO driver in the table of currently available drivers. The firstparameter is used to store the current location in the table; if this parameter is NULL, the first
driver of the table is returned. This function returns NULL if it is called with the reference to thelast driver available. Otherwise, the returned value can be used as the input parameter ref to get
the following driver and so on.
Note that internal drivers have a NULL module name and the default driver has no name (i.e. nameis an empty string). Information returned via info parameter corresponds to the string stored as
the XPRM_IOCTRL_INFO operation for the driver. If this operation is not defined, return value is
NULL.
Related topics
XPRMgetnextdsoconst, XPRMgetnextdsoparam, XPRMgetnextdsoproc, XPRMgetnextdsotype.

Fair Isaac Corporation Confidential and Proprietary Information

129

Mosel Run Time Library

XPRMpreloaddso
PurposeExplicitly load the named module.
Synopsis
XPRMdsolib XPRMpreloaddso(const char *libname);
Argument
libnameName of the module to load

Return value
A reference to a DSO descriptor if the module has been loaded successfully or NULL.
Further information
Mosel loads modules on demand when they are required by the models in core memory.
However, it is possible to force the system to load a module using this function. If the module isalready in memory, no action is performed and the corresponding DSO pointer is returned.
Related topics
XPRMisrunmod, XPRMrunmod.

Fair Isaac Corporation Confidential and Proprietary Information

130

Mosel Run Time Library

1.5

Using IO drivers for data exchange
Mosel comes with a default set of IO drivers which are used as data source/destination. The
selection of the driver is achieved via the file name in use: for instance file name "myfile" is aphysical file handled by the operating system but "mem:myfile" is a block of memory managed by
the mem driver. IO drivers are mainly used to interface specific data sources with Mosel (like odbc
from the mmodbc module). In this context, each data source may require a dedicated driver thatcan be implemented in a user module through the Mosel NI (refer to the Mosel NI Reference
Manual for further explanation). Drivers may also be employed to easily exchange information
between the application running the Mosel Libraries and a model. In particular the predefined
drivers cb, mem and raw are specifically designed for this purpose.

1.5.1 sysfd driverThanks to this driver, a file descriptor provided by the operating system may be used in place of afile. The general syntax of a file name for the sysfd driver is:
sysfd:OSfd

where OSfd is a numerical file descriptor (Posix) or a file handle (Windows). File descriptors areusually returned by C functions open or fileno (from a C-stream obtained with fopen) on Posix
systems. Under Windows, file handles can be created using CreateFile or obtained with
_get_osfhandle (from a C file descriptor) for instance. When a program starts, 3 files areautomatically opened for input, output and errors; they are respectively associated to filenumbers 0,1 and 2 (this applies to both Posix systems and Windows). Mosel uses these filedecriptors as default streams.
Example:XPRMsetdefstream(NULL,XPRM_F_ERROR,"sysfd:1"); /* redirect error to output stream */1.5.2 cb driverThis driver allows using a function as a file. The general syntax of a file name for the cb driver is:
cb:funcaddr[/refval]

where funcaddr is the address of the callback function and the optional parameter refval is apointer (both references must be expressed in hexadecimal). Depending on the type of stream to
manage (i.e. a general stream or a for an initializations block) a specific function type as to beprovided.
1.5.2.1

Handling of general streams

The expected function must have the following prototype:long XPRM_RTC func(XPRMmodel model, void *ref, char *buf, unsigned long size);

Whenever data needs to be transferred, Mosel calls this function indicating the location (buf) andthe size (size) of the buffer to use. The parameter ref is the information provided to Mosel
during the opening of the file (refval above). The model reference may be NULL if the stream isused directly by Mosel (for instance for compilation). When the stream is open for writing, thereturn value of the function is ignored. If the corresponding output stream is open in text mode,the function is called at each end of line and the buffer can be seen as a NULL terminatedcharacter string (the size does not include the terminating character). When used for reading, theFair Isaac Corporation Confidential and Proprietary Information

131

Mosel Run Time Libraryfunction should return the number of bytes actually copied into the buffer (0 means end of file).
Example:long XPRM_RTC simpleout(XPRMmodel model, void *ref, char *buf,
unsigned long size){
printf("OUT: %.*s",(int)size,buf);
return 0;}...
char fname[32];sprintf(fname, "cb:%p", simpleout);
XPRMsetdefstream(NULL, XPRM_F_ERROR, fname);...

1.5.2.2/* redirect error str. to ’simpleout’ */Handling of initializations blocks

In the case of an initializations block, the expected function must be of the following form:
int XPRM_RTC func(XPRMcbinit cbinit, void *ref,const char *label, int type, XPRMalltypes *obj);

When executing an initializations from block, the function is called once for each label withthe label to be initialized (label), its type (type) and a reference to the object (obj). The
parameter ref is the information provided to Mosel during the opening of the file (refval
above). The function must then send to Mosel the data to be used for the initialization of theobject using routines XPRMcb_sendint, XPRMcb_sendreal, XPRMcb_sendstring and
XPRMcb_sendctrl. The 3 first functions provide the basic type values while the last one is used tostructure the data stream (i.e. delimit a list of array indices or a collection of values) in a similar
fashion as in an ASCII initialization file.
Example:int XPRM_RTC initfrom(XPRMcbinit cbinit, void *ref,const char *label,
int type, XPRMalltypes *ref){int i;
if(strcmp(label,"I")==0)/* I:10 */{XPRMcb_sendint(cbinit,10,0)}
else if(strcmp(label,"S")==0) /* S:[1 2 3] */{XPRMcb_sendctrl(cbinit,XPRM_CBC_OPENLST,0);for(i=1;i<=3;i++)
XPRMcb_sendreal(cbinit,(double)i,0);
XPRMcb_sendctrl(cbinit,XPRM_CBC_CLOSELST,0);}else if(strcmp(label,"A")==0) /* A:[(1) "a"] */{XPRMcb_sendctrl(cbinit,XPRM_CBC_OPENLST,0);
XPRMcb_sendctrl(cbinit,XPRM_CBC_OPENNDX,0);
XPRMcb_sendint(cbinit,1,0);
XPRMcb_sendctrl(cbinit,XPRM_CBC_CLOSENDX,0);
XPRMcb_sendstring(cbinit,"a",1,0);
XPRMcb_sendctrl(cbinit,XPRM_CBC_CLOSELST,0);}}/* The associated Mosel code:
declarations
I:integer

Fair Isaac Corporation Confidential and Proprietary Information

132

Mosel Run Time Library

S:set of real
A:array(range) of string
end-declarations
initializations from INITFILE
I S A
end-initialisations*/

Similarly, when executing an initializations to block, the function is called once for each labelwith the object reference, its type and associated label (in this case the first parameter is NULL).
The user function can then inspect the object using the usual routines of the Mosel Runtime
Library.

1.5.3 mem driverWith this driver, a block of memory is used as data source. Three different types of blocks aresupported: named blocks can be used only from a model during its execution, are identified by alabel and their allocation is dynamic. The second type uses a block of memory already allocated:
it is characterized by an address and a size. With the third form the file name corresponds to areference to a dedicated data structure to hold the properties of a memory block managed by
Mosel.
The general syntax of a file name for the mem driver accessing a named block is:
mem:label[/minsize[/incstep]]

where label is an identifier whose first character is a letter and minsize an optional initialamount of memory to be reserved (size is expressed in bytes, in kilobytes with suffix "k" or inmegabytes with suffix "m"). The memory block is allocated dynamically and resized as necessary.
By default the size of the memory block is increased by pages of 4 kilobytes: the optionalparameter incstep may be used to change this page size (i.e. the default setting is "label/0/4k").
The special value 0 modifies the allocation policy: instead of being increased of a fixed amount,the block size is doubled. In all cases unused memory is released when the file is closed.
When a named memory block is used in a model, it is possible to access the block of memory
allocated by the driver by searching for the label in the model’s dictionary: the function
XPRMfindident returns a reference to an object of structure XPRM_STR_MEM that describes thelocation and size of the memory block.
The general syntax of a file name for the mem driver accessing a fixed block is:
mem:addr/size[/actualsize]

where addr and size identify the memory block (the pointer must be expressed in hexadecimal).
Optionally a pointer to a size_t value may be provided (actualsize expressed in hexadecimal):when the stream is open for writing, this variable receives the size actually used by the operation(its value thus ranges between 0 and size). Moreover, if the stream is open in append mode,
writing starts after the location indicated by this value. When the stream is open for reading, thevalue is used in place of size if it is smaller than this upper limit.
Example:char blk[2048];
char fname[40];size_t actualsize;
sprintf(fname, "mem:%p/%u/%p", blk, (int)sizeof(blk), &actualsize);
XPRMcompmod(NULL, "mymodel", fname, NULL);/* compile model to memory */printf("BIM data uses %u bytes.\n", actualsize);
mod=XPRMloadmod(fname, NULL);/* load BIM file from memory */Fair Isaac Corporation Confidential and Proprietary Information

133

Mosel Run Time Library

The last form is similar to first one except that the name of the block is replaced by an address
prefixed by the & symbol:
mem:&addr[/minsize[/incstep]]

where addr is a reference (expressed in hexadecimal) to an XPRMmemblk data structure:
typedef struct{
void *ref;size_t size;} XPRMmemblk;/* Base address of the block *//* Size of the block */When the block is used for the first time, fields of the structure must be cleared: Mosel handles(re)allocation of the memory block when writing to the corresponding memory file. The function
XPRMfreememblk can be used to release the memory allocated through this IO driver (deleting thefile from the Mosel code has the same effect).
Example:XPRMmemblk memblk;
char fname[40];sprintf(fname, "mem:&%p", &memblk);memset(&memblk,0,sizeof(XPRMmemblk));
XPRMcompmod(NULL, "mymodel", fname, NULL);
mod=XPRMloadmod(fname, NULL);
XPRMfreememblk(&memblk)/* compile model to memory *//* load BIM file from memory *//* release BIM file memory */1.5.4 raw driver
The raw driver provides an implementation of the “initializations blocks” in binary mode: insteadof translating information from/to text format, data is kept in its raw representation. Typicallythis driver will be combined with the mem driver in order to exchange arrays of data between themodel and an application through memory without translation. The general syntax of a filename for the raw driver is:
raw:[noindex,align,noalign,append,all,slength=#]When using the raw driver as a file for an initializations block, no actual data location is provided
at the beginning of the block. The driver uses each label as a file name for locating data.
Example:initializations from "raw:noindex"
t as "datafile.bin"r as "mem:0x1234/456"
end-initializations

Data transfer is achieved without conversion: 4 bytes for an integer, 8 bytes for a real, 1 byte for a
Boolean, strings are of fixed size or just an address, external types are translated to strings (if“tostr” is available for the type) and anything else has the size of an address that is 4 or 8 bytes
depending on the architecture. The option slength specifies the fixed length of strings, default
value for this parameter is 16 (shorter strings are padded with 0 characters, longer strings arecut). The special value 0 implies that the address of the string is used.
If option append is specified, files open for writing are open in append mode.
Transfer of scalar is straightforward and sets are treated as a collection of consecutive scalars. The
handling of arrays varies depending on the options: by default, each array element is precededby its indices (for instance t(1,2) is stored or read as 1,2,t(1,2)). If option noindex is in use, only

Fair Isaac Corporation Confidential and Proprietary Information

134

Mosel Run Time Libraryvalues are listed and if option all has been given, all elements of dynamic arrays are listed (bydefault: only existing elements).
The driver aligns data according to the processor architecture requirements assuming the starting
address provided is aligned properly (for instance on Sparc processors real values [or doubles] arealigned on 8 bytes boundaries). Thanks to this property, it is safe to map data exchanged using
this driver with the corresponding structure in the C language.
Example:declarations
a: array(integer,boolean) of real
end-declarations! the above declaration can be mapped to the following C-structure:! struct {!
int ndx1!
char ndx2!
double a_ndx1_ndx2 };! This structure uses 13 bytes with an Intel processor and 16 on a Sparc

This behavior may be changed by using the align and noalign options (for instance for saving
binary data to physical files, alignment is not necessary and uses more memory).
Options may be specified for each label individually: they have to be given as a list preceding theactual filename.
Example: the following model:
parameters
DAT=""
RES=""
end-parameters
declarations
d:array(string) of real
r:array(1..10) of real
end-declarations
initializations from "raw:"
d as "slength=0,mem:"+DAT ! load data from memory location defined by DAT
end-initializations...
initializations to "raw:"
r as "noindex,mem:"+RES ! save results in memory location defined by RES
end-initializations

can be used with the following C-source:
char params[128];
struct { const char *ndx; double v; } d[]={{"one",10}, {"two",0.5}};
double r[10];sprintf(params, "DAT=’%p/%u’, RES=’%p/%u’", d, sizeof(d), r, sizeof(r));
XPRMrunmod(mod, &result, params);

1.5.5 bin driver
Like the raw driver, the bin driver provides an implementation of the “initializations blocks” inbinary mode. However, thanks to a structured and architecture independent data format the bin
driver can handle cross platform files containing all records of an initialisations block. An
application can generate and decode files using this format with the help of the bindrv library.
Refer to the documentation of this library for further explanation.

Fair Isaac Corporation Confidential and Proprietary Information

135

C HAPTER 2

Mosel Model Compiler Library
2.1

Compilation
The Mosel Model Compiler (xprm_mc) Library contains the compiler of Mosel. The main function
provided performs the compilation of a source model file into the corresponding binary model(bim) file. Note that xprm_mc requires the library xprm_rt to be present and even a program using
only the XPRMcompmod function must initialize Mosel with the function XPRMinit.
Programs using the Model Compiler Library must include the header file xprm_mc.h.
Note that all text strings handled by functions of this library are encoded in UTF-8. It is therefore
required to convert text strings to alternate encodings when exchanging data with other libraries
not working with UTF-8. In particular the C library supports either wide characters (wchar_t type)or the default system encoding (that depends on the localisation of the system). These encoding
conversions can be achieved with the help of the XPRNLS library (please refer to the XPRNLS
Reference Manual for further details).
XPRMcompmod, XPRMcompmodsec Compile a model source file.
XPRMexecmod

Compile, load then run a model source file.

Fair Isaac Corporation Confidential and Proprietary Information

p. 137
p. 139136

Mosel Model Compiler Library

XPRMcompmod, XPRMcompmodsec
PurposeCompile a model source file.
Synopsis
int XPRMcompmod(const char *options, const char *srcfile, const char *dstfile, const
char *userc);
int XPRMcompmodsec(const char *options, const char *srcfile, const char *dstfile,const char *userc, const char *passfile, const char *privkey, const char*kfile);Arguments
options

scrfiledstfileuserc
passfile
privkey
kfile
Return value
0
1
2
3
4

Compilation options (may be NULL, options may be separated by spaces or ’-’symbols):"g"
Include debugging information: in the case of a run time error
during the execution of the model the location of the error in thesource file may be indicated"G"
Include tracing information: with this option the model can be run
through the debugger for an execution step by step"s"
Strip symbols: secure the bim file by removing all private symbol
names used in the source model"p"parse only: stop after the syntax analysis of the source file, do notcompile (no file generated)"x"extract messages for translation (generation of a POT file in placeof a BIM file)"wi"Emit a warning message each time a symbol is implicitly declared"D"
Generate and record documentation annotations"bx=prefix"
Package prefix (can be quoted with single or double quotes)"ix=prefix"
Include source prefix (can be quoted with single or double quotes)"S"
Sign the bim file"E"
Encrypt the bim file"F"
The argument pass is a file name (not the password itself)"V"
Accept to load signed packages only if their signature can beverified"T"
Accept to load only signed packages with a valid signature
Name of the source file
Name of the destination file (may be NULL)
Commentary text that will be saved as is at the beginning of the output file (may be
NULL)
Password or password file (for encryption with a password)
Private key file (for bim file signing)
File of public keys (for encryption with public keys)

Function executed sucessfully
Parsing phase has failed (syntax error or file access error)
Error in compilation phase (a semantic error has been detected)
Error writing the output file
License error (compiler not authorized)

Fair Isaac Corporation Confidential and Proprietary Information

137

Mosel Model Compiler Library

Further information
1. This function compiles a given model source file into a binary model file (bim file) that is required
as input to function XPRMloadmod for executing the model. The second form of the function will
be used to generate encrypted and/or signed bim files.
2. The source file name may contain environment variable references using the notation ${varname}(for example,‘${XPRESSDIR}/examples/mymodel’) that are expanded to generate the actual name. If no
destination file name is provided, the output file takes the same name as the source file with theextension .bim. Note that the empty string (i.e. "") is interpreted as the standard input forsrcfile and as the standard output for dstfile.
3. The argument kfile is a list of public key files (i.e. each line of the file is a key file name): whenencrypting a file, the encryption is performed for each of the listed public keys such that the bim
file can be decrypted by any of the corresponding private keys.
4. When prefixes provided via bx or ix are quoted with double quotes, backslashes are interpreted
such that special characters can be included in the string. It is therefore required to double thissymbol when it has to be included (e.g. ’bx="C:
mydir"’).
Related topics
XPRMloadmod, XPRMrunmod, XPRMdbg_runmod.

Fair Isaac Corporation Confidential and Proprietary Information

138

Mosel Model Compiler Library

XPRMexecmod
PurposeCompile, load then run a model source file.
Synopsis
int XPRMexecmod(const char *options, const char *srcfile, const char *parlist, int*returned, XPRMmodel *rtmod);Arguments
options
scrfileparlistreturned
rtmod
Return value<00>0Compilation options (may be NULL)
Name of the source file
String composed of model parameter initializations separated by commas, may be
NULL
Pointer to an area where the result value is returned
Pointer to an area where the model pointer is returned (may be NULL)

Compilation failed
Function executed sucessfully
An error occured during model execution

Further information
This function calls in sequence XPRMcompmod, XPRMloadmod, and then XPRMrunmod (no bim file isgenerated). If parameter rtmod is not NULL, this pointer is initialized with the model reference.
Otherwise, the model is unloaded after execution.
Related topics
XPRMcompmod, XPRMloadmod, XPRMrunmod, XPRMunloadmod.

Fair Isaac Corporation Confidential and Proprietary Information

139

A PPENDIX A

Contacting FICO
FICO provides clients with support and services for all our products. Refer to the following
sections for more information.

Product support
FICO offers technical support and services ranging from self-help tools to direct assistance with a
FICO technical support engineer. Support is available to all clients who have purchased a FICO
product and have an active support or maintenance contract. You can find support contact
information on the Product Support home page (www.fico.com/support).
On the Product Support home page, you can also register for credentials to log on to FICO Online
Support, our web-based support tool to access Product Support 24x7 from anywhere in the world.
Using FICO Online Support, you can enter cases online, track them through resolution, findarticles in the FICO Knowledge Base, and query known issues.
Please include ’Xpress’ in the subject line of your support queries.

Product education
FICO Product Education is the principal provider of product training for our clients and partners.
Product Education offers instructor-led classroom courses, web-based training, seminars, andtraining tools for both new user enablement and ongoing performance support. For additional
information, visit the Product Education homepage at www.fico.com/en/product-training or
email producteducation@fico.com.

Product documentation
FICO continually looks for new ways to improve and enhance the value of the products andservices we provide. If you have comments or suggestions regarding how we can improve thisdocumentation, let us know by sending your suggestions to techpubs@fico.com.

Fair Isaac Corporation Confidential and Proprietary Information

140

Contacting FICO

Sales and maintenanceUSA, CANADA AND ALL AMERICASEmail: XpressSalesUS@fico.com
WORLDWIDE
Email: XpressSalesUK@fico.com
Tel: +44 207 940 8718
Fax: +44 870 420 3601
Xpress Optimization, FICO
FICO HouseInternational Square
Starley Way
Birmingham B37 7GN
UK

Related services
Strategy Consulting: Included in your contract with FICO may be a specified amount ofconsulting time to assist you in using FICO Optimization Modeler to meet your business needs.
Additional consulting time can be arranged by contract.
Conferences and Seminars: FICO offers conferences and seminars on our products and services.
For announcements concerning these events, go to www.fico.com or contact your FICO accountrepresentative.

About FICO
FICO (NYSE:FICO) delivers superior predictive analytics solutions that drive smarter decisions. The
company’s groundbreaking use of mathematics to predict consumer behavior has transformed
entire industries and revolutionized the way risk is managed and products are marketed. FICO’sinnovative solutions include the FICO® Score—the standard measure of consumer credit risk in
the United States—along with industry-leading solutions for managing credit accounts,
identifying and minimizing the impact of fraud, and customizing consumer offers with pinpoint
accuracy. Most of the world’s top banks, as well as leading insurers, retailers, pharmaceuticalcompanies, and government agencies, rely on FICO solutions to accelerate growth, control risk,
boost profits, and meet regulatory and competitive demands. FICO also helps millions ofindividuals manage their personal credit health through www.myfico.com. Learn more atwww.fico.com. FICO: Make every decision countTM .

Fair Isaac Corporation Confidential and Proprietary Information

141

IndexA
activity
get, 87
annotations
get, 28, 120
array, 2, 35
check indices, 72
dynamic, 62
dynamic bounded, 62
general, 62
get dimensions, 63
get entry, 74
get first entry, 67
get first true entry, 70
get indices, 66
get last entry, 68
get next entry, 69
get next true entry, 71
get size, 65
get type, 64
indexing set, 55
logical entry, 62
storage class, 62
true entry, 62
types, 62Bbim, 19, 138
binarymodel file, 138
binary model file, 19, 136
Boolean, 2, 35
breakpoint, 101
clearing, 111setting, 110C
checkarray indices, 72
running model, 24
columnget number, 88
comment
user, 137
compareindices, 73
compilemodel, 137, 139constant, 35
next, 123
constraint
get activity, 87

Fair Isaac Corporation Confidential and Proprietary Information

get dual, 85
get number, 89
get slack, 86
linear, 2, 35
control parameter, 121
next, 126D
dateconvert to JDN, 93, 94
current, 95
debugging, 137
decision variable, see variable
dependency
next, 30, 124dimensionget, 63
DSO, see dynamic shared object, 113
dualget, 85
dynamic array, 62
dynamic bounded array, 62
dynamic library, see dynamic shared object
dynamic shared object, 2, 113
descriptor, 118
get next, 122
get property, 128load, 130next constant, 123
next control parameter, 126
next subroutine, 127
next type, 125parameter, 121
unload, 119Eelement
get value, 58
entry
get first, 67
get first true, 70
get last, 68
get next, 69
get next true, 71
logical, 62
true, 62
executemodel, 23, 103
exportproblem, 80
F
file

142

Indexoutput, 80
find
identifier, 35
model, 32
type, 38
finish, 6function, 35
information, 47
next, 127
next overloading, 44G
getactivity, 87
array dimensions, 63
array entry, 74
array indices, 66
array size, 65
array type, 64
column number, 88
dual, 85
dynamic shared object, 118
dynamic shared object property, 128
element value, 58
first array entry, 67
first index, 60
first true array entry, 70
index, 59
last array entry, 68
last index, 61
list size, 51
list type, 52
model, 32
model property, 29
next array entry, 69
next constant, 123
next control parameter, 126
next dynamic shared object, 122
next identifier, 41
next model, 31
next overloading, 44
next parameter, 42
next subroutine, 127
next true array entry, 71
next type, 125
objective, 81
parameter, 121
problem status, 79
reduced cost, 84
row number, 89
set size, 56
set type, 57
signature, 47
slack, 86
solution value, 82, 83
version, 17, 18
I
I/O driver, 131bin:, 135

Fair Isaac Corporation Confidential and Proprietary Information

cb:, 131
mem:, 133
raw:, 134
sysfd:, 131
identifier
find, 35
next, 41
index
get, 59
get first, 60
get last, 61
index set, 55
indicescheck, 72
compare, 73
infeasible problem, 79
initialization, 3, 4
integer, 2, 35
interrupt
model, 25
J
JDN, 93Llibrary
Model Compiler, 1, 136
native, 113
Run Time, 1, 2line index, 101, 106
get number of, 107
get source location, 108of a procedure/function, 109
linear constraint, 2, 35
list, 2, 35, 50
get elements, 53, 54
get size, 51
get type, 52
storage class, 52
load
dynamic shared object, 130
model, 20
logical entry, 62
LP format, 80
Mmain problem, 78
maximization, 80
memory block, 35
minimization, 80
model, 2check running, 24compile, 137, 139
debug, 103
find, 32
get next, 31
get problem status, 79
get property, 29load, 20
reset, 22143

Indexrun, 23, 103
stop, 25
unload, 27
Model Compiler Library, 1, 136
model file, 136
binary, 19, 138
model property
get, 29
module, see dynamic shared object, 113
Mosel
finish, 6
initialization, 4
initialize, 5version, 17
MPS format, 80
N
names
scramble, 80
native library, 113
next
identifier, 41
local identifier, 105
overloading, 44
parameter, 42Oobjective
get value, 81
optimal solution, 79
optimization
failed, 79
unfinished, 79
output, 80
output format, 80
overloading, 44, 127Pparameter, 121
next, 42post processing interface, 33
problem
active, 78
export, 80
get status, 79
infeasible, 79
select, 90
unbounded, 79
problem component
next, 43
procedure, 35
information, 47
next, 127
next overloading, 44
Rrange, 55
range set, 55, 60, 61
real, 2, 35
record, 75
get field value, 77

Fair Isaac Corporation Confidential and Proprietary Information

get fields, 76
reduced costget, 84
reference, 35
requirement
next, 45
resetting model, 22row
get number, 89
runmodel, 23, 103
Run Time Library, 1, 2
Sscrambled names, 80
set, 2, 35, 55
get element value, 58
get first index, 60
get index, 59
get last index, 61
get size, 56
get type, 57
storage class, 57
signature, 47
size
get, 51, 56, 65
slack
get, 86
solutionget, 82, 83
get value, 81
optimal, 79
status, 79
source file, 137, 139
source model file, 136
stack frame, 101changing, 112
stopmodel, 25
storage classarray, 62list, 52
set, 57
string, 2, 35
strip symbols, 137
structure, 35
subroutine
next, 127
symbolstrip, 137
Ttable, see arrayterminate, 6
termination, 3, 6
tracing, 137
true entry, 62
type, 35
array, 62
basic, 2144

Indexfind, 38
get, 52, 57, 64
get property, 48
next, 125
types
all, 35
U
unbounded problem, 79
unfinishedoptimization, 79
unloaddynamic shared object, 119model, 27
user comment, 137
user type, 35
Vvariable, 2, 35
get number, 88
get reduced cost, 84
get solution, 82, 83
X
XPRM_DBG_CONT, 104
XPRM_DBG_NEXT, 104
XPRM_DBG_STEP, 104
XPRM_DBG_STOP, 104
xprm_mc, 136
XPRM_MTP_APPND, 48
XPRM_MTP_COPY, 48
XPRM_MTP_CREAT, 48
XPRM_MTP_DELET, 48
XPRM_MTP_FRSTR, 48
XPRM_MTP_ORSET, 48
XPRM_MTP_PROB, 48
XPRM_MTP_PRTBL, 48
XPRM_MTP_RFCNT, 48
XPRM_MTP_TOSTR, 48
XPRM_PBCHG, 79
XPRM_PBINF, 79
XPRM_PBOPT, 79
XPRM_PBOTH, 79
XPRM_PBSOL, 79
XPRM_PBUNB, 79
XPRM_PBUNF, 79
xprm_rt, 2
XPRM_RT_BREAK, 23, 104
XPRM_RT_ENDING, 104
XPRM_RT_ERROR, 23, 103
XPRM_RT_EXIT, 104
XPRM_RT_IOERR, 23, 103
XPRM_RT_MATHERR, 23, 103
XPRM_RT_NIFCT, 104
XPRM_RT_OK, 23, 103
XPRM_RT_STOP, 23, 103
XPRM_STR_ARR, 35
XPRM_STR_CONST, 35
XPRM_STR_LIST, 35
XPRM_STR_MEM, 35

Fair Isaac Corporation Confidential and Proprietary Information

XPRM_STR_PROB, 48
XPRM_STR_PROC, 35
XPRM_STR_REC, 48
XPRM_STR_REF, 35
XPRM_STR_SET, 35
XPRM_STR_UTYP, 35
XPRM_TYP_BOOL, 35
XPRM_TYP_INT, 35
XPRM_TYP_LINCTR, 35
XPRM_TYP_MPVAR, 35
XPRM_TYP_NOT, 35
XPRM_TYP_REAL, 35
XPRM_TYP_STRING, 35
XPRMalltypes, 35
XPRMarray, 2
XPRM_ARR_DENSE, 64
XPRMattrdesc, 2
XPRMautounloaddso, 117
XPRMboolean, 2
XPRMcb_sendctrl, 100
XPRMcb_sendint, 97
XPRMcb_sendreal, 98
XPRMcb_sendstring, 99
XPRMchkarrind, 72
XPRMcmpindices, 73
XPRMcompmod, 137
XPRMcompmodsec, 137
XPRMdate2jdn, 93
XPRMdbg_clearbrkp, 111
XPRMdbg_findproclndx, 109
XPRMdbg_getlndx, 106
XPRMdbg_getlocation, 108
XPRMdbg_getnblndx, 107
XPRMdbg_getnextlocal, 105
XPRMdbg_runmod, 103
XPRMdbg_setbrkp, 110
XPRMdbg_setstacklev, 112
XPRMdsolib, 2
XPRMdsotyptostr, 34
XPRMexecmod, 139
XPRMexportprob, 78, 80
XPRMfindattrdesc, 37
XPRMfinddso, 118
XPRMfindident, 35
XPRMfindmod, 32
XPRMfindtypecode, 38
XPRMfinish, 3, 6
XPRMflushdso, 119
XPRMfree, 6
XPRMfreelibpath, 9
XPRMfreememblk, 92
XPRMgetact, 87
XPRMgetannotations, 28
XPRMgetarrdim, 63
XPRMgetarrsets, 66
XPRMgetarrsize, 65
XPRMgetarrtype, 64
XPRMgetarrval, 74
XPRMgetattr, 39
XPRMgetcsol, 83145

IndexXPRMgetctrnum, 89
XPRMgetdefworkdir, 7
XPRMgetdsoannotations, 120
XPRMgetdsoparam, 121
XPRMgetdsopath, 115
XPRMgetdsoprop, 128
XPRMgetdual, 85
XPRMgetelsetndx, 59
XPRMgetelsetval, 58
XPRMgetfieldval, 77
XPRMgetfirstarrentry, 67
XPRMgetfirstarrtruentry, 70
XPRMgetfirstsetndx, 60
XPRMgetlastarrentry, 68
XPRMgetlastsetndx, 61
XPRMgetlibpath, 8
XPRMgetlicerrmsg, 5
XPRMgetlistsize, 51
XPRMgetlisttype, 52
XPRMgetlocaledir, 15
XPRMgetmodprop, 29
XPRMgetnextanident, 40
XPRMgetnextarrentry, 69
XPRMgetnextarrtruentry, 71
XPRMgetnextattrdesc, 46
XPRMgetnextdep, 30
XPRMgetnextdso, 122
XPRMgetnextdsoconst, 123
XPRMgetnextdsodep, 124
XPRMgetnextdsoparam, 126
XPRMgetnextdsoproc, 127
XPRMgetnextdsotype, 125
XPRMgetnextfield, 76
XPRMgetnextident, 41
XPRMgetnextiodrv, 129
XPRMgetnextlistelt, 53
XPRMgetnextmod, 31
XPRMgetnextparam, 42
XPRMgetnextpbcomp, 43
XPRMgetnextproc, 44
XPRMgetnextreq, 45
XPRMgetobjval, 81
XPRMgetprevlistelt, 54
XPRMgetprobstat, 79
XPRMgetprocinfo, 47
XPRMgetrcost, 84
XPRMgetsdmax, 16
XPRMgetsetsize, 56
XPRMgetsettype, 57
XPRMgetslack, 86
XPRMgettypeprop, 48
XPRMgetvarnum, 88
XPRMgetversion, 17
XPRMgetversions, 18
XPRMgetvsol, 82
XPRM_GRP, 52, 57, 64
XPRM_GRP_DYN, 62
XPRM_GRP_DYN, 52, 57
XPRM_GRP_GEN, 62
XPRM_GRP_GEN, 57

Fair Isaac Corporation Confidential and Proprietary Information

XPRMinit, 3, 4
XPRMinteger, 2
XPRMisrunmod, 24
XPRMjdn2date, 94
XPRMlinctr, 2
XPRMlist, 2
XPRMloadmod, 19, 20
XPRMloadmodsec, 20
XPRMmodel, 2, 19
XPRMmpvar, 2
XPRMpathcheck, 96
XPRM_PBRES, 79
XPRMpreloaddso, 130
XPRMproc, 2
XPRMreal, 2
XPRMregstatdso, 116
XPRMremovetmpdir, 14
XPRMresetmod, 22
XPRMrunmod, 23
XPRMselectprob, 90
XPRMset, 2
XPRMsetdefstream, 21
XPRMsetdefworkdir, 10
XPRMsetdsopath, 114
XPRMsetlocaledir, 11
XPRMsetrestrictions, 12
XPRMsetsdmax, 13
XPRMstoprunmod, 25
XPRM_STR, 35
XPRMstring, 2
XPRMtermrunmod, 26
XPRMtime, 95
XPRM_TYP, 35, 52, 57, 64
XPRMunloadmod, 27

146