/******************************************************* Mosel Example Problems ====================== file runrtparqueued.java ```````````````````````` Running several instances of a model from another Mosel model. - Queuing submodels for parallel execution in a distributed architecture (one or several models per node) - Before running this model, you need to set up the list NodeList with machine names/addresses of your local network. All nodes that are used need to have the same version of Xpress installed and suitably licensed, and the server "xprmsrv" must have been started on these machines. The maximum number of models per node in array MaxMod needs to be adapted to the number of executions licensed on the corresponding nodes. All files are local to the root node, no write access is required at remote nodes. (c) 2012 Fair Isaac Corporation author: S. Heipcke & Y. Colombani, Apr. 2012 *******************************************************/ import com.dashoptimization.*; import java.lang.*; import java.util.*; import java.io.*; public class runrtparqueued { static final int J=10; // Number of jobs to run static final int NUMPAR=2; // Number of parallel model executions // (preferrably <= no. of processors) static int[] jobid; static int[] modid; static String[] modNode; public static void main(String[] args) throws Exception { XPRD xprd=new XPRD(); // Use the name or IP address of a machine in // your local network, or "" for current node String[] NodeList={"localhost","localhost"}; final int nbNodes=(NodeList.length JobList=new ArrayList(); List JobsRun=new ArrayList(); int JobSize; XPRDEvent event; int lastId=0; //**** Setting up remote Mosel instances **** for(int n=0;nlastId) lastId=modPar[nct].getNumber(); nct++; } jobid=new int[lastId+1]; modid=new int[lastId+1]; modNode=new String[lastId+1]; for(int j=0;j jobList,XPRDModel model) throws Exception { Integer job; int i; job=jobList.remove(0); // Retrieve and remove first entry from job list i=job.intValue(); System.out.println("Start job "+ job + " (model " + modid[model.getNumber()]+ ") on "+ modNode[model.getNumber()] ); model.execParams = "PARAM1=" + i + ",PARAM2=" + (0,1*i) + ",PARAM3='a string " + i + "',PARAM4=" + (i%2==0); model.run(); jobid[model.getNumber()]=i; } }