Initializing help system before first use

Functions of the Native Interface

Topics covered in this chapter:

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

Add an element to a list.
Get the size of a list.
Get the type of a list.
Get the next element of a list.
Get the previous element of a list.
Insert an element into a list.
Remove all elements of a list.

Set access

Add an element to set.
Finalize a set.
Get the index of a set element.
Get the value of an element of a set.
Get the index of the first element in a given set.
Get the index of the last element in a set.
Get the size of a set.
Get the type of a set.
Check if an element is contained in a set.
Modify the structure of a set for fast element retrieval.
Remove all elements of a set.
Restore a mapped set to its initial state.

Array access

Begin an array initialization.
Check whether an index tuple of an array is valid.
Release the sorted index table of a hashmap array.
Compare two index tuples.
Delete an array entry.
Terminate an array initialization.
Check whether a given entry in a sparse array has been created.
Get the number of dimensions of an array.
Get the index sets of an array.
Get the size of an array.
Get the type of an array.
Get the value of an array entry.
Get the list of indices of the first entry of an array.
Get the list of indices of the first true entry of an array.
Get the list of indices of the last entry of an array.
Get the list of indices of the next entry of an array.
Get the list of indices of the next true entry of an array.
Set the value of an array entry.

Module types access

Compare two objects of the same external type.
Perform an assignment between two objects of the same external type.
Initialise an object of a module or union type using a string.
Get a string representation from a module or union type reference.
Find an attribute descriptor from its name.
Get the tuple of indices corresponding to an array indexer.
Get an attribute of an entity.

Record access

Get the value of a field of a record.
Get the next field of a record type.
Set the value of a field of a record.

Union access

Get the content of a union and perform type expansion as necessary.
Get the next compatible type of a union type.
Get the type and structure of the value stored in a union.
Get the type ID of the value stored in a union.
Get the type ID of a union.
Get the value stored in a union.
Test whether a type ID is compatible with a union type.
Reset a union entity.
Set the value of a union.
Set the value of a union as a reference to an entity.

Problem and solution access

Export the active problem to a file.
Get the activity value of a linear constraint.
Get the solution value of a linear constraint.
Enumerate the list of terms contained in a linear constraint.
Get the row number of a linear constraint.
Get the type of a linear constraint
Get the dual value of a linear constraint.
Get the objective function value.
Get the problem status of a model.
Get the reduced cost value of a variable.
Get the slack value of a linear constraint.
Get the column number of a decision variable.
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.

Change the MIP solver interface currently in use.
Generate row, SOS and column names.
Get the reference of the variable causing the failure in `loadmat'.
Get matrix size information.
Get the MIP solver interface currently in use.
Get a row, SOS or column name.
Get the next column in the matrix.
Get the next row in the matrix.
Get the next SOS in the matrix.
Get the next constraint in the problem.
Get the current objective function.
Get the internal order number of a decision variable.
Get the reference of the variable or constraint causing the failure in `loadmat'.
Compare order number of two decision variables.
Produce a matrix representation of the current problem.
Change the order of the columns in a matrix.
Release the memory used for solving a problem.
Set the problem status.

Dictionary access

Generate entities names for a given set of types.
Get the constant object associated to a CSREF structure.
Find an identifier in the dictionary.
Find the code associated to a type.
Retrieve annotations of a model.
Retrieve the name associated to an entity.
Get the next annotated identifier in the dictionary.
Get the next identifier in the dictionary.
Get the next parameter of the model.
Enumerate components of a problem type.
Get the next overloaded version of a procedure or function.
Get the procedure/function information.
Get a property of a type.
Associate a name with an entity.

Model execution and handling of modules

Call a procedure/function of the running model.
Check whether the model is signaled for termination.
Close a module previously opened with opendso.
Find a DSO descriptor from a module name.
Get the running context and IMCI interface of a module.
Get the current value of a control parameter.
Get a property of a dynamic shared object.
Get a property of running model.
Get the next module loaded for the model.
Get a Mosel control parameter value.
Open a module and retrieve its IMCI interface.
Set the value of a control parameter.
Stop the current execution.

Input and output

Display an error message.
Close the current input, output or error stream.
Copy a file.
Check if the current input stream is at the end of the file.
Flush the current output stream.
Get the stream number of the current input, output or stream.
Retrieve information about current input, output or error stream.
Read a text string from the current input stream.
Move (rename) a file.
Open a file and select it as the current input/output/error stream.
Read a block of data from the current input stream.
Remove (delete) a file.
Select a stream to be the current input, output or error stream.
Get the size of a file.
Skip a block of data from the current input stream.
Write a block of data to the current output stream.
Send a message to the current output stream.
Set an error message for an IO driver operation.

Miscellaneous

Convert a date into a Julian Day Number (JDN).
Get a source file location associated to a given line index.
Decrease the reference count of a referenced object.
Generate a random number.
Get the type ID of a set, list, array or union.
Get version numbers.
Compute a hash value of a data buffer.
Release a hashmap.
Retrieve the content of a hashmap.
Iterate over all elements of a hashmap.
Get a reference to the value associated with a key in a hashmap.
Get the value associated with a key in a hashmap.
Create a new hashmap.
Set the value associated with a key in a hashmap.
Check whether the provided entity is defined.
Convert a Julian Day Number (JDN) into a calendar date.
Allocate memory from the Mosel memory manager.
Free a block of memory of the Mosel memory manager.
Get an estimate of the memory usage of an entity, a module or the entire model.
Create a constant reference.
Generate a unique identifier.
Increase the reference count of a referenced object.
Normalize a file name.
Expand a path name and check whether it can be accessed.
Generate the textual representation of a real value.
Register a text string.
Set the value of a global identifier.
Allocate memory on the Mosel execution stack.
Release memory from the Mosel execution stack.
Get the current date and time.

© 2001-2022 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.