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

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

?? i_averagelearner_id.java

?? 一個多機器人的仿真平臺
?? JAVA
字號:
/** * i_AverageLearner_id.java  */package EDU.gatech.cc.is.learning;import	java.io.*;import	java.util.*;/** * An object that learns to select from several actions based on * a reward.  Uses the Q-learning method but assuming average rewards. * <P> * The module will learn to select a discrete output based on  * state and a continuous reinforcement input.  The "i"s in front  * of and behind the name imply that this class takes integers as  * input and output.  The "d" indicates a double for the reinforcement  * input (i.e. a continuous value).  * <P> * Copyright (c)2000 Tucker Balch * * @author Tucker Balch (tucker@cc.gatech.edu) * @version $Revision: 1.1 $ */public class i_AverageLearner_id extends i_ReinforcementLearner_id	implements Cloneable, Serializable	{        private double  q[][];                  // the q-values        private double  p[][];                  // count of times in each                                                 // state/action        private int     last_policy[];          // used to count changes in                                                 // policy        private int     changes = 0;            // used to count changes                                                 // in policy        private int     first_of_trial = 1;     // indicates if first time        private double  gamma=0.8;              // discount rate        private double  randomrate=0.1;         // frequency of random actions        private double  randomratedecay=0.99;   // decay rate of random actions        private Random  rgen;                   // the random number generator        private int     xn;                     // last state        private int     an;                     // last action	private	long	seed=0;			// random number seed	private static final boolean DEBUG=false;	/**	 * Instantiate a Q learner using default parameters.         * Parameters may be adjusted using accessor methods.	 *	 * @param numstates  int, the number of states the system could be in.	 * @param numactions int, the number of actions or outputs to          *                        select from.	 */	public i_AverageLearner_id(int numstatesin, int numactionsin)		{		super(numstatesin, numactionsin);                rgen = new Random(seed);                q = new double[numstates][numactions];                p = new double[numstates][numactions];                last_policy = new int[numstates];                for(int i=0; i<numstates; i++)                        {                        for(int j=0; j<numactions; j++)				{                                q[i][j] = 0;                                p[i][j] = 0;				}                        last_policy[i] = 0;                        }                xn = an = 0;                }	/**	 * Set the random rate for the Average-learner.	 * This reflects how frequently it picks a random action.	 * Should be between 0 and 1.	 *	 * @param r double, the new value for random rate (0 < r < 1).	 */	public void setRandomRate(double r)		{		randomrate = r;		}	/**	 * Set the random decay for the Average-learner.	 * This reflects how quickly the rate of chosing random actions	 * decays. 1 would never decay, 0 would cause it to immediately	 * quit chosing random values.	 * Should be between 0 and 1.	 *	 * @param r double, the new value for randomdecay (0 < r < 1).	 */	public void setRandomRateDecay(double r)		{		randomratedecay = r;		}	/**	 * Generate a String that describes the current state of the	 * learner.	 *	 * @return a String describing the learner.	 */        public String toString()                {                int i, j;		String retval = super.toString();                retval = retval + "type = id_AverageLearner_i \n";                for (i=0; i<numstates;i++)                        {                        for (j=0; j<numactions;j++)                                {                                retval = retval + q[i][j] + "   ";                                }                        if (i<(numstates - 1)) retval += "\n";                        }                return retval;                }	/**	 * Select an output based on the state and reward.	 *	 * @param statein  int,    the current state.	 * @param rewardin double, reward for the last output, positive	 *                         numbers are "good."	 */        public int query(int yn, double rn)                {                // yn is present state, rn is present reward                double  pick;                int     action;                if (yn>(numstates -1)) // very bad                        {                        System.out.println("id_AverageLearner_i.query: state "+yn                                +" is out of range.");                        return 0;                        }                /*                 * Find approximate value of present state, and best action.                 *                 * ie:  max q[yn][i] over all i, i is the best action.                 */                double  Vn = -999999;  //very bad                action = 0;                for (int i = 0; i < numactions; i++)                        {                        if (q[yn][i] > Vn)                                {                                Vn = q[yn][i];                                action = i;                                }                        }                /*                 * Now update according to Watkin's iteration:                 */                if (first_of_trial != 1)                        {                        if (DEBUG) System.out.println(				"xn ="+xn+" an ="+an+" rn="+rn);                        // Watkins update rule:                        //q[xn][an] = (1 - alpha)*q[xn][an] +                        // alpha*(rn + gamma*Vn);                        // Average update rule                        q[xn][an] = (p[xn][an] * q[xn][an] + rn + Vn)/                                (p[xn][an] + 2);                        p[xn][an]++; //count times in the last state/action                        }                else                        first_of_trial = 0;                /*                 * Select random action, possibly                 */                if (rgen.nextDouble() <= randomrate)                        {                        action = rgen.nextInt() % numactions;                        if (action < 1) action = -1 * action;                        if (DEBUG) System.out.println("random " + action);                        }                randomrate *= randomratedecay;                /*                 * Remember for next time                 */                xn = yn;                an = action;                if (logging) CheckForChanges();                return action;                }	/**	 * Local method to see how much the policy has changed.	 */        private void CheckForChanges()                {                int i,j;                for(i = 0; i<numstates; i++)                        {                        double  val = -999999;                        int     action = 0;                        for(j=0; j<numactions; j++)                                {                                if (q[i][j] > val)                                        {                                        action = j;                                        val = q[i][j];                                        }                                }                        if (last_policy[i] != action)                                {                                changes++;                                last_policy[i] = action;				}			}		if (logging) log(String.valueOf(changes));		}	/**	 * Called when the current trial ends.	 *	 * @param Vn     double, the value of the absorbing state.	 * @param reward double, the reward for the last output.	 */        public void endTrial(double Vn, double rn)                {                if (DEBUG) System.out.println(			"xn ="+xn+" an ="+an+" rn="+rn);                // Watkins update rule:                //q[xn][an] = (1 - alpha)*q[xn][an] +                //	alpha*(rn + gamma*Vn);                // Average update rule               q[xn][an] = (p[xn][an] * q[xn][an] + rn + Vn)/                        (p[xn][an] + 2);                p[xn][an] += 1;                if (logging)                        {                        CheckForChanges();                        try                                {                                savePolicy();                                }                        catch (IOException e)                                {                                }                        changes = 0;			}		}	/**	 * Called to initialize for a new trial.	 */	public	int initTrial(int s)		{		first_of_trial = 1;		return(query(s, 0));		}		/**	 * Read the policy from a file.	 *	 * @param filename String, the name of the file to read from.	 */        public void readPolicy() throws IOException                {                int i, j, k;                String  linein;                FileInputStream f;		InputStreamReader isr;                StreamTokenizer p;                try                        {                        f = new FileInputStream(policyfilename);			isr = new InputStreamReader(f);                        p = new StreamTokenizer(isr);                        }                catch (SecurityException e)                        {                        return;                        }                // configure the tokenizer                p.parseNumbers();                p.slashSlashComments(true);                p.slashStarComments(true);                k = p.nextToken(); // maintained only for compatibility w Q                double alpha = p.nval;                k = p.nextToken();                double gamma = p.nval;                k = p.nextToken();                randomrate = p.nval;                // to get around java bug that can't read e-xxx nums                if (randomrate > 1.0)                        {                        k = p.nextToken();                        randomrate = 0;                        }                k = p.nextToken();                randomratedecay = p.nval;                for(i=0; i<numstates; i++)                        {                        for(j=0; j<numactions; j++)                                {                                k = p.nextToken();                                this.p[i][j] = p.nval;                                k = p.nextToken();                                q[i][j] = p.nval;                                }                        }                f.close();                return;                }	/**	 * Write the policy to a file.	 *	 * @param filename String, the name of the file to write to.	 */        public void savePolicy() throws IOException                {                int i, j;                String  lineout;                FileOutputStream f = new FileOutputStream(policyfilename);                PrintWriter p = new PrintWriter(f);                p.println("// Average-learning Parameters:");                p.println(0.0 + " // not used");                p.println(0.0 + " // not used");                p.println(randomrate + " // random rate");                p.println(randomratedecay + " // random rate decay");                p.println("// The policy. ");                p.println("// The first number is the hits in that ");                p.println("// state/action, the following num is the s/a ");                p.println("// Q-value. ");                for(i=0; i<numstates; i++)                        {                        for(j=0; j<numactions; j++)                                {                                p.print(this.p[i][j] + " ");                                p.print(q[i][j] + " ");                                }                        p.println();                        }                f.close();                return;                }	}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本高清无吗v一区| 国产一区二区免费看| 亚洲久草在线视频| 亚洲第一主播视频| 国产在线播精品第三| 99免费精品在线| 在线91免费看| 国产嫩草影院久久久久| 亚洲国产另类精品专区| 久久91精品久久久久久秒播| 韩国一区二区视频| 日本韩国精品在线| 欧美一区二区三区视频免费播放| 日韩视频免费观看高清完整版在线观看 | 欧美日本在线看| 欧美激情一区二区| 国产剧情一区二区| 欧美一区二区三区精品| 亚洲激情五月婷婷| 波多野结衣欧美| 久久丝袜美腿综合| 日韩在线一区二区| 一本久道中文字幕精品亚洲嫩| 日韩精品在线一区二区| 五月婷婷欧美视频| 欧美日韩国产综合久久| 日韩精品成人一区二区三区| 97国产一区二区| 一区二区三区日韩在线观看| 成人h动漫精品一区二区| 精品国产91久久久久久久妲己 | 国产精品久久久久久久久搜平片| 国产毛片一区二区| 中文字幕免费一区| 99精品视频一区二区三区| 国产日韩精品久久久| 不卡影院免费观看| 亚洲精品国产一区二区精华液| 91行情网站电视在线观看高清版| 国产精品盗摄一区二区三区| 色八戒一区二区三区| 婷婷开心激情综合| 国产亚洲欧美日韩俺去了| 99久久婷婷国产综合精品| 午夜精品久久久久久久久久久| 久久亚洲捆绑美女| 欧美调教femdomvk| 99久久er热在这里只有精品66| 欧美视频日韩视频在线观看| 精品国产伦一区二区三区观看体验 | 色拍拍在线精品视频8848| 亚洲va欧美va国产va天堂影院| 精品sm在线观看| 91女人视频在线观看| 青青草国产精品亚洲专区无| 亚洲同性同志一二三专区| 91麻豆精品国产综合久久久久久 | 99久久国产免费看| 蜜桃一区二区三区四区| 国产精品伦一区二区三级视频| 日本精品免费观看高清观看| 亚洲欧美日韩国产成人精品影院| 亚洲精品一区二区三区99| 91精品免费观看| 一本大道久久精品懂色aⅴ| 国产精品亚洲一区二区三区妖精| 中文字幕不卡在线播放| 精品久久久久久久久久久久久久久| 欧美日韩成人综合在线一区二区| 成人激情免费电影网址| 国产美女久久久久| 国产真实乱偷精品视频免| 国产自产高清不卡| 91丝袜国产在线播放| 成人黄色在线网站| 99久久精品国产一区二区三区| 国产自产视频一区二区三区| 国产精品中文字幕一区二区三区| 国产美女av一区二区三区| 丰满放荡岳乱妇91ww| 91黄色免费看| 欧美日韩国产首页| 欧美国产成人在线| 婷婷国产v国产偷v亚洲高清| 日韩**一区毛片| 99久久精品免费看国产| 99re亚洲国产精品| 精品国产91洋老外米糕| 亚洲综合在线观看视频| 视频一区视频二区中文| 国产99久久久精品| 欧美亚洲动漫精品| 久久亚洲一区二区三区明星换脸| 中文字幕一区三区| 国内精品视频666| 6080午夜不卡| 亚洲综合清纯丝袜自拍| 不卡一区二区三区四区| 欧美精品一区二区三区一线天视频| 最近日韩中文字幕| 国产成人精品一区二区三区四区 | 欧美在线不卡一区| 中文字幕一区二区在线播放| 美女网站视频久久| 欧美肥大bbwbbw高潮| 亚洲综合视频网| 色综合天天综合网国产成人综合天| 国产精品萝li| 国产成人自拍在线| 国产亚洲精品超碰| 国产成人免费在线观看不卡| 在线综合视频播放| 国产成人精品aa毛片| 国产午夜精品一区二区三区视频| 麻豆精品久久久| 欧美成人官网二区| 风间由美性色一区二区三区| 欧美精品一区二区三区蜜臀| 国产精品99久久久久久有的能看 | 精品久久国产97色综合| 国产成人无遮挡在线视频| 国产精品国产自产拍高清av| 欧美亚洲国产bt| 国内精品嫩模私拍在线| 亚洲卡通动漫在线| 久久午夜色播影院免费高清| 国产99久久精品| 日韩福利电影在线观看| 日韩美一区二区三区| 99精品视频在线观看| 日韩精品免费视频人成| 综合网在线视频| 欧美精品九九99久久| aaa亚洲精品| 成人精品小蝌蚪| 五月天中文字幕一区二区| 中文字幕中文字幕中文字幕亚洲无线| 91丨九色porny丨蝌蚪| 豆国产96在线|亚洲| 九色综合狠狠综合久久| 亚洲自拍偷拍欧美| 亚洲图片一区二区| 亚洲人成网站影音先锋播放| 中文字幕一区三区| 亚洲欧洲av另类| 亚洲一区二区三区三| 亚洲午夜免费视频| 亚洲国产精品自拍| 日韩高清一级片| 免费观看在线综合| 青青草精品视频| 同产精品九九九| 国产一区二区在线观看免费| 日韩精品一二三四| 国产一区二区三区| aaa亚洲精品一二三区| 欧美日韩综合在线免费观看| 欧美酷刑日本凌虐凌虐| 欧美tickling网站挠脚心| 精品国产精品网麻豆系列| 国产亚洲综合性久久久影院| 国产精品女主播av| 黄一区二区三区| 91捆绑美女网站| 中文乱码免费一区二区| 亚瑟在线精品视频| 不卡av在线免费观看| 欧美精品第1页| 国产精品久久久久三级| 美腿丝袜亚洲三区| 91麻豆国产在线观看| 精品国内二区三区| 天天综合色天天综合| 色菇凉天天综合网| 国产精品欧美久久久久无广告| 久久精品国产99国产精品| 欧美日韩国产一二三| 亚洲国产一二三| 91成人在线观看喷潮| 中文字幕欧美激情一区| 国产在线精品不卡| 欧美色图免费看| 亚洲超碰精品一区二区| 99久久伊人网影院| 亚洲欧美偷拍三级| 欧美午夜片在线观看| 日韩和欧美一区二区三区| 欧美美女视频在线观看| 日韩在线一二三区| 国产夜色精品一区二区av| 舔着乳尖日韩一区| 国产天堂亚洲国产碰碰| 国产一区欧美一区| 亚洲图片欧美色图| 欧美一区二区三区色| 国产成人精品三级| 午夜电影网亚洲视频| 欧美一级理论片| 成人黄色a**站在线观看| 一区二区三区丝袜|