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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? world.java

?? 這是個java版的人工模擬股市。
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package asm;import java.util.Vector;/** * Title:        Artificial Stock Market * Description:  人工模擬股市(來源:SFI的Swarm版本)的Java版本 * Copyright:    Copyright (c) 2003 * Company:      http://agents.yeah.net * @author jake * @version 1.0 *///該類負(fù)責(zé)對世界的狀態(tài)進(jìn)行紀(jì)錄并編碼public class World {  public double intrate; /*利率" interest rate"*/  public double dividendscale; /*股息的基本值" The baseline dividend that is set by initWithBaseline: "*/  public int pupdown[];	       /*一個數(shù)組記錄價格的升降情況" array, dimension UPDOWNLOOKBACK "*/  public int dupdown[];	       /*一個數(shù)組記錄股息的升降情況" array, dimension UPDOWNLOOKBACK "*/  public int history_top;      /*價格、股息數(shù)組的歷史紀(jì)錄指標(biāo)" index value of current input into history arrays "*/  public int updown_top;     /*pupdown和dupdown兩個數(shù)組的指標(biāo)"number of time steps to look back to form pupdown and dupdown bits"*/  public double price;     /*股票的市場價格"market clearning price"*/  public double oldprice;  /*上一期的市場價格" previous price "*/  public double dividend;   /*當(dāng)前的股息" dividend "*/  public double olddividend; /*上一期的股息"previous dividend"*/  public double saveddividend; /* copy of olddividend, used for some                           double-checking on object integrity"*/  public double savedprice; /* copy of oldprice, used for some                        double-checking on object integrity"*/  public double riskNeutral;   /*"dividend/intrate"*/;  public double profitperunit; /*沒支股票的靜收益=price - oldprice + dividend"*/  public double returnratio;   /*回報率=profitperunit/oldprice"*/  public int malength[];     /*" For each MA, we must specify the length over which the average is calculated. This array has one integer for each of the moving averages we plan to keep, and it is used to set the widths covered by the moving averages."*/  public int nworldbits; /*世界信息編碼的長度"The number of aspects of the world that are recorded as bits"*/  public int realworld[]; /*真實世界的編碼,每個索引對應(yīng)的值為0~2"An array (dynamically allocated, sorry) of ints, one for each bit being monitored. This is kept up-to-date. There's a lot of pointer math going on with this and I don't feel so glad about it (PJ: 2001-11-01)"*/  public boolean exponentialMAs; /*是否用指數(shù)加權(quán)的方法計算移動平均數(shù)值"Indicator variable, YES if the World is supposed to report back exponentially weighted moving averages"*/  public MovingAverage priceMA[];  /*價格的移動平均" MovingAverage objects which hold price information. There are NMAS of these, and have various widths for the moving averages "*/  public MovingAverage divMA[];   /*股息的移動平均"  MovingAverage objects which hold dividend moving averages. "*/  public MovingAverage oldpriceMA[]; /*上期價格的移動平均" MovingAverage objects which hold lagged price moving averages "*/  public MovingAverage olddivMA[];/*上期股息的移動平均" MovingAverage objects which hold lagged dividend moving averages "*/  public Vector Histories;   //記錄世界的歷史信息 double divhistory[];       /*股息歷史數(shù)組" dividend history array, goes back MAXHISTORY points"*/ double pricehistory[];     /*價格歷史數(shù)組" price history array "*/  static int NULLBIT=-1;  static int PUPDOWNBITNUM=42;  static int NWORLDBITS=61;  static int NRATIOS=10;  static int EQ=0;  static int UPDOWNLOOKBACK=5;  static int NMAS=4;  static int MAXHISTORY=500;  //定義世界編碼對應(yīng)位的名稱  String bitnamelist[][]={{"on", "dummy bit -- always on"},			// 0{"off", "dummy bit -- always off"},{"random", "random on or off"},{"dup", "dividend went up this period"},		// 3{"dup1", "dividend went up one period ago"},{"dup2", "dividend went up two periods ago"},{"dup3", "dividend went up three periods ago"},{"dup4", "dividend went up four periods ago"},{"d5up", "5-period MA of dividend went up"},		// 8{"d20up", "20-period MA of dividend went up"},{"d100up", "100-period MA of dividend went up"},{"d500up", "500-period MA of dividend went up"},{"d>d5",   "dividend > 5-period MA"},			// 12{"d>d20",  "dividend > 20-period MA"},{"d>d100", "dividend > 100-period MA"},{"d>d500", "dividend > 500-period MA"},{"d5>d20", "dividend: 5-period MA > 20-period MA"},	// 16{"d5>d100", "dividend: 5-period MA > 100-period MA"},{"d5>d500", "dividend: 5-period MA > 500-period MA"},{"d20>d100", "dividend: 20-period MA > 100-period MA"},{"d20>d500", "dividend: 20-period MA > 500-period MA"},{"d100>d500", "dividend: 100-period MA > 500-period MA"},{"d/md>1/4", "dividend/mean dividend > 1/4"},		// 22{"d/md>1/2", "dividend/mean dividend > 1/2"},{"d/md>3/4", "dividend/mean dividend > 3/4"},{"d/md>7/8", "dividend/mean dividend > 7/8"},{"d/md>1",   "dividend/mean dividend > 1  "},{"d/md>9/8", "dividend/mean dividend > 9/8"},{"d/md>5/4", "dividend/mean dividend > 5/4"},{"d/md>3/2", "dividend/mean dividend > 3/2"},{"d/md>2", "dividend/mean dividend > 2"},{"d/md>4", "dividend/mean dividend > 4"},{"pr/d>1/4", "price*interest/dividend > 1/4"},		// 32{"pr/d>1/2", "price*interest/dividend > 1/2"},{"pr/d>3/4", "price*interest/dividend > 3/4"},{"pr/d>7/8", "price*interest/dividend > 7/8"},{"pr/d>1",   "price*interest/dividend > 1"},{"pr/d>9/8", "price*interest/dividend > 9/8"},{"pr/d>5/4", "price*interest/dividend > 5/4"},{"pr/d>3/2", "price*interest/dividend > 3/2"},{"pr/d>2",   "price*interest/dividend > 2"},{"pr/d>4",   "price*interest/dividend > 4"},{"pup", "price went up this period"},			// 42{"pup1", "price went up one period ago"},{"pup2", "price went up two periods ago"},{"pup3", "price went up three periods ago"},{"pup4", "price went up four periods ago"},{"p5up", "5-period MA of price went up"},		// 47{"p20up", "20-period MA of price went up"},{"p100up", "100-period MA of price went up"},{"p500up", "500-period MA of price went up"},{"p>p5", "price > 5-period MA"},			// 51{"p>p20", "price > 20-period MA"},{"p>p100", "price > 100-period MA"},{"p>p500", "price > 500-period MA"},{"p5>p20", "price: 5-period MA > 20-period MA"},	// 55{"p5>p100", "price: 5-period MA > 100-period MA"},{"p5>p500", "price: 5-period MA > 500-period MA"},{"p20>p100", "price: 20-period MA > 100-period MA"},{"p20>p500", "price: 20-period MA > 500-period MA"},{"p100>p500", "price: 100-period MA > 500-period MA"}};double ratios[] ={0.25, 0.5, 0.75, 0.875, 1.0, 1.125, 1.25, 1.5, 2.0, 4.0};//比例數(shù)值數(shù)組public World() {  //構(gòu)建函數(shù),初始化各個變量  pupdown=new int[UPDOWNLOOKBACK];	       /*" array, dimension UPDOWNLOOKBACK "*/  dupdown=new int[UPDOWNLOOKBACK];  malength=new int[NMAS];  priceMA=new MovingAverage[NMAS];  /*" MovingAverage objects which hold price information. There are NMAS of these, and have various widths for the moving averages "*/  divMA=new MovingAverage[NMAS];   /*"  MovingAverage objects which hold dividend moving averages. "*/  oldpriceMA=new MovingAverage[NMAS]; /*" MovingAverage objects which hold lagged price moving averages "*/  olddivMA=new MovingAverage[NMAS];  Histories=new Vector();}String descriptionOfBit(int n){  //獲得指定位的描述  if (n == NULLBIT)    return "(Unused bit for spacing)";  else if (n < 0 || n >= NWORLDBITS)    return "(Invalid world bit)";  return bitnamelist[n][1];}String nameOfBit(int n){  //獲得指定位的名稱  if (n == NULLBIT)    return "null";  else if (n < 0 || n >= NWORLDBITS)    return "";  return bitnamelist[n][0];}int bitNumberOf(String name)/*" Converts a bit name to a bit number. Supplies the number of a bit * given its name.  Unknown names return NULLBIT.  Relatively slow * (linear search). Could be made faster with a hash table etc, but * that's not worth it for the intended usage.  "*/{  //根據(jù)位的名稱獲得位的值  int n;  for (n = 0; n < NWORLDBITS; n++)    if (bitnamelist[n][0].equals(name))      break;  if (n >= NWORLDBITS) n = NULLBIT;  return n;}void setintrate(double rate)  /*" Interest rate set in ASMModelSwarm."*/{  intrate = rate;}void setExponentialMAs(boolean aBool)  /*" Turns on the use of exponential MAs in calculations.  Can be    turned on in GUI or ASMModelSwarm.m. If not, simple averages of    the last N periods."*/{  exponentialMAs = aBool;}int getNumWorldBits()  /*" Returns numworldbits; used by the BFagent."*/{  return nworldbits;}void initWithBaseline(double baseline)/*"Initializes moving averages, using initial values based ona price scale of "baseline" for the dividend.  The baseline isset in ASMModelSwarm. " */{  int i;  double initprice, initdividend;// Check pup index  //if (!nameOfBit(PUPDOWNBITNUM).equals("pup"))    //system.out("PUPDOWNBITNUM is incorrect");// Set price and dividend etc from baseline  dividendscale = baseline;  initprice = baseline/intrate;//初始化價格  initdividend = baseline;//初始化股息  saveddividend = dividend = initdividend;  setDividend(initdividend);  savedprice = price = initprice;  setPrice(initprice);// Initialize profit measures  returnratio = intrate;//初始化回報率  profitperunit = 0.0;// Initialize miscellaneous variables  nworldbits = NWORLDBITS;  //各個移動平均數(shù)組的記錄長度  malength[0] = 5;  malength[1] = 20;  malength[2] = 100;  malength[3] = MAXHISTORY;  history_top = 0;  updown_top = 0;  divhistory=new double[MAXHISTORY];       /*" dividend history array, goes back MAXHISTORY points"*/  pricehistory=new double[MAXHISTORY];  realworld = new int[NWORLDBITS];  // Initialize arrays  for (i = 0; i < UPDOWNLOOKBACK; i++)    {    pupdown[i] = 0;    dupdown[i] = 0;    }  for (i = 0; i < MAXHISTORY; i++)    {    pricehistory[i] = initprice;    divhistory[i] = initdividend;    }  //初始化各種移動平均數(shù)組  for (i = 0; i < NMAS; i++)    {      priceMA[i] = new MovingAverage();      priceMA[i].initWidth(malength[i],initprice);      divMA[i] =new MovingAverage();      divMA[i].initWidth(malength[i],initdividend);      oldpriceMA[i] = new MovingAverage();      oldpriceMA[i].initWidth(malength[i],initprice);      olddivMA[i] =new MovingAverage();      olddivMA[i].initWidth(malength[i],initdividend);    }// Initialize bits//初始化世界的信息編碼  makebitvector();}/*設(shè)置價格p,并計算回報率" Sets the market price to "p".  All price changes (besides trialprices) should use this method.  Also computes profitperunit andreturnratio.  Checks internally for illegal changes of "price", giving us theeffective benefit of encapsulation with the simplicity of use ofa global variable. "*/void setPrice(double p){  //if (price != savedprice)    //system.Out("Price was changed illegally");  oldprice = price;  price = p;  //計算每股的收益  profitperunit = price - oldprice + dividend;  //計算回報率  if (oldprice <= 0.0)    returnratio = profitperunit*1000.0;	/* Arbitrarily large */  else    returnratio = profitperunit/oldprice;  savedprice = price;}/*"Returns the price, used by many classes."*/double getPrice(){  return price;}/*"Returns profitperunit, used by Specialist."*/double getProfitPerUnit(){  return profitperunit;}/*"Sets the global value of "dividend".  All dividend changes should	use this method.  It checks for illegal changes, as does	-setPrice:."*/void setDividend(double d){  //if (dividend != saveddividend)    //system.Out("Dividend was changed illegally.");  //設(shè)置股息,并計算風(fēng)險中性價格  olddividend = dividend;  dividend = d;  saveddividend = dividend;  riskNeutral = dividend/intrate;}/*"Returns the most recent dividend, used by many."*/double getDividend(){  return dividend;}/*"Returns the risk neutral price.  It is just dividend/intrate."*/double getRiskNeutral(){  return riskNeutral;}/*" Updates the history records, moving averages, and world bits to * reflect the current price and dividend.  Note that this is called * in each period after a new dividend has been declared but before * the bidding and price adjustment.  The bits seen by the agents thus * do NOT reflect the trial price.  The "price" here becomes the * "oldprice" by the end of the period. It is called once per period. * (This could be done automatically as part of -setDividend:). * * The dividend used here is at present the latest value, though it * could be argued that it should be the one before, to match price. * For the p*r/d bits we do use the old one. "*///對世界當(dāng)前的狀況進(jìn)行編碼,每個運行周期內(nèi),先進(jìn)行該動作然后才讓每個agent進(jìn)行報價、交易void updateWorld(){  int i;/* Update the binary up/down indicators for price and dividend *///紀(jì)錄當(dāng)前的價格和股息是升還是降  updown_top = (updown_top + 1) % UPDOWNLOOKBACK;  if(price>oldprice){    pupdown[updown_top] = 1;  }else{    pupdown[updown_top] = 0;  }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色哦色哦哦色天天综合| 美女任你摸久久| 久久久.com| 久久久久久久久久久久电影| 欧美乱熟臀69xxxxxx| 欧美亚洲综合在线| 91精品在线麻豆| 久久一日本道色综合| 国产亚洲人成网站| 国产精品久久久久久久蜜臀| 一区二区中文视频| 日本强好片久久久久久aaa| 美女一区二区久久| 国产91对白在线观看九色| 成人一区二区三区中文字幕| 在线中文字幕一区| 日韩视频免费观看高清完整版在线观看 | 精品欧美久久久| 亚洲欧洲日韩av| 奇米色一区二区| 99精品久久久久久| 欧美区在线观看| 国产精品福利一区二区| 日韩高清欧美激情| av成人动漫在线观看| 91精品欧美福利在线观看| 久久久天堂av| 日本欧美肥老太交大片| 91在线观看美女| 久久久久久久久伊人| 日韩电影免费在线| 欧美午夜在线观看| 一区二区三区日韩欧美精品| 国产精品91xxx| 精品国产123| 久久成人免费网站| 制服丝袜亚洲色图| 日韩国产精品久久久久久亚洲| 91丨九色porny丨蝌蚪| 国产精品三级av在线播放| 韩日欧美一区二区三区| www国产成人| 国产黄色精品视频| 国产精品国产三级国产| av一区二区三区四区| 国产精品美女久久久久久| 成人毛片在线观看| 亚洲欧美韩国综合色| 国产揄拍国内精品对白| 欧美丰满少妇xxxbbb| 婷婷国产v国产偷v亚洲高清| 捆绑调教美女网站视频一区| 91一区在线观看| 日韩理论片一区二区| 在线观看欧美日本| 日韩精品亚洲一区| 精品国产乱码久久久久久1区2区| 国产精品一区二区三区四区| 国产日韩av一区| 欧美专区在线观看一区| 奇米色一区二区| 国产精品短视频| 欧美一区二区播放| 成人福利视频在线看| 日日噜噜夜夜狠狠视频欧美人| 欧美电影免费观看高清完整版在| 成人一级片在线观看| 天堂午夜影视日韩欧美一区二区| 欧美精品一区二区三区高清aⅴ | 在线观看精品一区| 精品一区二区在线播放| 一区二区在线看| 国产精品色在线观看| 久久婷婷国产综合精品青草| 在线精品视频一区二区三四| 国产成人免费9x9x人网站视频| 午夜精品在线看| 亚洲国产精品一区二区久久 | 免费高清视频精品| 亚洲电影一级片| 一区二区三区四区乱视频| 国产精品久久久久久久岛一牛影视| 欧美日韩免费观看一区三区| 色一情一乱一乱一91av| 东方aⅴ免费观看久久av| 国产精品一区在线观看乱码 | 欧美日韩三级一区二区| 99riav久久精品riav| av日韩在线网站| 91在线国内视频| 欧美性生活一区| 777色狠狠一区二区三区| 制服丝袜日韩国产| 欧美无人高清视频在线观看| 99re8在线精品视频免费播放| 国产a视频精品免费观看| 不卡的看片网站| 99久久99精品久久久久久 | 精品剧情在线观看| 国产午夜精品一区二区三区嫩草 | kk眼镜猥琐国模调教系列一区二区| 国产精品综合一区二区| 夫妻av一区二区| 欧美丝袜丝交足nylons图片| 91精品国产欧美一区二区| 精品粉嫩超白一线天av| 欧美国产日本视频| 亚洲国产aⅴ成人精品无吗| 日韩av一区二区三区四区| 亚洲成人av福利| 久久精品国产第一区二区三区| 五月激情综合网| 成人综合在线视频| 日韩欧美一卡二卡| 亚洲色图一区二区三区| 蜜臀av一区二区| 色综合久久中文综合久久97 | 国产精品久久久久桃色tv| 亚洲成人激情社区| 91在线高清观看| 久久精品一区四区| 麻豆国产91在线播放| 欧美色倩网站大全免费| 亚洲乱码中文字幕| 成人免费看视频| 国产日产欧美一区二区三区| 裸体在线国模精品偷拍| 欧美一区二区久久| 视频一区在线播放| 欧美疯狂做受xxxx富婆| 亚洲一二三四区| 在线观看日产精品| 亚洲va天堂va国产va久| 在线观看欧美日本| 一区二区成人在线视频 | 亚洲精选免费视频| 色综合久久88色综合天天6| 日韩伦理av电影| 99久久精品国产观看| 国产精品乱人伦一区二区| 不卡大黄网站免费看| 亚洲欧洲中文日韩久久av乱码| 色婷婷精品久久二区二区蜜臀av| 中文字幕在线观看不卡视频| 91在线国产福利| 日韩激情av在线| 在线观看免费一区| 男男视频亚洲欧美| 久久免费电影网| 91在线精品秘密一区二区| 视频一区在线播放| 中文字幕av一区 二区| 欧美优质美女网站| 激情综合色播五月| 丝袜亚洲另类欧美综合| 69av一区二区三区| 成av人片一区二区| 日本v片在线高清不卡在线观看| 久久综合色鬼综合色| 欧美在线一二三四区| 国产一区二区视频在线播放| 亚洲成人久久影院| 日韩理论片在线| 欧美精品一区二区三区久久久| aaa欧美色吧激情视频| 精品一区二区日韩| 亚洲一区中文在线| 中文字幕中文字幕在线一区| 在线国产电影不卡| 国产剧情一区二区| 久久99精品一区二区三区三区| 亚洲免费av网站| 亚洲欧洲av色图| 日本一区二区三区久久久久久久久不 | 美女视频一区二区三区| 一卡二卡欧美日韩| 色噜噜狠狠色综合中国| 日韩在线播放一区二区| 亚洲第一福利一区| 一区二区在线电影| 一区二区三区在线视频免费观看| 国产精品人成在线观看免费| 久久久亚洲高清| 国产精品精品国产色婷婷| 国产精品天天看| 亚洲一区二区在线观看视频| 亚洲精品国产精品乱码不99 | 精品在线一区二区| 国产成人综合自拍| 成人国产一区二区三区精品| 91在线播放网址| 欧美日本一区二区| 久久综合精品国产一区二区三区 | 国产自产高清不卡| 9i看片成人免费高清| 欧美中文字幕一区二区三区| 777久久久精品| 久久久亚洲高清| 一区二区免费在线播放| 美女一区二区在线观看|