Overview
Thanks to the Mosel Distributed Framework a Mosel model can start Mosel instances and use them to compile and run other models. The XPRD package implements the protocol used by the Mosel Distributed Framework such that an application using this library can perform the same general operations as a model using the mmjobs module: connect a new instance, compile models, load and run bim files, as well as access remote files and exchange events with running models. The following example shows the typical structure of a program using XPRD (for the sake of clarity error handling is not included):
{ XPRDcontext xprd; XPRDmosel mosel; XPRDmodel model; /* Create an XPRD context */ xprd=XPRDinit(); /* Start an instance on host 'xpserver' */ mosel=XPRDconnect(xprd, "xpserver", NULL, NULL, NULL, 0); /* Compile model from local source - bim file saved on remote instance */ XPRDcompmod(mosel, "", "rmt:mymod.mos", "mymod.bim", ""); /* Load bim file */ model=XPRDloadmod(mosel, "mymod.bim"); /* Run model */ XPRDrunmod(model, ""); /* Wait for termination of model before finishing */ XPRDwaitevent(xprd,-1); printf("status: %d exit code:%d\n", XPRDgetstatus(model), XPRDgetexitcode(model)); XPRDunloadmod(model); XPRDdisconnect(mosel); XPRDfinish(xprd); }
The obvious use of XPRD is when Xpress is not installed on the host running the application: in this case one (or several) remote Mosel instance(s) can be launched on host(s) supporting Xpress. This is a requirement if the application is running on an architecture for which Xpress is not available but may also be useful if the application is executed on a machine with insufficient computational resources. In this scenario, the execution of models may be transfered to dedicated servers or even to some cloud computing facility.
XPRD can also be helpful when the models are to be run on the same host as the application calling the models. In this case, the program could of course use directly the usual Mosel libraries for its optimisation tasks and run models from the same process as the application itself. However, in certain cases it might be preferable to run the optimisation tasks in a separate process in order to preserve the application when resources required by the solution process cannot be predicted or if the models to be run are not coming from a trusted source. For example, an application using XPRD can start Mosel from a process with a limited amount of memory or CPU.
The XPRD package has no dependency on any external library and the Java version is written in pure Java (as opposed to the Mosel Java libraries that rely on native calls): as a consequence, an application using XPRD does not require any supplementary installation task and can be written in pure Java.
© 2001-2019 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.