public void FQwithGraphics() { // blank Q values Q_table = new double[transitionList.size()][1]; for (int x = 0; x < Q_table.length; x++) { Q_table[x][0] = 0; } // draw Q values JFrame qGraph = new JFrame(); qGraph.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GraphQ qgraph = new GraphQ(); qgraph.initGraphQ(Q_table, transitionList); qGraph.add(qgraph); qGraph.setSize(550, 550); qGraph.setLocation(00, 500); qGraph.setVisible(true); // draw network output JFrame attackGraph = new JFrame(); attackGraph.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GraphFQ agraph = new GraphFQ(); agraph.initGraphFQ(Q_table, 0.0); attackGraph.add(agraph); attackGraph.setSize(500, 550); attackGraph.setLocation(00, 00); attackGraph.setVisible(true); JFrame evadeGraph = new JFrame(); evadeGraph.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GraphFQ egraph = new GraphFQ(); egraph.initGraphFQ(Q_table, 1.0); evadeGraph.add(egraph); evadeGraph.setSize(500, 550); evadeGraph.setLocation(500, 00); evadeGraph.setVisible(true); JFrame recGraph = new JFrame(); recGraph.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GraphFQrec rgraph = new GraphFQrec(); rgraph.initGraphFQ(Q_table); recGraph.add(rgraph); recGraph.setSize(500, 550); recGraph.setLocation(1000, 00); recGraph.setVisible(true); printTable(); System.out.println("got " + transitionList.size() + " transitions, ready to train"); // this is the main loop that does all the learning for (int i = 0; i < iterations; i++) { Qsweep(transitionList); // after the Q sweep, display the graphics showing Q values qgraph.initGraphQ(Q_table, transitionList); qGraph.update(qGraph.getGraphics()); printTable(); System.out.println("just finished FQ iteration (outer loop)= " + i); // do all the graphics for NN output attackGraph.update(attackGraph.getGraphics()); evadeGraph.update(evadeGraph.getGraphics()); recGraph.update(recGraph.getGraphics()); try { Thread.sleep(2000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } // do nothing for 1000 miliseconds (1 second) } }