亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? swingapplet.java

?? 用java寫的一個強化學習程序
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
		pane.add(instructLabel);
		pane.add(usageLabel);
		return pane;
	}
	
	// makes the board panel and the controls to start and stop the game etc
	Container makePlayPanel() {
		JPanel pane = new JPanel();		
		//pane.setLayout(new BoxLayout(pane, BoxLayout.X_AXIS));

		// make drawable area
		pane.add(makeBoardPanel());
		
		// add buttons
		pane.add(makeButtonPane());
		

		//pane.setBackground(new Color(255,255,204));
		pane.setBorder(BorderFactory.createMatteBorder(1,1,2,2,Color.black));
				
		return pane;
	}

	Container makeTrainPanel() {
		JPanel trainPane = new JPanel();
		//trainPane.setLayout(new BoxLayout(trainPane, BoxLayout.X_AXIS));
		
		trainPane.add(makeSettingPanel());
		trainPane.add(makeParamPanel());

		return trainPane;
	}
	
	// a,g,e parameters for reinforcement learner
	Container makeParamPanel() {
		JPanel parampane = new JPanel();
		parampane.setLayout(new BorderLayout(1,2));
		
		
		JPanel labelpane = new JPanel();
		labelpane.setLayout(new GridLayout(0,1));
		labelpane.add(new JLabel("Death Penalty:", JLabel.RIGHT));
		labelpane.add(new JLabel("Cheese Reward:", JLabel.RIGHT));
		labelpane.add(new JLabel("Alpha:", JLabel.RIGHT));
		labelpane.add(new JLabel("Gamma:", JLabel.RIGHT));
		labelpane.add(new JLabel("Epsilon:", JLabel.RIGHT));
		labelpane.add(new JLabel("Action Selection Method:", JLabel.RIGHT));
		labelpane.add(new JLabel("Learning Method:", JLabel.RIGHT));
		labelpane.add(new JLabel("Epochs to train for:",JLabel.RIGHT));
		labelpane.add(new JLabel("Progress:",JLabel.RIGHT));
		labelpane.add(new JLabel("Epochs done:",JLabel.RIGHT));

		JPanel controlspane = new JPanel();
		controlspane.setLayout(new GridLayout(0,1));
		penalty = new JTextField(20);
		reward = new JTextField(20);
		alpha = new JTextField(20);
		gamma = new JTextField(20);
		epsilon = new JTextField(20);
		controlspane.add(penalty);
		controlspane.add(reward);
		controlspane.add(alpha);
		controlspane.add(gamma);
		controlspane.add(epsilon);

		JPanel actionButtons = new JPanel();
		actionButtons.setLayout(new GridLayout(1,0));
		softmax = new JRadioButton("Softmax");
		greedy = new JRadioButton("Greedy",true);
		ButtonGroup actionButts = new ButtonGroup();
		actionButts.add(softmax);
		actionButts.add(greedy);
		actionButtons.add(softmax);
		actionButtons.add(greedy);
		
		JPanel learnButtons = new JPanel();
		learnButtons.setLayout(new GridLayout(1,0));
		sarsa = new JRadioButton("SARSA");
		qlearn = new JRadioButton("Q-Learning",true);
		ButtonGroup learnButts = new ButtonGroup();
		learnButts.add(sarsa);
		learnButts.add(qlearn);
		learnButtons.add(sarsa);
		learnButtons.add(qlearn);
		epochs = new JTextField(Integer.toString(DEF_EPOCHS));
		progress = new JProgressBar();
		learnEpochsDone = new JLabel("0",JLabel.LEFT);
		 
		controlspane.add(actionButtons);
		controlspane.add(learnButtons);
		controlspane.add(epochs);
		controlspane.add(progress);
		controlspane.add(learnEpochsDone);

		parampane.add(labelpane, BorderLayout.CENTER);
		parampane.add(controlspane, BorderLayout.EAST);
		
		parampane.setBorder(BorderFactory.createTitledBorder("Parameters"));
		
		
		return parampane;
	}
	
	// number of epochs, other settings?, instructions?
	Container makeSettingPanel() {
		JPanel setPane = new JPanel();
		setPane.setLayout(new GridLayout(0,1));
		setPane.add(new JLabel(SETTINGS_TEXT));
		setPane.add(new JLabel(SETTINGS_TEXT2));

		JPanel controls = new JPanel();
		//controls.setLayout(new BoxLayout(controls, BoxLayout.X_AXIS));
		
		startTraining = new JButton("Begin Training");
		startTraining.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				doTraining();
			}
		});
		stopTraining = new JButton("Stop");
		stopTraining.setEnabled(false);
		stopTraining.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				endTraining();
			}
		});
		JButton clearPolicy = new JButton("Undo Training");
		clearPolicy.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				game.setPolicy(rlc.resetLearner());
			}
		});
		controls.add(startTraining);
		controls.add(stopTraining);
		controls.add(clearPolicy);
		
		setPane.add(controls);
		return setPane;
	}

	Container makeBoardPanel() {
		JPanel boardPane = new JPanel();
		boardPane.setLayout(new BoxLayout(boardPane, BoxLayout.Y_AXIS));
		
		bp = new boardPanel(back, BW, BH);
		
		boardPane.add(bp);
		
		// speed control
		speed = new JSlider(0,10,5);
		speed.addChangeListener(new ChangeListener(){
			public void stateChanged(ChangeEvent e) {
				double ratio = 1 - ((double)speed.getValue())/10;
				game.delay = (long)(ratio*DELAY*2);
			}
		});
		speed.setMajorTickSpacing(2);
        speed.setPaintTicks(true);

        //Create the label table.
        Hashtable labelTable = new Hashtable();
        labelTable.put(new Integer( 0 ), new JLabel("Slow") );
        labelTable.put(new Integer( 30 ), new JLabel("Fast") );
        speed.setLabelTable(labelTable);
        speed.setPaintLabels(true);
		boardPane.add(speed);

        //boardPane.setBorder(BorderFactory.createTitledBorder("Game"));

		return boardPane;
	}
	
	Container makeButtonPane() {
		JPanel buttpane = new JPanel();
		buttpane.setLayout(new BoxLayout(buttpane, BoxLayout.Y_AXIS));
		
		// graph of scores
		buttpane.add(chartPane());
		
		// scores
		buttpane.add(scorePanel());
		
		// buttons
		buttpane.add(playControlPanel());
		
		return buttpane;
	}

	Container playControlPanel() {
		JPanel playPanel = new JPanel();
		playPanel.setLayout(new GridLayout(0,2));
		
		startbutt = new JButton("Start");
		startbutt.setActionCommand(START);
		startbutt.addActionListener(this);
		
		JCheckBox continuous = new JCheckBox("Continuous", true);
		continuous.setActionCommand(CONT_CHECK);
		continuous.addItemListener(new ItemListener() {
			public void itemStateChanged(ItemEvent e) {
				if (e.getStateChange() == ItemEvent.DESELECTED)
					game.single=true;
				else game.single = false;
			}
		});

		// add controls to select greedy or rl mouse
		//JPanel learnButtons = new JPanel();
		//learnButtons.setLayout(new GridLayout(1,0));
		JRadioButton greedy = new JRadioButton("Greedy Mouse");
		JRadioButton smart = new JRadioButton("Smart Mouse",true);
		greedy.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				// set game to use greedy mouse
				game.mousetype = game.GREEDY;
			}
		});
		smart.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				// set game to use smart mouse
				game.mousetype = game.SMART;
			}
		});
		ButtonGroup mouseButts = new ButtonGroup();
		mouseButts.add(greedy);
		mouseButts.add(smart);

		// add to grid (l-r t-b)
		playPanel.add(startbutt);
		playPanel.add(smart);
		playPanel.add(continuous);
		playPanel.add(greedy);

		playPanel.setBorder(BorderFactory.createTitledBorder("Game Controls"));
		return playPanel;
	}
	
	Container scorePanel() {
		JPanel scorePane = new JPanel();
		//scorePane.setLayout(new BoxLayout(scorePane, BoxLayout.Y_AXIS));
		scorePane.setLayout(new GridLayout(0,2));
		
		// score labels
		ImageIcon cat = new ImageIcon(catImg);
		ImageIcon mouse = new ImageIcon(mouseImg);
		mousescorelabel = new JLabel(MS_TEXT, mouse, JLabel.RIGHT);
		catscorelabel = new JLabel(CS_TEXT, cat, JLabel.RIGHT);

		// reset scores
		//JPanel hbox = new JPanel();
		//hbox.setLayout(new BoxLayout(hbox, BoxLayout.X_AXIS));
		JButton reset = new JButton("Reset Scores");
		reset.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e) {
				mousescore = 0;
				catscore = 0;
				updateBoard();
			}			
		});
		winPerc = new JLabel("", JLabel.RIGHT); // winning percentage label
		//hbox.add(reset);
		//hbox.add(winPerc);
		
		//scorePane.add(hbox);

		scorePane.add(mousescorelabel);
		scorePane.add(winPerc);
		scorePane.add(catscorelabel);
		scorePane.add(reset);
		
		scorePane.setBorder(BorderFactory.createTitledBorder("Scores"));
		return scorePane;
	}
	
	Container chartPane() {
		JPanel ch=new JPanel();
		ch.setLayout(new BorderLayout());
		
		graphPanel = new chartPanel(this);
		graphPanel.setBorder(BorderFactory.createLineBorder(Color.black));
		
		// smoothing control
		smoothSlider = new JSlider(JSlider.HORIZONTAL, 0,99,50);
		smoothSlider.addChangeListener(new ChangeListener(){
			public void stateChanged(ChangeEvent e) {
				double ratio = ((double)smoothSlider.getValue())/100;
				graphPanel.setSmoothing(ratio);
				graphPanel.repaint();
			}
		});
		smoothSlider.setMajorTickSpacing(20);
        smoothSlider.setPaintTicks(true);

        //Create the label table.
        Hashtable labelTable = new Hashtable();
        labelTable.put(new Integer( 0 ), new JLabel("Coarse") );
        labelTable.put(new Integer( 99 ), new JLabel("Smooth") );
        smoothSlider.setLabelTable(labelTable);
        smoothSlider.setPaintLabels(true);

		ch.add(graphPanel, BorderLayout.CENTER);
		ch.add(smoothSlider, BorderLayout.SOUTH);
		
		//ch.add(scorePanel(), BorderLayout.SOUTH);
		
		ch.setBorder(BorderFactory.createTitledBorder("Performance"));
		
		return ch;
	}
	
	/********** Methods to construct panels *************/

	/********** Action handling methods ****************/
	public void actionPerformed(ActionEvent e) {
		if (e.getActionCommand().equals(START)) {
			game.gameOn = true;
		} else if (e.getActionCommand().equals("Draw")) {
			System.out.println("draw test");
			updateBoard();
		}
	}
	/********** Action handling methods ****************/
}

class chartPanel extends JPanel {
	Vector history;
	SwingApplet a;
	final int POINTW=1, POINTH=1, PREFX = 200, PREFY = 100;
	double smoothing = 0.5;
	
	final Color bg=Color.white, fg=Color.blue;
	int MAXSIZE;
	int lastm=0, lastc=0;
	
	
	public chartPanel(SwingApplet a) {
		this.a = a;
		history = new Vector();
	}
	
	public void updateScores() {
		int m = a.mousescore, c = a.catscore;
		int dm = m-lastm, dc = c-lastc;
		lastm=m; lastc=c;
		double score;
		if ((m+c)==0) score = 0;
		else score = ((double)dm) / (dm+dc);
		addScore(score);	
	}
	
	public void paintComponent(Graphics g) {
		MAXSIZE=getWidth()*2;
		
		// draw panel
		g.setColor(bg);
		g.fillRect(0,0,getWidth(),getHeight());
		g.setColor(fg);
		
		double previous=0, thisval, newval;
		for (int x=0; x<history.size(); x++) {
			// draw this point
			
			// smooth with previous values
			thisval = 1 - ((Double)history.elementAt(x)).doubleValue();
			//if (x != startpoint)
			newval = smoothing * previous + (1 - smoothing) * thisval;
			if ((newval >= 0) && (newval <= 1)) previous = newval;
			else System.err.println("Invalid new value: "+newval);
			int yval = (int) (newval * getHeight());
			int xval = x-(history.size() - getWidth());
			//System.out.println("index="+x+" thisval="+thisval+"newval="+newval+" xval="+xval+" yval="+yval+" previous="+previous);
			g.drawOval(xval,yval,POINTW,POINTH);
		}
		
	}
	
	public Dimension getPreferredSize() {
		return new Dimension(PREFX, PREFY);
	}
	
	public void setSmoothing(double s) { smoothing = s; }
	
	void addScore(double s) {
		if (!((s >= 0) && (s<=1))) {
			System.err.println("Graph: rejecting value"+s);
			return;
		}
		
		history.addElement(new Double(s));

		// prune if list too big
		if (history.size() >= MAXSIZE) history.remove(0);

		//System.out.println("Size:"+history.size()+" maxsize:"+MAXSIZE);

		/*
			System.out.println("History being pruned."+Thread.currentThread().getName());
			Vector nVec = new Vector();
			for (int i=(MAXSIZE/3); i<history.size(); i++) {
				nVec.addElement(history.elementAt(i));
			}
			history = nVec;
			System.out.println("Pruning Finished.");
		}*/
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线电影院国产精品| 色诱亚洲精品久久久久久| 亚洲一区二区三区视频在线| 国产日韩欧美高清| 久久亚区不卡日本| 精品国产91洋老外米糕| 欧美本精品男人aⅴ天堂| 日韩免费一区二区| 久久综合九色综合欧美就去吻| 欧美mv和日韩mv的网站| 精品国产乱码久久久久久免费 | 一区二区三区电影在线播| 亚洲国产精品av| 亚洲视频在线观看三级| 亚洲免费观看高清| 日本91福利区| 国产一区二区电影| 成av人片一区二区| 欧美日韩国产高清一区二区三区 | 夜夜嗨av一区二区三区网页 | 欧美日韩精品一区二区天天拍小说 | 一区二区三区日韩欧美精品| 亚洲一区二区不卡免费| 免费精品视频最新在线| 成人白浆超碰人人人人| 欧美亚洲国产怡红院影院| 欧美一级艳片视频免费观看| 国产日产欧产精品推荐色| 亚洲精品网站在线观看| 热久久国产精品| 91尤物视频在线观看| 欧美一级xxx| 中文字幕视频一区| 青青草国产精品97视觉盛宴| 99久久国产免费看| 91精品免费观看| 中文字幕亚洲一区二区va在线| 亚洲国产精品久久艾草纯爱| 国产高清视频一区| 51精品秘密在线观看| 国产精品免费aⅴ片在线观看| 午夜a成v人精品| 丁香天五香天堂综合| 欧美一区二区三区日韩视频| 国产精品久久久久永久免费观看| 日本不卡视频一二三区| 色噜噜狠狠色综合中国| 欧美精品一区二区三区很污很色的 | 精品毛片乱码1区2区3区| 亚洲免费高清视频在线| 国产不卡视频在线观看| 欧美一级搡bbbb搡bbbb| 一区二区三区中文字幕在线观看| 国产成人在线色| 欧美成人精品福利| 天天色图综合网| 在线观看三级视频欧美| 国产精品久久久久久户外露出| 久色婷婷小香蕉久久| 在线欧美一区二区| 中文字幕中文字幕在线一区| 国产成人福利片| 精品国产一区二区三区忘忧草| 手机精品视频在线观看| 欧美在线播放高清精品| 亚洲免费电影在线| 一本大道久久a久久精二百| 亚洲欧洲av一区二区三区久久| 国产在线精品一区二区不卡了| 欧美一二区视频| 日韩av网站免费在线| 欧美日韩大陆在线| 免费看欧美女人艹b| 欧美精三区欧美精三区| 亚洲va中文字幕| 欧美一区二区三区在线观看视频| 香蕉久久一区二区不卡无毒影院| 欧美丝袜丝交足nylons| 五月天丁香久久| 日韩一区二区三区三四区视频在线观看 | 日本一二三不卡| 国产成人丝袜美腿| 国产精品成人一区二区艾草| 成人影视亚洲图片在线| 中文字幕在线观看不卡| 色综合久久久久综合| 亚洲男人的天堂网| 5月丁香婷婷综合| 久久激情五月激情| 日本一区二区免费在线观看视频| 成人综合婷婷国产精品久久蜜臀| 一色屋精品亚洲香蕉网站| 一本色道亚洲精品aⅴ| 亚洲成人一区在线| 精品国产污污免费网站入口| 国产99久久久国产精品免费看| 中文字幕一区二区日韩精品绯色| 欧美视频在线观看一区| 奇米888四色在线精品| 国产日产欧美一区| 色综合夜色一区| 水蜜桃久久夜色精品一区的特点| 337p粉嫩大胆噜噜噜噜噜91av | 欧美大片在线观看一区二区| 国产一区二区三区观看| 亚洲欧美电影院| 日韩三级伦理片妻子的秘密按摩| 国产成人精品免费| 偷拍一区二区三区四区| 久久综合狠狠综合| 在线亚洲人成电影网站色www| 久久激情五月婷婷| 一区二区三区免费网站| 久久综合给合久久狠狠狠97色69| 色呦呦国产精品| 国产一区二区三区精品欧美日韩一区二区三区 | 亚洲国产日韩一区二区| 久久影院视频免费| 欧洲av一区二区嗯嗯嗯啊| 精品一区二区三区久久| 亚洲激情网站免费观看| 久久久久久久久久久久久夜| 欧美伊人精品成人久久综合97| 国产原创一区二区| 亚洲电影在线播放| 综合色天天鬼久久鬼色| 久久亚洲一区二区三区四区| 欧美性淫爽ww久久久久无| 国产大陆亚洲精品国产| 五月天一区二区| 一区二区三区免费在线观看| 国产精品网站在线观看| 日韩亚洲欧美一区二区三区| 色乱码一区二区三区88| 成人激情动漫在线观看| 韩国女主播成人在线观看| 日韩精品高清不卡| 亚洲一区二区三区精品在线| 国产精品久久免费看| 国产色91在线| 久久久不卡网国产精品一区| 正在播放亚洲一区| 欧美伦理视频网站| 欧美日韩免费视频| 欧美日韩的一区二区| 在线免费精品视频| 欧美伊人久久久久久久久影院| av亚洲精华国产精华| 国产大陆a不卡| 成人午夜视频网站| 国产69精品一区二区亚洲孕妇| 国产在线精品一区二区三区不卡| 久久超碰97人人做人人爱| 日韩成人伦理电影在线观看| 亚洲成人1区2区| 日韩精品国产欧美| 裸体一区二区三区| 激情小说亚洲一区| 国产成人亚洲综合a∨婷婷图片| 国产乱一区二区| 成人中文字幕电影| 99免费精品在线| 欧美网站一区二区| 欧美一级欧美三级| 精品久久一区二区三区| 久久久精品欧美丰满| ...av二区三区久久精品| 亚洲免费看黄网站| 日韩电影免费在线看| 国产一区二区网址| 成人永久aaa| 欧美日韩在线三区| 日韩欧美成人午夜| 日本一区二区三区视频视频| 亚洲天堂2016| 秋霞午夜鲁丝一区二区老狼| 黄网站免费久久| 成人深夜在线观看| 欧美日韩精品专区| 国产欧美日本一区二区三区| 亚洲激情中文1区| 精品一区二区三区在线观看| 波多野结衣一区二区三区| 欧美日韩一级视频| 国产亚洲精品久| 亚洲国产毛片aaaaa无费看| 久久av老司机精品网站导航| 99久久国产综合色|国产精品| 欧美日韩国产区一| 国产日韩欧美在线一区| 亚洲摸摸操操av| 加勒比av一区二区| 欧美在线观看一区| 久久久国产精品不卡| 亚洲国产视频a| 97精品电影院| 精品国产3级a| 日韩电影网1区2区| 欧美性生交片4| 亚洲欧洲精品一区二区三区不卡|