/** Simple test program. */
 public static void main(String args[]) {
   STPGModelChecker mc;
   STPGAbstrSimple stpg;
   ModelCheckerResult res;
   BitSet target;
   Map<String, BitSet> labels;
   boolean min1 = true, min2 = true;
   try {
     mc = new STPGModelChecker(null);
     stpg = new STPGAbstrSimple();
     stpg.buildFromPrismExplicit(args[0]);
     // System.out.println(stpg);
     labels = mc.loadLabelsFile(args[1]);
     // System.out.println(labels);
     target = labels.get(args[2]);
     if (target == null) throw new PrismException("Unknown label \"" + args[2] + "\"");
     for (int i = 3; i < args.length; i++) {
       if (args[i].equals("-minmin")) {
         min1 = true;
         min2 = true;
       } else if (args[i].equals("-maxmin")) {
         min1 = false;
         min2 = true;
       } else if (args[i].equals("-minmax")) {
         min1 = true;
         min2 = false;
       } else if (args[i].equals("-maxmax")) {
         min1 = false;
         min2 = false;
       }
     }
     // stpg.exportToDotFile("stpg.dot", target);
     // stpg.exportToPrismExplicit("stpg");
     res = mc.computeReachProbs(stpg, target, min1, min2);
     System.out.println(res.soln[0]);
   } catch (PrismException e) {
     System.out.println(e);
   }
 }
  /** Simple test program */
  public static void main(String args[]) {
    STPGModelChecker mc;
    STPGAbstrSimple stpg;
    DistributionSet set;
    Distribution distr;
    // ModelCheckerResult res;
    BitSet target;

    // Simple example: Create and solve the stochastic game from:
    // Mark Kattenbelt, Marta Kwiatkowska, Gethin Norman, David Parker
    // A Game-based Abstraction-Refinement Framework for Markov Decision Processes
    // Formal Methods in System Design 36(3): 246-280, 2010

    try {
      // Build game
      stpg = new STPGAbstrSimple();
      stpg.addStates(4);
      // State 0 (s_0)
      set = stpg.newDistributionSet(null);
      distr = new Distribution();
      distr.set(1, 1.0);
      set.add(distr);
      stpg.addDistributionSet(0, set);
      // State 1 (s_1,s_2,s_3)
      set = stpg.newDistributionSet(null);
      distr = new Distribution();
      distr.set(2, 1.0);
      set.add(distr);
      distr = new Distribution();
      distr.set(1, 1.0);
      set.add(distr);
      stpg.addDistributionSet(1, set);
      set = stpg.newDistributionSet(null);
      distr = new Distribution();
      distr.set(2, 0.5);
      distr.set(3, 0.5);
      set.add(distr);
      distr = new Distribution();
      distr.set(3, 1.0);
      set.add(distr);
      stpg.addDistributionSet(1, set);
      // State 2 (s_4,s_5)
      set = stpg.newDistributionSet(null);
      distr = new Distribution();
      distr.set(2, 1.0);
      set.add(distr);
      stpg.addDistributionSet(2, set);
      // State 3 (s_6)
      set = stpg.newDistributionSet(null);
      distr = new Distribution();
      distr.set(3, 1.0);
      set.add(distr);
      stpg.addDistributionSet(3, set);
      // Print game
      System.out.println(stpg);

      // Model check
      mc = new STPGModelChecker(null);
      // mc.setVerbosity(2);
      target = new BitSet();
      target.set(3);
      stpg.exportToDotFile("stpg.dot", target);
      System.out.println("min min: " + mc.computeReachProbs(stpg, target, true, true).soln[0]);
      System.out.println("max min: " + mc.computeReachProbs(stpg, target, false, true).soln[0]);
      System.out.println("min max: " + mc.computeReachProbs(stpg, target, true, false).soln[0]);
      System.out.println("max max: " + mc.computeReachProbs(stpg, target, false, false).soln[0]);
    } catch (PrismException e) {
      System.out.println(e);
    }
  }