/** 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); } }