24    public static void main(String[] args) {
 
   30        File workingDirectory = 
new File(System.getProperty(
"user.dir"), 
"Transport8");
 
   31        workingDirectory.mkdir();
 
   42        Queue<Double> bmultQueue = 
new LinkedList<Double>(
 
   43             Arrays.asList( Double.valueOf(0.6), Double.valueOf(0.7), Double.valueOf(0.8), Double.valueOf(0.9),
 
   44                            Double.valueOf(1.0), Double.valueOf(1.1), Double.valueOf(1.2), Double.valueOf(1.3) )
 
   48        Object IOLockObject = 
new Object();
 
   49        int numberOfWorkers = 2;
 
   50        Scenarios[] scenarios = 
new Scenarios[numberOfWorkers];
 
   51        for (
int i=0; i<numberOfWorkers; i++) {
 
   52             scenarios[i] = 
new Scenarios( ws, cp, bmultQueue, IOLockObject, i );
 
   55        for (
int i=0; i<numberOfWorkers; i++) {
 
   58            } 
catch (InterruptedException e) {
 
   65    static class Scenarios 
extends Thread {
 
   69        Queue<Double> bmultQueue;
 
   82              IOLockObject = IOLockObj;
 
   90              synchronized (bmultQueue) {
 
  102              bmult.addRecord().setValue( 1.0 );
 
  107                  synchronized (bmultQueue) {
 
  108                       if (bmultQueue.isEmpty())
 
  111                         b = bmultQueue.remove();
 
  113                  bmult.getFirstRecord().setValue(b);
 
  116                  synchronized (IOLockObject) {
 
  117                      System.out.println(
"#"+workerNumber+
":Scenario bmult=" + b + 
":");
 
  120                      System.out.println(
"     Obj: " + mi.
SyncDB().
getVariable(
"z").findRecord().getLevel());
 
  130    static String model =
 
  132            "      i   canning plants   / seattle, san-diego /                       \n" +
 
  133            "      j   markets          / new-york, chicago, topeka / ;              \n" +
 
  136            "    a(i)  capacity of plant i in cases                                  \n" +
 
  137            "           /    seattle     350                                         \n" +
 
  138            "                san-diego   600  /                                      \n" +
 
  140            "    b(j)  demand at market j in cases                                   \n" +
 
  141            "           /    new-york    325                                         \n" +
 
  143            "                topeka      275  / ;                                    \n" +
 
  145            "Table d(i,j)  distance in thousands of miles                            \n" +
 
  146            "             new-york       chicago      topeka                         \n" +
 
  147            "seattle        2.5           1.7          1.8                           \n" +
 
  148            "san-diego      2.5           1.8          1.4  ;                        \n" +
 
  150            "Scalar f      freight in dollars per case per thousand miles  /90/ ;    \n" +
 
  151            "Scalar bmult  demand multiplier /1/;                                    \n" +
 
  153            "Parameter c(i,j)  transport cost in thousands of dollars per case ;     \n" +
 
  154            "          c(i,j) = f * d(i,j) / 1000 ;                                  \n" +
 
  157            "    x(i,j)  shipment quantities in cases                                \n" +
 
  158            "    z       total transportation costs in thousands of dollars ;        \n" +
 
  160            "Positive Variable x ;                                                   \n" +
 
  163            "      cost        define objective function                             \n" +
 
  164            "      supply(i)   observe supply limit at plant i                       \n" +
 
  165            "      demand(j)   satisfy demand at market j ;                          \n" +
 
  167            "  cost ..        z  =e=  sum((i,j), c(i,j)*x(i,j)) ;                    \n" +
 
  169            "  supply(i) ..   sum(j, x(i,j))  =l=  a(i) ;                            \n" +
 
  171            "  demand(j) ..   sum(i, x(i,j))  =g=  bmult*b(j) ;                      \n" +
 
  173            "Model transport /all/ ;                                                 \n" +