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

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

?? gapopulation.h

?? 單目標遺傳算法優化的經典例子c++源碼
?? H
字號:
// $Header: /usr/people/mbwall/src/galib/ga/RCS/GAPopulation.h,v 1.3 1999/03/30 02:40:28 mbwall Exp $
/* ----------------------------------------------------------------------------
  population.h
  mbwall 3aug94
  Copyright (c) 1995 Massachusetts Institute of Technology
                     all rights reserved

 DESCRIPTION:
  The population holds an array of pointers to genomes.  It also keeps
track of the fitness statistics for the genomes in the population.
---------------------------------------------------------------------------- */
#ifndef _ga_population_h_
#define _ga_population_h_

#include <ga/gaconfig.h>
#include <ga/gaid.h>
#include <ga/GASelector.h>
#include <ga/GAScaling.h>
#include <ga/GAEvalData.h>
#include <ga/GAGenome.h>

#ifdef max
#undef max
#endif

#ifdef min
#undef min
#endif


/* ----------------------------------------------------------------------------
size
  Use the size member function to get and set the size of the population.  The
population allocates space for genomes in chunks, so you can vary the 
chunksize as well if you are really tight for space.  The compact member 
function will remove all extra pointers.  If you shrink the population to 0
then you cannot use the 'size' method to make the population bigger.  When
resizing to a larger size, we clone randomly individuals from the existing
population.

sort
  The sort member is defined so that it can work on a const population.  It
does not change the logical state of the population, but it does change its
physical state.  We sort from best (0th individual) to worst (n-1).  The sort
figures out whether high is best or low is best.

evaluate
  If you want to force an evaluation, pass gaTrue to the evaluate member
function.  Otherwise the population will use its internal state to determine
whether or not it needs to do the evaluation.

initialize
  This method determines how the population should be initialized.  The 
default is to call the initializer for each genome.

statistics
  Update the statistics.  We do this only on-demand so that no unneeded 
calculations take place.

diversity
  Like the statistics function, we call this one only on demand.  This member
function can be particularly expensive, especially for large populations.  So
we store the values and update them only as needed.  The population diversity
measure is the average of the individual measures (less the diagonal scores).
---------------------------------------------------------------------------- */
class GAPopulation : public GAID {
public:
  GADefineIdentity("GAPopulation", GAID::Population);

  typedef void (*Initializer)(GAPopulation &);
  typedef void (*Evaluator)(GAPopulation &);

  static void DefaultInitializer(GAPopulation &);
  static void DefaultEvaluator(GAPopulation &);

public:
  enum SortBasis { RAW, SCALED };
  enum SortOrder { LOW_IS_BEST, HIGH_IS_BEST };
  enum Replacement { BEST = -1, WORST = -2, RANDOM = -3 };

public:
  GAPopulation();
  GAPopulation(const GAGenome & c, unsigned int psize=1);
  GAPopulation(const GAPopulation & arg);
  GAPopulation & operator=(const GAPopulation & arg){copy(arg); return(*this);}
  virtual ~GAPopulation();
  virtual GAPopulation * clone() const {return new GAPopulation(*this);}
  virtual void copy(const GAPopulation & arg);

  int size() const { return n; }
  int size(unsigned int popsize);
  int chunksize() const { return csz; }
  int chunksize(unsigned int csize) { return csz=csize; }
  int compact();

  void touch() 
    { rsorted=ssorted=selectready=divved=statted=scaled=evaluated=gaFalse; }
  void statistics(GABoolean flag=gaFalse) const;
  void diversity(GABoolean flag=gaFalse) const;
  void scale(GABoolean flag=gaFalse) const;
  void prepselect(GABoolean flag=gaFalse) const;
  void sort(GABoolean flag=gaFalse, SortBasis basis=RAW) const;

  float sum() const {if(!statted) statistics(); return rawSum;}
  float ave() const {if(!statted) statistics(); return rawAve;}
  float var() const {if(!statted) statistics(); return rawVar;}
  float dev() const {if(!statted) statistics(); return rawDev;}
  float max() const {if(!statted) statistics(); return rawMax;}
  float min() const {if(!statted) statistics(); return rawMin;}
  float div() const {if(!divved)  diversity();  return popDiv;}
  float div(unsigned int i, unsigned int j) const 
    {if(!divved) diversity(); return indDiv[i*n+j];}
  float fitsum() const {if(!scaled) scale(); return fitSum;}
  float fitave() const {if(!scaled) scale(); return fitAve;}
  float fitmax() const {if(!scaled) scale(); return fitMax;}
  float fitmin() const {if(!scaled) scale(); return fitMin;}
  float fitvar() const {if(!scaled) scale(); return fitVar;}
  float fitdev() const {if(!scaled) scale(); return fitDev;}

  int nevals() const { return neval; }
  void evaluate(GABoolean flag=gaFalse) {
    if(evaluated == gaFalse || flag == gaTrue){
      (*eval)(*this); neval++;
      scaled = statted = divved = rsorted = ssorted = gaFalse;
    }
    evaluated = gaTrue;
  }
  Evaluator evaluator() const {return eval;}
  Evaluator evaluator(Evaluator e)
    { evaluated = gaFalse; return eval=e; }
  void initialize() { neval = 0; (*init)(*this); touch(); }
  Initializer initializer() const {return init;}
  Initializer initializer(Initializer i)
    { return init=i; }
  SortOrder order() const { return sortorder; }
  SortOrder order(SortOrder flag);
  GAGenome & select() { if(!selectready) prepselect(); return slct->select(); }
  GASelectionScheme & selector() const { return *slct; }
  GASelectionScheme & selector(const GASelectionScheme&);
  GAScalingScheme & scaling() const {
    GAPopulation* This = (GAPopulation*)this;
    This->scaled=gaFalse;
    return *sclscm; 
  }
  GAScalingScheme & scaling(const GAScalingScheme&);

  GAGeneticAlgorithm * geneticAlgorithm() const {return ga;}
  GAGeneticAlgorithm * geneticAlgorithm(GAGeneticAlgorithm&);
  void * userData() const {return ud;}
  void * userData(void * u){return(ud=u);}
  GAEvalData * evalData() const {return evaldata;}
  GAEvalData * evalData(const GAEvalData& o)
    {delete evaldata; evaldata = o.clone(); return evaldata;}

  GAGenome& best(unsigned int i=0, SortBasis basis=RAW) const {
    if(basis == SCALED) scale();
    sort(gaFalse, basis);
    return ((basis == RAW) ? *(rind[i]) : *(sind[i])); 
  }
  GAGenome& worst(unsigned int i=0, SortBasis basis=RAW) const {
    if(basis == SCALED) scale();
    sort(gaFalse, basis); 
    return ((basis == RAW) ? *(rind[n-1-i]) : *(sind[n-1-i]));
  }
  GAGenome& individual(unsigned int i, SortBasis basis=RAW) const 
    { return ((basis == RAW) ? *(rind[i]) : *(sind[i])); }

  GAGenome * add(GAGenome *);
  GAGenome * add(const GAGenome&);
  GAGenome * remove(int which=WORST, SortBasis basis=RAW);
  GAGenome * remove(GAGenome *);
  GAGenome * replace(GAGenome *, int which=RANDOM, SortBasis basis=RAW);
  GAGenome * replace(GAGenome * newgenome, GAGenome * oldgenome);
  void destroy(int w=WORST, SortBasis b=RAW) { delete remove(w,b); }

#ifndef NO_STREAMS
  virtual void read(istream &){}
  virtual void write (ostream & os, SortBasis basis=RAW) const;
#endif

protected:
  unsigned int neval;		// number of evals since initialization
  unsigned int csz;		// how big are chunks we allocate?
  unsigned int n, N;		// how many are in the population, allocated
  SortOrder sortorder;		// is best a high score or a low score?
  GABoolean rsorted;		// are the individuals sorted? (raw)
  GABoolean ssorted;		// are the individuals sorted? (scaled)
  GABoolean scaled;		// has the population been scaled?
  GABoolean statted;		// are the stats valid?
  GABoolean evaluated;		// has the population been evaluated?
  GABoolean divved;		// has the population diversity been measured?
  GABoolean selectready;	// has the selector been updated?
  float rawSum, rawAve;		// sum, ave of the population's objectives
  float rawMax, rawMin;		// max, min of the population's objectives
  float rawVar, rawDev;		// variance, standard deviation
  float popDiv;			// overall population diversity [0,)
  float* indDiv;		// table for genome similarities (diversity)
  GAGenome** rind;		// the individuals of the population (raw)
  GAGenome** sind;		// the individuals of the population (scaled)
  float fitSum, fitAve;		// sum, ave of the population's fitness scores
  float fitMax, fitMin;		// max, min of the population's fitness scores
  float fitVar, fitDev;		// variance, standard deviation of fitness
  GAScalingScheme* sclscm;	// scaling method
  GASelectionScheme* slct;	// selection method
  Initializer init;		// initialization method
  Evaluator eval;		// population evaluation method
  void* ud;		        // pointer to user data
  GAGeneticAlgorithm* ga;	// the ga that is using this population
  GAEvalData* evaldata;		// data for evaluator to use (optional)

  int grow(unsigned int);

  static void QuickSortAscendingRaw(GAGenome**, int, int);
  static void QuickSortDescendingRaw(GAGenome**, int, int);
  static void QuickSortAscendingScaled(GAGenome**, int, int);
  static void QuickSortDescendingScaled(GAGenome**, int, int);
};



#ifndef NO_STREAMS
inline ostream& operator<< (ostream& os, const GAPopulation & arg)
{ arg.write(os); return os; }
inline istream& operator>> (istream& is, GAPopulation & arg)
{ arg.read(is); return is; }
#endif

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91碰在线视频| 91精品啪在线观看国产60岁| caoporen国产精品视频| 色噜噜狠狠色综合欧洲selulu| 欧美精品第1页| 久久久天堂av| 亚洲日本丝袜连裤袜办公室| 亚洲成av人片一区二区梦乃| 紧缚奴在线一区二区三区| 免费在线观看成人| 久久狠狠亚洲综合| 国产精品主播直播| 99久久99久久精品免费观看 | 国产一区二区三区观看| ㊣最新国产の精品bt伙计久久| 国产一区二区三区久久悠悠色av| 日韩成人午夜电影| 国产91精品精华液一区二区三区 | 亚洲成av人影院在线观看网| 日本欧美大码aⅴ在线播放| 国产精品2024| 欧美三区在线视频| 色国产精品一区在线观看| 国产精品一区免费在线观看| 欧美日韩在线播放三区| 亚洲综合精品久久| 国产拍揄自揄精品视频麻豆| 亚洲国产视频在线| 国产91对白在线观看九色| 欧美精品粉嫩高潮一区二区| 欧美极品少妇xxxxⅹ高跟鞋| 91老师国产黑色丝袜在线| 亚洲精品乱码久久久久久| 婷婷丁香久久五月婷婷| 成人免费视频播放| 日韩三级视频在线观看| 欧美日韩一区 二区 三区 久久精品| 国产不卡视频一区二区三区| 久草精品在线观看| 久久久久亚洲综合| 亚洲大片精品永久免费| 国产精品1区2区| 6080午夜不卡| 亚洲成人动漫精品| 7777精品久久久大香线蕉| av一区二区久久| 久久成人免费电影| 亚洲成av人片在线观看无码| av一区二区久久| 久久久精品日韩欧美| 香蕉久久一区二区不卡无毒影院| 91在线云播放| 欧美韩日一区二区三区四区| 久久av中文字幕片| 91精品欧美久久久久久动漫| 亚洲国产毛片aaaaa无费看| www.亚洲在线| 国产拍欧美日韩视频二区| 精品一区二区久久久| 3atv在线一区二区三区| 午夜伦理一区二区| 欧美性高清videossexo| 亚洲资源在线观看| 91精彩视频在线| 亚洲乱码日产精品bd| 91免费看片在线观看| 亚洲欧洲日韩一区二区三区| 成人性生交大片免费看视频在线 | 99久久伊人网影院| 久久久久久久久97黄色工厂| 国产一区二区在线观看免费| 日韩免费观看高清完整版| 日韩电影一二三区| 欧美一区二区三区在线| 日韩中文字幕1| 日韩午夜激情视频| 精品一区二区三区久久久| 久久你懂得1024| 国产成人精品综合在线观看 | 国产成人鲁色资源国产91色综| 久久女同性恋中文字幕| 成人性视频免费网站| 国产精品久久久久7777按摩| 成人av资源站| 亚洲综合色成人| 欧美老年两性高潮| 免费在线观看不卡| 69成人精品免费视频| 久久99精品久久久久久国产越南| 26uuu久久天堂性欧美| 欧美大片一区二区| av一二三不卡影片| 国产一区二区三区av电影| 亚洲一级二级三级| 国产视频一区不卡| 欧美一区二区三区日韩视频| 成人成人成人在线视频| 国内精品写真在线观看| 夜夜精品视频一区二区 | 国产99一区视频免费| 亚洲在线观看免费视频| 国产调教视频一区| 久久综合九色欧美综合狠狠| 26uuu久久天堂性欧美| 成人激情动漫在线观看| 99免费精品在线观看| 91精品福利在线| 丝袜美腿亚洲色图| 欧美精品久久一区二区三区| 国产二区国产一区在线观看| 欧美少妇性性性| 精品一区二区三区免费视频| aaa亚洲精品一二三区| 7777女厕盗摄久久久| 国产精品一区一区| 一区二区三区视频在线看| 91精品国产全国免费观看| 国产一区二区三区黄视频| 亚洲免费资源在线播放| 欧美成人猛片aaaaaaa| 99精品桃花视频在线观看| 日韩avvvv在线播放| 日韩成人伦理电影在线观看| 日韩国产欧美在线播放| 视频一区中文字幕国产| 日韩av一级电影| 六月丁香婷婷色狠狠久久| 激情小说欧美图片| 国产69精品一区二区亚洲孕妇| 国产自产视频一区二区三区| 国产一区二区三区在线观看免费| 精品一区二区三区在线播放| 国产精品白丝av| 91色九色蝌蚪| 日韩一区国产二区欧美三区| 日本vs亚洲vs韩国一区三区 | 26uuu亚洲综合色| 国产**成人网毛片九色| 亚洲国产欧美日韩另类综合| 国产欧美一区二区三区沐欲| 欧美日韩综合在线| 成人高清视频免费观看| 青青草伊人久久| 亚洲精品国产成人久久av盗摄| 精品久久一二三区| 欧美日韩成人在线一区| 91女神在线视频| 国产不卡高清在线观看视频| 日本麻豆一区二区三区视频| 伊人色综合久久天天| 欧美经典三级视频一区二区三区| 日韩欧美二区三区| 欧美精品日韩精品| 色婷婷综合久久久久中文| 国产成人免费xxxxxxxx| 久久99国内精品| 婷婷久久综合九色国产成人| 亚洲乱码国产乱码精品精小说| 国产日产欧产精品推荐色| 日韩欧美久久一区| 欧美老肥妇做.爰bbww| 日本大香伊一区二区三区| 99热99精品| www.亚洲精品| 成人污视频在线观看| 国产一区在线精品| 欧美aa在线视频| 天使萌一区二区三区免费观看| 一区二区高清在线| 亚洲日本一区二区| 亚洲特级片在线| 中文字幕在线不卡视频| 国产专区综合网| 精品一区二区日韩| 久久精品国产第一区二区三区| 天堂一区二区在线免费观看| 亚洲韩国一区二区三区| 亚洲国产日韩一区二区| 一区二区三区色| 亚洲一区二区三区视频在线| 亚洲精品老司机| 亚洲美女屁股眼交3| 亚洲精品五月天| 亚洲男同1069视频| 亚洲一二三区视频在线观看| 亚洲最色的网站| 亚洲成人在线观看视频| 亚洲第一激情av| 日韩精品亚洲一区二区三区免费| 香蕉乱码成人久久天堂爱免费| 日韩中文字幕av电影| 免费一区二区视频| 国内精品久久久久影院薰衣草| 国产精品影视在线观看| 国产成人亚洲综合a∨婷婷图片| 岛国一区二区在线观看| 国产aⅴ精品一区二区三区色成熟| 一区二区三区高清| 日韩欧美在线不卡| 国产成人免费在线观看|