Alignment/DecomposeAlignment.java
public static int[][] test(int Y, String logPath, String netPath, Boolean ILP) throws Exception {
		AbstractPILPDelegate.setDebugMode(null);
		PetrinetGraph net = null;
		Marking initialMarking = null;
		Marking[] finalMarkings = null; // only one marking is used so far
		XLog log = null;
		Map<Transition, Integer> costMOS = null; // movements on system
		Map<XEventClass, Integer> costMOT = null; // movements on trace
		TransEvClassMapping mapping = null;

		//log = XParserRegistry.instance().currentDefault().parse(new File("D:\\temp\\exe3.xes.gz")).get(0);
		log = XParserRegistry.instance().currentDefault().parse(new File(logPath)).get(0);

		int X = log.size();
		int[][] AScore = new int[Y][X];

		//ArrayList<Integer>[] AScore = new ArrayList[X];
		long T = 0;
		for (int i = 0; i < Y; i++) {
			String name = String.valueOf(i);
			//net = constructNet("D:\\temp\\" + name + ".pnml");
			net = constructNet(netPath + name + ".pnml");
			//net = constructNet(netPath + "6.pnml");
			//net = constructNet("C:\\Users\\lcheng\\Desktop\\decomp\\" + "prAm6" + ".pnml");
			initialMarking = getInitialMarking(net);
			finalMarkings = getFinalMarkings(net);

			//System.out.println("TRANSITION SIZE "+net.getTransitions().size());

			costMOS = constructMOSCostFunction(net);
			XEventClass dummyEvClass = new XEventClass("DUMMY", 99999);
			XEventClassifier eventClassifier = XLogInfoImpl.STANDARD_CLASSIFIER;
			//XEventClassifier eventClassifier = XLogInfoImpl.NAME_CLASSIFIER;
			costMOT = constructMOTCostFunction(net, log, eventClassifier, dummyEvClass);
			mapping = constructMapping(net, log, dummyEvClass, eventClassifier);

			int iteration = 0;
			for (ASynchronousMoveSorting sort : new ASynchronousMoveSorting[] { ASynchronousMoveSorting.NONE,
					ASynchronousMoveSorting.LOGMOVEFIRST }) {
				//System.out.println("start: " + iteration + " sorting: " + sort);
				long start = System.currentTimeMillis();
				int[] cost1 = DecomposeAlignment.computeCost(costMOS, costMOT, initialMarking, finalMarkings,
						new TestPluginContext(), net, log, mapping, ILP, sort, X);
				long mid = System.currentTimeMillis();

				//System.out.println(" size " + cost1.size());
				long t = mid - start;
				T += t;

				int cost = 0;
				for (int c : cost1) {
					cost += c;
				}
				//System.out.println(" With ILP cost: " + cost + "  t: " + (mid - start));

				System.gc();
				System.out.flush();
				iteration++;

				AScore[i] = cost1;
				System.out.println("subnet " + i + " is done");
				break;
			}
		}
		System.out.println();
		System.out.println("With ILP total Time: " + T);
		return AScore;
	}
//Y is the number of nets
Y is the number of nets
Y is the number of nets
public static int[][] test(int Y, String logPath, String netPath, Boolean ILP) throws Exception {
		AbstractPILPDelegate.setDebugMode(null);
		PetrinetGraph net = null;
		Marking initialMarking = null;
		Marking[] finalMarkings = null; 
		XLog log = null;
		Map<Transition, Integer> costMOS = null; 
		Map<XEventClass, Integer> costMOT = null; 
		TransEvClassMapping mapping = null;
		log = XParserRegistry.instance().currentDefault().parse(new File(logPath)).get(0);
		int X = log.size();
		int[][] AScore = new int[Y][X];
		long T = 0;
		for (int i = 0; i < Y; i++) {
			String name = String.valueOf(i);
			net = constructNet(netPath + name + ".pnml");
			initialMarking = getInitialMarking(net);
			finalMarkings = getFinalMarkings(net);
			costMOS = constructMOSCostFunction(net);
			XEventClass dummyEvClass = new XEventClass("DUMMY", 99999);
			XEventClassifier eventClassifier = XLogInfoImpl.STANDARD_CLASSIFIER;
			costMOT = constructMOTCostFunction(net, log, eventClassifier, dummyEvClass);
			mapping = constructMapping(net, log, dummyEvClass, eventClassifier);
			int iteration = 0;
			for (ASynchronousMoveSorting sort : new ASynchronousMoveSorting[] { ASynchronousMoveSorting.NONE,
					ASynchronousMoveSorting.LOGMOVEFIRST }) {
				long start = System.currentTimeMillis();
				int[] cost1 = DecomposeAlignment.computeCost(costMOS, costMOT, initialMarking, finalMarkings,
						new TestPluginContext(), net, log, mapping, ILP, sort, X);
				long mid = System.currentTimeMillis();
				long t = mid - start;
				T += t;
				int cost = 0;
				for (int c : cost1) {
					cost += c;
				}
				System.gc();
				System.out.flush();
				iteration++;
				AScore[i] = cost1;
				System.out.println("subnet " + i + " is done");
				break;
			}
		}
		System.out.println();
		System.out.println("With ILP total Time: " + T);
		return AScore;
	}
public static int [ ] [ ] test ( int Y , String logPath , String netPath , Boolean ILP ) throws Exception { AbstractPILPDelegate . setDebugMode ( null ) ; PetrinetGraph net = null ; Marking initialMarking = null ; Marking [ ] finalMarkings = null ; XLog log = null ; Map < Transition , Integer > costMOS = null ; Map < XEventClass , Integer > costMOT = null ; TransEvClassMapping mapping = null ; log = XParserRegistry . instance ( ) . currentDefault ( ) . parse ( new File ( logPath ) ) . get ( 0 ) ; int X = log . size ( ) ; int [ ] [ ] AScore = new int [ Y ] [ X ] ; long T = 0 ; for ( int i = 0 ; i < Y ; i ++ ) { String name = String . valueOf ( i ) ; net = constructNet ( netPath + name + ".pnml" ) ; initialMarking = getInitialMarking ( net ) ; finalMarkings = getFinalMarkings ( net ) ; costMOS = constructMOSCostFunction ( net ) ; XEventClass dummyEvClass = new XEventClass ( "DUMMY" , 99999 ) ; XEventClassifier eventClassifier = XLogInfoImpl . STANDARD_CLASSIFIER ; costMOT = constructMOTCostFunction ( net , log , eventClassifier , dummyEvClass ) ; mapping = constructMapping ( net , log , dummyEvClass , eventClassifier ) ; int iteration = 0 ; for ( ASynchronousMoveSorting sort : new ASynchronousMoveSorting [ ] { ASynchronousMoveSorting . NONE , ASynchronousMoveSorting . LOGMOVEFIRST } ) { long start = System . currentTimeMillis ( ) ; int [ ] cost1 = DecomposeAlignment . computeCost ( costMOS , costMOT , initialMarking , finalMarkings , new TestPluginContext ( ) , net , log , mapping , ILP , sort , X ) ; long mid = System . currentTimeMillis ( ) ; long t = mid - start ; T += t ; int cost = 0 ; for ( int c : cost1 ) { cost += c ; } System . gc ( ) ; System . out . flush ( ) ; iteration ++ ; AScore [ i ] = cost1 ; System . out . println ( "subnet " + i + " is done" ) ; break ; } } System . out . println ( ) ; System . out . println ( "With ILP total Time: " + T ) ; return AScore ; }
Y is the number of nets
Y is the number of nets
// only one marking is used so far // movements on system // movements on trace //log = XParserRegistry.instance().currentDefault().parse(new File("D:\\temp\\exe3.xes.gz")).get(0); //ArrayList<Integer>[] AScore = new ArrayList[X]; //net = constructNet("D:\\temp\\" + name + ".pnml"); //net = constructNet(netPath + "6.pnml"); //net = constructNet("C:\\Users\\lcheng\\Desktop\\decomp\\" + "prAm6" + ".pnml"); //System.out.println("TRANSITION SIZE "+net.getTransitions().size()); //XEventClassifier eventClassifier = XLogInfoImpl.NAME_CLASSIFIER; //System.out.println("start: " + iteration + " sorting: " + sort); //System.out.println(" size " + cost1.size()); //System.out.println(" With ILP cost: " + cost + "  t: " + (mid - start));