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

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

?? output.m

?? 人工模擬股市(Swarm版本)
?? M
字號:
#import "Output.h"

#include <misc.h> // stdio, time



/*"
To show the possible data output tools, I have 3
different ways of saving the output time streams from the model.  All
three should be similar/equivalent representations of the numbers.

1) Text output of data streams.
2) HDF5 or LISP format output of object dumps from a "putShallow"
   call to a data archiver object. This dumps full snapshots of
   the world and the specialist into a LISP on hdf5 archive.
3) HDF5 output EZGraph which writes one vector per plotted line
   into an hdf5 file.

This code has a preprocessor flag to control the behavior of data
storage. If compile without any CPP flags, then the data files are
saved in the .scm format, which is "scheme".  Otherwise, use the flag
NO_LISP, and it uses hdf5 format. In Swarm, that means you type the
make command:

 make EXTRACPPFLAGS=-DNO_LISP


The buttons in the ASMObserverSwarm display turn on data saving.  Look
for "writeSimulationParams" and the other "toggleDataWrite".  These
were in the original ASM Swarm model, but I've replaced the
functionality with the newer storage methods.  The data is saved only
if you turn on the writeData option. If "toggleDataWrite" is empty or
false, hit that button and it shows "true". When the model runs,
output will be created. If you run the program in batch mode, it
automatically turns on the data writing.

Please note that if you want the simulation to save your parameter
values to a file, you can click the GUI button
"writeSimulationParams." If you push that button, the system writes
the parameter values into a file, such as

guiSettingsThu_Jun_28_23_48_00_2001.scm


if you did not compile with the NO_LISP flag.  Otherwise you get a
.hdf file.  One key change from the old ASM is that you can push that
button at time 0, and it will save a snap at that time, and any time
you stop the model, you can change parameters and punch the button
again, and it will also save a snapshot at quit time.  I believe this
works fine now, but it was a little tricky making sure the objects are
created in the right order and early enough to allow this to work.

Now, just a word about data formatting.  Because it is familiar and
compatible with existing programs, I often prefer to save data in raw
ASCII format.  In case you want text output, this shows you how to do it.
I think filenames that have the date in them are good to
help remember when they were originally created, for example.  It
creates an ASCII file, for example,

output.data_Thu_Jun_28_23_48_00_2001


However, I understand the reasons others are pushing to use more
refined formats.  Many people are digging into hdf5 format for data
storage, and I've taken a look at that too.  I took the easy road and
just dumped the whole world and specialist class with swarm's
archiver. It seems to work great?!  The output file is called
something like

swarmDataArchiveFri_Jun_29_16_29_25_2001.hdf
or
swarmDataArchiveFri_Jun_29_16_22_59_2001.scm

You note here that output uses the current time and date to write the
output file names. Today I ran an example and ended up with these
three files of output:

output.dataWed_Oct_24_11_30_18_2001
swarmDataArchiveWed_Oct_24_11_30_18_2001.scm
hdfGraphWed_Oct_24_11_30_18_2001.hdf
"*/
@implementation Output


/*"createEnd does a lot of specific things that make the data output
  objects work. It gets the system time, uses that to fashion a
  filename that includes the time, then where necessary it creates
  archivers which will later be called on to get readings on the
  system and record them."*/
- createEnd
{
  int i;
 
  char paramFileName[100];

  char dataArchiveName[100];

  if(!runTime)
    runTime = time(NULL);
  dataFileExists = NO;
 
  strcpy (timeString, ctime(&runTime));

  for (i = 0; i < 100; i++)
    {
      if (timeString[i] == ' ' || timeString[i] == ':')
	timeString[i] = '_';
      else if (timeString[i] == '\n')
	timeString[i] = '\0';
    }



  if (swarmGUIMode == 1)
    strcpy (paramFileName,"guiSettings");
  else
    strcpy (paramFileName,"batchSettings");

  strcat (paramFileName, timeString);
 

  strcpy (dataArchiveName,"swarmDataArchive");
  strcat (dataArchiveName, timeString);

#ifdef NO_LISP
  strcat (paramFileName,".hdf");
  strcat (dataArchiveName,".hdf");
#else
  strcat (paramFileName,".scm");
  strcat (dataArchiveName,".scm");
#endif
 
#ifdef NO_LISP
  archiver = [HDF5Archiver create: [self getZone] setPath: paramFileName];
  dataArchiver = [HDF5Archiver create: [self getZone] setPath: dataArchiveName];
#else
  //unlink ("settingsSaved.scm");
  archiver = [LispArchiver create: [self getZone] setPath: paramFileName];
  //unlink ("settingsSaved.scm");
  dataArchiver = [LispArchiver create: [self getZone] setPath: dataArchiveName];

#endif
  
 
  return self;
}

/*"The output object needs to have a reference to a Specialist object, from whom it can gather data on the volume of trade."*/
- setSpecialist: (Specialist *)theSpec
{
  outputSpecialist = theSpec;
  return self;
}

/*"The output object must have a reference to a World object, from which it can get price, dividend, or any other information it wants"*/
- setWorld: (World *)theWorld;
{
  outputWorld = theWorld;
  return self;
}

/*"This flushes a snapshot of the current parameter settings from
  both the ASMModelParams and BFAgentParams into a file"*/
- writeParams: modelParam BFAgent: bfParms Time: (long int) t
{
  char modelKey[20];
  char paramKey[20];
 

  sprintf (modelKey, "modelParams%ld",t);
  sprintf (paramKey, "bfParams%ld",t);
  
  [archiver putShallow: modelKey object: modelParam];
#ifndef NO_LISP
  [archiver sync];
#endif

  [archiver putShallow: paramKey  object: bfParms];
#ifndef NO_LISP
  [archiver sync];
#endif
  return self;
}



/*"Because it is possible for users to turn on data writing during a
  run of the simulation, it is necessary to have this method which can
  initialize the data output files. Each time this is called, it
  checks to see if the files have already been initialized. That way
  it does not initialize everything twice."*/
- prepareOutputFile
{
  char outputFile[256];

  if (dataFileExists == YES) return self;

  else{
    
    strcpy (outputFile,"output.data");
    strcat (outputFile, timeString);
    
    if(!(dataOutputFile = fopen(outputFile,"w")))
      abort();
    fprintf (dataOutputFile, "currentTime\t price\t\t dividend\t volume\n\n");
    dataFileExists = YES;
  }
  return self;
}

/*"In case the Output class is told to write output data and there is
no hdfWriter object yet, then this method will be run. I could not
find another way to make sure that this object was not created unless
the system actually tries to write data.  It cannot be done in the
prepareOutputFile method, because that method can be called from the
GUI before the Specialist and World objects exist.  Those objects are
necessary to initialize an hdfWriter, as seen in this code.  "*/

-(void) initializeHDFWriter
{

  char hdfEZGraphName[100];

  strcpy (hdfEZGraphName,"hdfGraph");
  strcat (hdfEZGraphName, timeString);
  strcat (hdfEZGraphName, ".hdf");

  hdf5container = [HDF5 createBegin: [self getZone]];
  [hdf5container setWriteFlag: YES];
  [hdf5container  setName: hdfEZGraphName];
  hdf5container = [hdf5container createEnd];
    
  hdfWriter = [EZGraph create: [self getZone] 
		       setHDF5Container: hdf5container
		       setPrefix: "market"];
  [hdfWriter createSequence: "volume"
	     withFeedFrom: outputSpecialist
	     andSelector: M(getVolume)];

    
  [hdfWriter createSequence: "price"
	     withFeedFrom: outputWorld
	     andSelector: M(getPrice)];


  [hdfWriter createSequence: "dividend"
	     withFeedFrom: outputWorld
	     andSelector: M(getDividend)];

}

/*"The write data method dumps out measures of the price, dividend, and volume indicators into several formats"*/
-writeData
{

  long t = getCurrentTime();
  char worldName[50];
  char specName[50];

  //**** I've got 3 ways to write out numerical results. *****//
  //**** Choose what you like ****//


  // First, just dump out the raw numbers in text.
  // This is the old standby!

  fprintf (dataOutputFile, "%10ld\t %5f\t %8f\t %f\n", 
	   t, 
           [outputWorld getPrice],
           [outputWorld getDividend], 
           [outputSpecialist getVolume]);


  // Second, dump those same values out to an hdf5 format file.  This
  // uses the Archiver library "put shallow" to dump all primitive
  // types, ints and doubles mainly.

  sprintf (worldName, "world%ld",t);
  sprintf (specName, "specialist%ld",t); 

#ifndef NO_LISP
  [dataArchiver putShallow: worldName object: outputWorld];
  [dataArchiver sync];
#else
  [dataArchiver putDeep: worldName object: outputWorld];
#endif

  [dataArchiver putShallow: specName  object: outputSpecialist];
#ifndef NO_LISP
  [archiver sync];
#endif
  // Third, now use the EZGraph dump of its time strings.

  if (!hdfWriter) [self initializeHDFWriter];
  [hdfWriter step];
   
  return self;
}

/*"It is necessary to drop the data writing objects in order to make
sure they finish their work.
"*/
-(void) drop
{
  if (dataOutputFile) fclose(dataOutputFile);
  if (hdfWriter) [hdfWriter drop];
  [archiver drop];
  [dataArchiver drop];
  [super drop];
}

@end



?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
婷婷丁香激情综合| 国产精品家庭影院| 日本中文在线一区| 91精品在线观看入口| 日韩不卡免费视频| 日韩欧美国产一区在线观看| 免费在线观看精品| 精品久久久久久久久久久院品网| 日韩二区在线观看| 久久久久亚洲蜜桃| 成人精品一区二区三区中文字幕 | 国产一区二区在线看| 日韩精品中午字幕| 免费精品视频最新在线| 欧美精品九九99久久| 日本不卡1234视频| 99久久久无码国产精品| 26uuu国产在线精品一区二区| 韩国av一区二区| 视频一区视频二区中文字幕| 欧美日韩三级一区| 六月丁香综合在线视频| 色av成人天堂桃色av| 日韩影院在线观看| 久久夜色精品一区| 在线观看网站黄不卡| 成人小视频在线观看| 加勒比av一区二区| 蜜桃视频在线观看一区二区| 亚洲成人综合在线| 亚洲一区在线观看视频| 国产精品国产三级国产aⅴ原创| 久久蜜桃av一区精品变态类天堂 | 亚洲人成影院在线观看| 久久久久久久久伊人| 精品日韩99亚洲| 日韩美女一区二区三区四区| 欧美裸体一区二区三区| 欧美日韩国产综合久久| 欧美体内she精视频| 欧美最猛黑人xxxxx猛交| 91国模大尺度私拍在线视频| 91久久精品一区二区三区| 97aⅴ精品视频一二三区| 91社区在线播放| 91成人免费在线视频| 欧美中文字幕一二三区视频| 欧美影片第一页| 欧美精品乱码久久久久久按摩| 欧美精品三级在线观看| 欧美麻豆精品久久久久久| 555www色欧美视频| 精品久久久久久久久久久久久久久 | 久久一区二区三区四区| 久久久久久电影| 中文字幕在线不卡一区| 一区二区三区欧美日韩| 亚洲成人免费在线观看| 热久久国产精品| 国产精品一区一区三区| 成人精品亚洲人成在线| 91福利小视频| 欧美一区二区免费观在线| 精品国产免费人成电影在线观看四季 | 日韩欧美一区二区三区在线| 精品奇米国产一区二区三区| 欧美激情一区二区三区蜜桃视频 | 国产精品一区二区久激情瑜伽| 国产经典欧美精品| av亚洲精华国产精华精华| 欧美最新大片在线看| 欧美不卡123| 中文字幕一区二区三区不卡| 一区二区在线观看视频在线观看| 香蕉乱码成人久久天堂爱免费| 捆绑调教一区二区三区| 懂色av一区二区三区蜜臀 | 成人精品视频一区| 欧美丰满一区二区免费视频| 久久免费视频一区| 亚洲成人自拍一区| 丁香六月久久综合狠狠色| 在线视频中文字幕一区二区| 日韩一区二区三免费高清| 国产欧美日韩精品一区| 亚洲大型综合色站| 成人丝袜视频网| 欧美日韩mp4| 国产精品超碰97尤物18| 免费高清在线一区| 色呦呦网站一区| 久久久久久久久一| 午夜视频一区二区| 暴力调教一区二区三区| 日韩欧美激情一区| 亚洲一区在线观看免费| 国产高清亚洲一区| 欧美一级淫片007| 亚洲日本在线视频观看| 国精品**一区二区三区在线蜜桃| 欧美中文字幕一区二区三区| 国产亚洲欧美激情| 日本三级亚洲精品| 在线看不卡av| 欧美极品xxx| 久久草av在线| 欧洲一区在线观看| 国产精品视频一二三区| 久久精品国产亚洲一区二区三区| 91久久精品国产91性色tv| 中文字幕va一区二区三区| 精品一区二区三区免费观看| 欧美系列亚洲系列| 亚洲免费观看高清在线观看| 丁香桃色午夜亚洲一区二区三区| 日韩欧美国产麻豆| 亚洲r级在线视频| 99精品热视频| 中文字幕第一区二区| 国产一区二区三区国产| 欧美一级片在线观看| 亚洲国产视频一区| 日本精品裸体写真集在线观看| 中文字幕乱码久久午夜不卡 | 日韩午夜精品视频| 婷婷综合在线观看| 欧美系列亚洲系列| 一区二区三区欧美激情| 色av成人天堂桃色av| 自拍视频在线观看一区二区| 成人夜色视频网站在线观看| 久久精品一二三| 国产一区二区三区av电影 | av在线不卡观看免费观看| 亚洲国产成人在线| 不卡的av电影在线观看| 国产精品污www在线观看| 成人av电影观看| 国产精品沙发午睡系列990531| 豆国产96在线|亚洲| 国产精品成人免费在线| 91无套直看片红桃| 亚洲美腿欧美偷拍| 欧美日韩在线免费视频| 亚洲mv在线观看| 日韩欧美一区二区免费| 国产一区二区三区四区在线观看| 2023国产一二三区日本精品2022| 狠狠色丁香婷婷综合久久片| 2024国产精品视频| 成人av动漫网站| 亚洲精品日韩专区silk| 欧美亚洲高清一区| 天天影视涩香欲综合网| 精品国产一区二区三区久久影院 | 成人国产精品免费网站| 自拍偷在线精品自拍偷无码专区| 色偷偷久久人人79超碰人人澡| 亚洲最大成人综合| 91精品国产综合久久精品app | 亚洲美女一区二区三区| 欧美日韩综合一区| 免费观看30秒视频久久| 欧美韩日一区二区三区四区| 99久久精品免费看| 午夜影视日本亚洲欧洲精品| 日韩欧美亚洲国产另类| 成人丝袜高跟foot| 亚洲国产精品久久久男人的天堂| 日韩欧美国产不卡| 不卡的av在线| 天天av天天翘天天综合网| 亚洲精品在线免费观看视频| 丁香婷婷深情五月亚洲| 亚洲成人手机在线| 国产日韩欧美精品在线| 欧洲av在线精品| 国模大尺度一区二区三区| 亚洲三级在线免费观看| 欧美va天堂va视频va在线| 成人黄色国产精品网站大全在线免费观看 | 亚洲欧美国产77777| 欧美一区二区播放| 成人免费福利片| 亚洲va韩国va欧美va精品| 久久久久国产成人精品亚洲午夜| 日本韩国精品一区二区在线观看| 久久精品国产精品青草| 亚洲日本一区二区三区| 精品国产1区2区3区| 色老汉av一区二区三区| 国产一区二区在线观看免费| 一区二区在线观看不卡| 久久久久久久久99精品| 在线播放欧美女士性生活| www.亚洲精品| 国产乱一区二区| 视频一区二区不卡| 亚洲激情av在线| 久久久久久影视|