Initializing help system before first use

Functions of the Native Interface

During its initialization, the module receives a pointer of type XPRMnifct. This entity is the address of the table of functions of the Native Interface. Through this table the module can call Mosel functions in order to get information on the objects currently handled by the running model but also change values of these objects as well as call functions and procedures of the model.

Example:

static XPRMnifct mm;
...
mm->dispmsg(ctx,"error message\n")   /* Display an error message */
...

Note that all text strings handled by functions of the Native Interface 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).

List access

addellist
Add an element to a list.
getlistsize
Get the size of a list.
getlisttype
Get the type of a list.
getnextlistelt
Get the next element of a list.
getprevlistelt
Get the previous element of a list.
insellist
Insert an element into a list.
resetlist
Remove all elements of a list.

Set access

addelset
Add an element to set.
fnlset
Finalize a set.
getelsetndx
Get the index of a set element.
getelsetval
Get the value of an element of a set.
getfirstsetndx
Get the index of the first element in a given set.
getlastsetndx
Get the index of the last element in a set.
getsetsize
Get the size of a set.
getsettype
Get the type of a set.
isinset
Check if an element is contained in a set.
mapset
Modify the structure of a set for fast element retrieval.
resetset
Remove all elements of a set.
unmapset
Restore a mapped set to its initial state.

Array access

beginarrinit
Begin an array initialization.
chkarrind
Check whether an index tuple of an array is valid.
cmpindices
Compare two index tuples.
endarrinit
Terminate an array initialization.
getarrdim
Get the number of dimensions of an array.
getarrsets
Get the index sets of an array.
getarrsize
Get the size of an array.
getarrtype
Get the type of an array.
getarrval
Get the value of an array entry.
getfirstarrentry
Get the list of indices of the first entry of an array.
getfirstarrtruentry
Get the list of indices of the first true entry of an array.
getlastarrentry
Get the list of indices of the last entry of an array.
getnextarrentry
Get the list of indices of the next entry of an array.
getnextarrtruentry
Get the list of indices of the next true entry of an array.
setarrval
Set the value of an array entry.

Module types access

copyval
Perform an assignment between two objects of the same external type.
dsotypfromstr
Initialise an object of a module type using a string.
dsotyptostr
Get a string representation from a module type reference.
findattrdesc
Find an attribute descriptor from its name.
getattr
Get an attribute of an entity.

Record access

getfieldval
Get the value of a field of a record.
getnextfield
Get the next field of a record type.
setfieldval
Set the value of a field of a record.

Problem and solution access

exportprob
Export the active problem to a file.
getact
Get the activity value of a linear constraint.
getcsol
Get the solution value of a linear constraint.
getctrnextterm
Enumerate the list of terms contained in a linear constraint.
getctrnum
Get the row number of a linear constraint.
getctrtyp
Get the type of a linear constraint
getdual
Get the dual value of a linear constraint.
getobjval
Get the objective function value.
getprobstat
Get the problem status of a model.
getrcost
Get the reduced cost value of a variable.
getslack
Get the slack value of a linear constraint.
getvarnum
Get the column number of a decision variable.
getvsol
Get the solution value of a variable.

Matrix related functions

The functions presented in this section are used to obtain the matrix representation of the current problem (LP/MIP) from Mosel and to inform Mosel about the result of a solution process that has been used on the provided matrix. The data structure used to represent a matrix (XPRMmatrix) is not described in this document, the reader is referred to the header file mosel_sl.h for further details. The structure XPRMmipsolver is documented with the function loadmat.

chgmatsolv
Change the MIP solver interface currently in use.
genmpnames
Generate row, SOS and column names.
getinfcause
Get the reference of the variable causing the failure in `loadmat'.
getmatsize
Get matrix size information.
getmatsolv
Get the MIP solver interface currently in use.
getmpname
Get a row, SOS or column name.
getnextcol
Get the next column in the matrix.
getnextrow
Get the next row in the matrix.
getnextsos
Get the next SOS in the matrix.
getprobnextctr
Get the next constraint in the problem.
getprobobj
Get the current objective function.
getvarorder
Get the internal order number of a decision variable.
loadmat
Produce a matrix representation of the current problem.
reordercols
Change the order of the columns in a matrix.
resetsolv
Release the memory used for solving a problem.
setprobstat
Set the problem status.

Dictionary access

buildnames
Generate entities names for a given set of types.
findident
Find an identifier in the dictionary.
findtypecode
Find the code associated to a type.
getnextident
Get the next identifier in the dictionary.
getnextparam
Get the next parameter of the model.
getnextpbcomp
Enumerate components of a problem type.
getnextproc
Get the next overloaded version of a procedure or function.
getprocinfo
Get the procedure/function information.
gettypeprop
Get a property of a type.

Model execution and handling of modules

callproc
Call a procedure/function of the running model.
chkinterrupt
Check whether the model is signaled for termination.
closedso
Close a module previously opened with opendso.
finddso
Find a DSO descriptor from a module name.
getdsoctx
Get the running context and IMCI interface of a module.
getdsoparam
Get the current value of a control parameter.
getdsoprop
Get a property of a dynamic shared object.
getmodprop
Get a property of running model.
getparam
Get a Mosel control parameter value.
opendso
Open a module and retrieve its IMCI interface.
setdsoparam
Set the value of a control parameter.
stoprun
Stop the current execution.

Input and output

dispmsg
Display an error message.
fclose
Close the current input, output or error stream.
fcopy
Copy a file.
feof
Check if the current input stream is at the end of the file.
fflush
Flush the current output stream.
fgetid
Get the stream number of the current input, output or stream.
fgetinfo
Retrieve information about current input, output or error stream.
fgets, fgetsl
Read a text string from the current input stream.
fmove
Move (rename) a file.
fopen
Open a file and select it as the current input/output/error stream.
fread
Read a block of data from the current input stream.
fremove
Remove (delete) a file.
fselect
Select a stream to be the current input, output or error stream.
fskip
Skip a block of data from the current input stream.
fwrite
Write a block of data to the current output stream.
printf
Send a message to the current output stream.
setioerrmsg
Set an error message for an IO driver operation.

Miscellaneous

date2jdn
Convert a date into a Julian Day Number (JDN).
dbggetlocation
Get a source file location associated to a given line index.
delref
Decrease the reference count of a referenced object.
getrand
Generate a random number.
getversions
Get version numbers.
hmdel
Release a hashmap.
hmdump
Retrieve the content of a hashmap.
hmfind
Get a reference to the value associated with a key in a hashmap.
hmget
Get the value associated with a key in a hashmap.
hmnew
Create a new hashmap.
hmset
Set the value associated with a key in a hashmap.
jdn2date
Convert a Julian Day Number (JDN) into a calendar date.
newmuid
Generate a unique identifier.
newref
Increase the reference count of a referenced object.
normfname
Normalize a file name.
pathcheck
Expand a path name and check whether it can be accessed.
realtostr
Generate the textual representation of a real value.
regstring
Register a text string.
setglobal
Set the value of a global identifier.
time
Get the current date and time.