/* declare.scs : declarations for scs. */ #define MAXPOSITION 25 /* Maximum number of bits in condition. */ #define MAXCLASS 3000 /* Maximum number of classifiers. */ #define WILDCARD -1 /* Don't care. */ #define FRAMEWIDTH 800 /* Dimensions of the window. */ #define FRAMEHEIGHT 440 typedef enum {F, T} boolean; /* Definition of boolean type. */ typedef int bit; /* A binary digit. */ typedef int trit; /* A ternary digit; 0=0; 1=1; -1=#. */ typedef int action; /* An integer decision. */ typedef trit condition[MAXPOSITION]; typedef bit message[MAXPOSITION]; typedef struct { condition c; action a; double strength, bid, ebid; boolean matchflag; int specificity; } classtype; typedef classtype classarray[MAXCLASS]; typedef struct { int clist[MAXCLASS]; int nactive; } classlist; typedef struct { classarray classifier; int nclassifier, nposition; double pgeneral, cbid, bidsigma, bidtax, lifetax; double bid1, bid2, ebid1, ebid2; double sumstrength, maxstrength, avgstrength, minstrength; int minac, maxac; boolean createopflag; } poptype; poptype population; /* Population of classifiers. */ classlist matchlist; /* Who matched. */ message envmessage; /* Environmental message. */ FILE *rep; /* Report device/file. */ char d_str[100]; /* Dummy string. */ typedef enum {interactive, batch} query_type; typedef char txt[80]; query_type qflag; txt fn; /* aoc data declarations. */ typedef struct { int winner, oldwinner; boolean bucketbrigadeflag; } crecord; crecord clearingrec; /* detector data declarations. */ typedef struct { int dummy; } drecord; /* For this problem no detector record is required. Normally, the detector record contains informa- tion for mapping environmental state variables to the environmental bit string. */ drecord detectrec; /* Dummy detector record. */ /* Environment declarations. */ typedef struct { int lsignal, setcount, testcount; int output, classifieroutput; message signal; } erecord; erecord environrec; FILE *trfile; FILE *efile; /* GA data declarations. */ #define MAXMATING 1000 typedef struct { int mate1, mate2, mort1, mort2; int sitecross; } mrecord; typedef mrecord marray[MAXMATING]; typedef struct { double proportionselect, pmutation, pcrossover; int ncrossover, nmutation, crowdingfactor, crowdingsubpop, nselect; marray mating; /* Mating records for ga report. */ } grecord; grecord garec; FILE *gfile; /* Performance declarations. */ FILE *cfile; /* Classifier file. */ /* Reinforcement data declarations. */ typedef struct { /* Reinforcement record type. */ double reward, proportionreward, proportionreward50; int rewardcount, rewardcount50, totalcount, count50; int lastwinner; } rrecord; rrecord reinforcementrec; FILE *rfile; /* Reinforcement file. */ /* Report declarations. */ FILE *pfile1, *pfile2; /* Plot files. */ /* Timekeeping data declarations. */ # define ITERATIONSPERBLOCK 20000 /* 20000 iterations per block. */ typedef struct { /* Timekeeper record type. */ int initialiteration, initialblock, upperlimit, iteration, block; int reportperiod, gaperiod, consolereportperiod; int plotreportperiod, nextplotreport, nextconsolereport; int nextreport, nextga; boolean reportflag, gaflag, consolereportflag, plotreportflag; } trecord; trecord timekeeprec; FILE *tfile; /* Global variables for randomnormaldeviate. */ double rndx2; boolean rndcalcflag; /* User interface declarations. */ Frame frame; /* Base frame. */ Panel panel; Canvas canvas;