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

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

?? agent.java

?? 人工股市(Artificial Stock Market
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
  for (f=0; f < privateParams.numfcasts; f++){      Forecast temp1=(Forecast)fcastList.elementAt(f);      madv += Math.abs( temp1.variance - meanv);    }  madv = madv/privateParams.numfcasts;  avstrength /= privateParams.numfcasts;// Loop to construct nnew new rules  local.localasm.setStatus("正在執行遺傳算法:正在進行遺傳操作");  for (new1 = 0; new1 < privateParams.nnew; new1++){      boolean changed;//因為遺傳操作是按照概率進行的,所以,做一個標志是否進行了遺傳操作      changed = false;      // Loop used if we force diversity      do{	  double varvalue, altvarvalue = 999999999;	  //制作一個新的規則,并讓他的各個變量取平均值          Forecast aNewForecast=new Forecast(privateParams.condbits);	  aNewForecast = createNewForecast();	  aNewForecast.updateSpecfactor();	  aNewForecast.strength=avstrength;	  //BFagent.m had equivalent of:  [aNewForecast setVariance: [aNewForecast getSpecfactor]/[aNewForecast getStrength]];          aNewForecast.lastactive=currentTime;	  varvalue =  privateParams.maxdev-avstrength+aNewForecast.specfactor;	  //if (varvalue < 0 ) raiseEvent(WarningMessage, "varvalue  less than zero");	  aNewForecast.variance=varvalue;          Forecast temp1=(Forecast)fcastList.elementAt(0);	  altvarvalue = temp1.variance- madv;	  if ( varvalue < altvarvalue ){	    aNewForecast.variance= altvarvalue;	    aNewForecast.strength=privateParams.maxdev - altvarvalue + aNewForecast.specfactor;	   }	  aNewForecast.lastactive=currentTime;          //選擇父親,選擇算法由Tournament進行操作	  do	    parent1 = Tournament(fcastList);	  while (parent1 == null);	  // 進行交叉操作	  if (Math.random() < privateParams.pcrossover){              //選擇母親	      do		parent2 = Tournament(fcastList);	      while (parent2 == parent1 || parent2 == null) ;                //開始交叉	       aNewForecast=Crossover(aNewForecast,parent1,parent2);	        changed = true;	    }else{              //否則把父親規則拷貝給新的規則	      aNewForecast=CopyRule(parent1);              //進行變異操作	      changed = Mutate(aNewForecast,changed);	    }	  //將新規則加入列表中	  newList.addElement(aNewForecast); //?? were these not initialized in original?//	} while (!changed);      /* Replace while(0) with while(!changed) to force diversity */    }  // Replace nnew of the weakest old rules by the new ones  local.localasm.setStatus("正在執行遺傳算法:用新規則淘汰舊規則");  TransferFcastsFrom(newList,fcastList,rejectList,rejectIndex);  local.localasm.setStatus("正在執行遺傳算法:強迫沒有被激活的規則產生多樣性");  Generalize(fcastList,avstrength);  local.localasm.setStatus("正在執行遺傳算法:重新計算平均值");  // Compute average specificity  int specificity = 0;    //note here a "raw" for loop around the fcastList. I could create an index    //and do the swarm thing, but I leave this here to keep myself humble.    for (f = 0; f < privateParams.numfcasts; f++){	parent1 = (Forecast)fcastList.elementAt(f);	specificity += parent1.specificity;      }    avspecificity = ((double) specificity)/(double)privateParams.numfcasts;  local.localasm.setStatus("執行遺傳算法結束");  newList.removeAllElements();  rejectList.removeAllElements();}/*"This is a method that copies the instance variables out of one  forecast object into another. It copies not only the bitvector of  monitored conditions, but also the forecast value, strength,  variance, specFactor, specificity, and so forth.  The only deviation  is that if the return from the original forecast's getCnt method  (its count value) is equal to 0, then the strength of the copy is  equal to the value of a static variable named minstrength."*/Forecast CopyRule(Forecast from){  Forecast to=new Forecast(privateParams.condbits);  to.forecast=from.forecast;  to.lforecast=from.lforecast;  to.variance=from.variance;  to.strength=from.strength;  to.a=from.a;  to.b=from.b;  to.c=from.c;  to.specfactor=from.specfactor;  to.lastactive=from.lastactive;  to.specificity=from.specificity;  to.conditions=from.conditions;  to.count=from.count;  if (from.count==0)to.strength=minstrength;  return to;}/*"Given a list of forecasts, find the worst ones and put them into apool of rejects. This method requires 2 inputs, the name of the rejectlist (actually, a Swarm Array) and the Array of forecasts. "*/void MakePool(Vector rejects,int indexes[],Vector list){  //制作一個池子,找出最弱適應度的若干規則  int top;  int i,j = 0 ;  Forecast aForecast;  Forecast aReject=new Forecast(privateParams.condbits);  top = -1;  //pj: why not just start at 1 so we never worry about putting forecast 0 into the mix?  //下面制作這個淘汰值,并且要按照適應度值從小到大進行排列  //找出npool條最弱適應度的規則  for ( i=0; i < privateParams.npool; i++ ){      //從原始列表中順序取出規則      aForecast=(Forecast)list.elementAt(i);      for ( j=top;  j >= 0 ; j--){//對現在的拒絕列表中的元素進行循環          aReject=(Forecast)(rejects.elementAt(j));          int k=indexes[j];          //如果發現拒絕的規則的強度大于當前順序取出的規則,則把這條拒絕規則往后移一位          //并且更新indexes里面的數值,因為該書組記錄的是被拒絕規則在原始規則列表中的索引值          if(aReject!=null&&aForecast.strength < aReject.strength){            if(rejects.size()>j+1){              rejects.removeElementAt(j+1);            }            rejects.insertElementAt(aReject,j+1);            indexes[j+1]=k;          }else{            break;          }      }  //note j decrements at the end of this loop      //把拒絕列表中的第一個元素用新的規則替換      if(rejects.size()>j+1){         rejects.removeElementAt(j+1);      }      //將循環到的新規則加入拒絕列表中      rejects.insertElementAt(aForecast,j+1);      indexes[j+1]=i;      top++;    }  //對list列表中剩下的規則進行循環,執行上面過程類似的操作  int t=i;  for ( i=t; i < privateParams.numfcasts; i++){      aForecast=(Forecast)list.elementAt(i);      Forecast temp1=(Forecast)rejects.elementAt(top);      if ( aForecast.strength< temp1.strength)	{	  for ( j = top-1; j >= 0; j--){              aReject=(Forecast)rejects.elementAt(j);              int k=indexes[j];              if(aReject!=null&&aForecast.strength < aReject.strength){                if(rejects.size()>j+1){                    //indexes.removeElementAt(j+1);                    rejects.removeElementAt(j+1);                }                indexes[j+1]=k;                rejects.insertElementAt(aReject,j+1);              }else{                break;              }	    }	}      if(rejects.size()>j+1){            //indexes.removeElementAt(j+1);            rejects.removeElementAt(j+1);      }      indexes[j+1]=i;      rejects.insertElementAt(aForecast,j+1);      //aForecast=(Forecast)rejects.elementAt(j+1);    }  //pj:note: we are not checking to see if forecast 0 is in here}/*------------------------------------------------------*//*	Tournament					*//*------------------------------------------------------*/Forecast Tournament(Vector list){  //Tournament選擇算子,隨機的從列表中選擇兩個規則,返回適應度比較大的那個。  int  numfcasts=list.size();  Forecast candidate1 = (Forecast)list.elementAt((int)(Math.random()*numfcasts));  Forecast candidate2;  do    candidate2 = (Forecast)list.elementAt((int)(Math.random()*numfcasts));  while (candidate2 == candidate1);  if (candidate1.strength> candidate2.strength)    return candidate1;  else    return candidate2;}/*------------------------------------------------------*//*	Mutate						*//*------------------------------------------------------*/boolean Mutate(Forecast new1,boolean changed)  /*變異操作*/{  int bit;  double choice, temp;  boolean bitchanged = false;  bitchanged =changed;  if (privateParams.pmutation > 0){      for (bit = 0; bit < privateParams.condbits; bit++){	  if (Math.random() < privateParams.pmutation){              //執行變異操作,如果當前變異位值為0或1,則變異位相反的數或者2	      if ( Integer.parseInt(new1.getConditionsbit(bit))<2){		  if ((int)(Math.random()*3)> 1){		      new1.maskConditionsbit(bit);          	      new1.decrSpecificity();	          } else{		    new1.switchConditionsbit(bit);		    bitchanged = changed = true;                  }              }else if ((int)(Math.random()*3)> 0){//否則變異為0或者1		  new1.setConditionsbit(bit,String.valueOf((int)(Math.random()*2)));		  new1.incrSpecificity();		  bitchanged = changed = true;              }          }      }  }  /* mutate p+d coefficient */  //對系數的變異  choice = Math.random();  //如果是大變異,則新規則的a為隨機在區間中取值,否則用參數nhood進行變異,也就是取一個鄰域  if (choice < privateParams.plong){      new1.a=privateParams.a_min + privateParams.a_range*Math.random();      changed = true;  }else if (choice < privateParams.plong + privateParams.pshort){      /* short jump  = uniform within fraction nhood of range */      temp = new1.a + privateParams.a_range*privateParams.nhood*(Math.random()*2-1);      if(temp > privateParams.a_max){         new1.a=privateParams.a_max;      }else{         if(temp < privateParams.a_min){            new1.a=privateParams.a_min;          }else{            new1.a=temp;          }      }      changed = true;  }  /* mutate dividend coefficient */  //變異系數b,方法同上  choice = Math.random();  if (choice < privateParams.plong){      /* long jump = uniform distribution between min and max */      new1.b= privateParams.b_min + privateParams.b_range*Math.random();      changed = true;    }else if (choice < privateParams.plong + privateParams.pshort){      /* short jump  = uniform within fraction nhood of range */      temp = new1.b+privateParams.b_range*privateParams.nhood*(Math.random()*2-1);      if(temp > privateParams.b_max){         new1.b=privateParams.b_max;      }else{          if(temp < privateParams.b_min){            new1.b=privateParams.b_min;          }else{            new1.b=temp;          }      }      changed = true;    }  /* else leave alone */  /* mutate constant term */  //對c進行變異,方法同上  choice = Math.random();  if (choice < privateParams.plong){      /* long jump = uniform distribution between min and max */      new1.c= privateParams.c_min + privateParams.c_range*Math.random();      changed = true;  }else if (choice < privateParams.plong + privateParams.pshort){      /* short jump  = uniform within fraction nhood of range */      temp = new1.c + privateParams.c_range*privateParams.nhood*(Math.random()*2-1);      if(temp > privateParams.c_max){          new1.c=privateParams.c_max;      }else{          if(temp < privateParams.c_min){            new1.c=privateParams.c_min;          }else{            new1.c=temp;          }      }      changed = true;  }  /* else leave alone */  new1.count=0;  //更新特定度  if (changed){      new1.updateSpecfactor();  }  return(changed);}/*------------------------------------------------------*//*	Crossover					*//*------------------------------------------------------*/Forecast Crossover(Forecast newForecast,Forecast parent1,Forecast parent2)  /*交叉操作,if部分是位串的交叉,then部分是系數的線性或者其他組合     * On the condition bits, Crossover() uses uniform crossover -- each     * bit is chosen randomly from one parent or the other.     * For the real-valued forecasting parameters, Crossover() does     * one of three things:     * 1. Choose a linear combination of the parents' parameters,     *    weighted by strength.     * 2. Choose each parameter randomly from each parent.     * 3. Choose one of the parents' parameters (all from one or all     *    from the other).     * Method 1 is chosen with probability plinear, method 2 with     * probability prandom, method 3 with probability 1-plinear-prandom.     */{  /* Uniform crossover of condition bits */  int bit;  // unsigned int *cond1, *cond2, *newcond;  int word;  double weight1, weight2, choice;  newForecast.specificity=0;  /*for (word = 0; word <privateParams->condwords; word++)    newForecast.setConditionsBit(word,0);*/  //將父母的if部分的位串進行隨機混合  for (bit = 0; bit < privateParams.condbits; bit++){     if ((int)(Math.random()*2)== 0){	  String value=parent1.getConditionsbit(bit);	  newForecast.setConditionsbit(bit,value);	  if (Integer.parseInt(value)<2) newForecast.incrSpecificity();      }else{	  String value= parent2.getConditionsbit(bit);	  newForecast.setConditionsbit(bit,value);	  if (Integer.parseInt(value)<2) newForecast.incrSpecificity();      }  }  /* Select one crossover method for the forecasting parameters */  //按照不同的概率選擇交叉系數的方法  choice = Math.random();  if (choice < privateParams.plinear){      /* Crossover method 1 -- linear combination */      //線性加權求和      if(parent1.strength + parent2.strength!=0){        weight1 = parent1.strength / (parent1.strength + parent2.strength);      }else{        weight1=0.5;      }      weight2 = 1.0-weight1;      newForecast.a=weight1*parent1.a+weight2*parent2.a;      newForecast.b=weight1*parent1.b+weight2*parent2.b;      newForecast.c=weight1*parent1.c+weight2*parent2.c;    }else if (choice < privateParams.plinear + privateParams.prandom){      /* Crossover method 2 -- randomly from each parent */      //隨機的從父母中選擇系數      if((int)(Math.random()*2)==0)	newForecast.a=parent1.a; else newForecast.a=parent2.a;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精三区欧美精三区| 欧美日韩一区二区三区四区 | 国产精品视频看| 国产精品888| 中文在线资源观看网站视频免费不卡| 经典一区二区三区| 久久久精品2019中文字幕之3| 国产成人综合亚洲网站| 国产精品久久久久影视| 色香蕉成人二区免费| 亚洲成人免费影院| 精品国产一区二区在线观看| 国产原创一区二区| 国产精品午夜电影| 欧美亚洲高清一区二区三区不卡| 日韩影院精彩在线| 久久综合狠狠综合久久综合88| 国产成人午夜电影网| 日韩美女视频一区二区| 欧美日韩精品欧美日韩精品一| 奇米色一区二区| 久久夜色精品国产噜噜av| youjizz久久| 亚洲123区在线观看| 久久久久亚洲综合| 欧美性欧美巨大黑白大战| 狠狠久久亚洲欧美| 亚洲精品v日韩精品| 欧美大胆一级视频| 91免费国产视频网站| 天堂在线一区二区| 中文字幕av免费专区久久| 欧美视频在线一区| 国产成人在线免费| 亚洲午夜久久久久久久久电影网| 精品久久久久一区| 色94色欧美sute亚洲线路一ni | 樱桃国产成人精品视频| 日韩欧美一级在线播放| 91丝袜高跟美女视频| 极品美女销魂一区二区三区 | 国产伦精品一区二区三区视频青涩 | 欧美日本一区二区三区| 国产成人免费视频一区| 午夜精品一区二区三区免费视频 | 成人欧美一区二区三区小说| 91精品国产综合久久香蕉麻豆 | 欧美色精品在线视频| 国产成人精品免费网站| 日韩中文字幕亚洲一区二区va在线 | 欧美bbbbb| 玉足女爽爽91| 中文字幕av一区二区三区 | 精品国产一区二区三区四区四| 色婷婷国产精品久久包臀| 成熟亚洲日本毛茸茸凸凹| 美女www一区二区| 亚洲国产精品久久不卡毛片 | 精品视频一区二区三区免费| 欧美主播一区二区三区美女| 久久er99精品| 日本在线不卡视频| 亚洲妇女屁股眼交7| 亚洲精品成人在线| 亚洲视频一二区| 国产精品你懂的| 国产目拍亚洲精品99久久精品| 日韩午夜电影在线观看| 欧美久久久久中文字幕| 欧美网站大全在线观看| 一本一道久久a久久精品| 成人国产精品免费| 国产高清在线观看免费不卡| 激情综合色综合久久| 日韩激情视频网站| 婷婷丁香久久五月婷婷| 亚洲动漫第一页| 性感美女极品91精品| 亚洲国产裸拍裸体视频在线观看乱了 | 国产精品一品二品| 国产一区二区三区在线观看免费视频| 奇米888四色在线精品| 另类小说视频一区二区| 精品无人码麻豆乱码1区2区| 精品一区免费av| 国产一区二区调教| 成人深夜视频在线观看| gogo大胆日本视频一区| 97se亚洲国产综合在线| 一本到三区不卡视频| 欧美亚洲一区二区在线观看| 欧美老肥妇做.爰bbww| 日韩三级伦理片妻子的秘密按摩| 日韩欧美专区在线| 久久久久88色偷偷免费| 国产精品色眯眯| 一区二区在线观看av| 午夜精品在线视频一区| 国产在线精品一区二区不卡了 | 亚洲免费色视频| 亚洲va欧美va天堂v国产综合| 三级成人在线视频| 久久aⅴ国产欧美74aaa| 成人一区二区在线观看| 一本大道久久精品懂色aⅴ| 欧美在线小视频| 欧美成va人片在线观看| 国产精品国产三级国产a| 亚洲一二三级电影| 久久精品99久久久| 色综合天天综合给合国产| 91精品国产免费久久综合| 欧美极品aⅴ影院| 亚洲第一福利一区| 国产成人精品免费一区二区| 色八戒一区二区三区| 久久蜜臀精品av| 亚洲午夜免费电影| 丁香啪啪综合成人亚洲小说 | 色偷偷88欧美精品久久久| 在线成人免费视频| 久久久久久一级片| 天堂av在线一区| caoporm超碰国产精品| 91麻豆精品91久久久久同性| 国产精品久久国产精麻豆99网站| 天天av天天翘天天综合网| 成人免费毛片app| 67194成人在线观看| 亚洲欧美在线高清| 国内精品在线播放| 欧美日精品一区视频| 国产亚洲视频系列| 亚洲成人av一区二区三区| 成人性生交大片免费看中文 | 国产视频一区在线播放| 午夜在线成人av| 成人av网站在线观看免费| 日韩一区二区三| 亚洲免费av高清| 丰满岳乱妇一区二区三区| 日韩欧美在线一区二区三区| 一区二区三区毛片| 成人av在线播放网址| 久久一日本道色综合| 日韩国产欧美在线视频| 在线观看av一区二区| 国产精品久久久久久久岛一牛影视 | 午夜视频久久久久久| 91玉足脚交白嫩脚丫在线播放| 久久婷婷国产综合国色天香 | 国产美女娇喘av呻吟久久| 欧美一级视频精品观看| 亚洲一线二线三线久久久| av在线一区二区| 国产精品入口麻豆九色| 国产一区免费电影| 精品精品欲导航| 美女在线观看视频一区二区| 欧美日韩国产一二三| 午夜婷婷国产麻豆精品| 一道本成人在线| 亚洲欧洲99久久| 91麻豆视频网站| 中文字幕一区二区三区四区不卡| 国产成人在线视频网址| 国产网红主播福利一区二区| 国内精品视频一区二区三区八戒 | 欧美韩日一区二区三区| 精品一区二区三区蜜桃| 精品国产乱子伦一区| 精品无人码麻豆乱码1区2区| 精品福利av导航| 精品一区二区在线视频| 久久婷婷国产综合精品青草 | 成人h版在线观看| 成人免费在线视频| 色偷偷久久人人79超碰人人澡| 一区二区三区精品在线观看| 91免费观看视频| 亚洲观看高清完整版在线观看 | 美女一区二区久久| 久久婷婷久久一区二区三区| 粉嫩嫩av羞羞动漫久久久| 国产精品视频在线看| 一本久久a久久精品亚洲 | 日本免费在线视频不卡一不卡二| 91精品一区二区三区久久久久久| 人妖欧美一区二区| ww久久中文字幕| 成人黄色av电影| 亚洲一区在线视频观看| 日韩欧美国产系列| 国产伦精一区二区三区| 国产精品久久久久一区二区三区| 在线观看亚洲专区| 日韩黄色免费网站| 国产日本欧洲亚洲| 91麻豆国产香蕉久久精品| 日韩国产在线一|