Initializing help system before first use

Model.run

Purpose
Execute the model with optional input data.
Synopsis
function model.run(input_data=None, exec_params=None) -> dict
Arguments
input_data 
Dictionary of input data to pass to the model via the moselpy: driver. Keys are identifier names, values are Python objects convertible to Mosel types.
exec_params 
Execution parameters as a string ( "PARAM1=val1,PARAM2=val2") or list of strings ( ["PARAM1=val1", "PARAM2=val2"]). Sets values for model parameters (defined in the parameters block) and control parameters of modules/packages ( e.g., "mypkg.param=value"). The special parameter workdir defines the initial working directory.
Return value
Dictionary of output data collected via initializations to "moselpy:"
Example
Run with input and output data:
model = mp.load_model("model.bim")
output = model.run(
    input_data={"x": 10, "arr": {1: 100, 2: 200}},
    exec_params={"VERBOSE": 1, "workdir": "/tmp"}
)
print(output["result"])
Further information
1. Input data is made available to the Mosel model via the moselpy: I/O driver in initializations from "moselpy:" blocks. No special compile options are required: the driver works with normally compiled models (no debug flags needed).
2. Output data is collected from initializations to "moselpy:" blocks and returned as a dictionary.
3. After execution, check Model.exec_status for execution status and Model.exit_code for the result value (from Mosel's exit statement, or 0 if not called). The exit_code is only meaningful when exec_status is ExecStatus.OK.
4. A model can be run multiple times. Model.reset is automatically called before each run to release resources from the previous execution.
5. Threading: The module holds Python's Global Interpreter Lock (GIL) during execution. Multiple Model instances can exist, but only one can execute at a time within the same process. For parallel model execution, use Mosel's mmjobs module within a single model or run separate Python processes.
Related topics
Module
moselpy

© 2001-2026 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.