Inherits From:- SwarmObject

Declared In:- BFParams.h

This particular version of BFParams has the forecast monitoring up to 16 bits of information. In the init method, the names of which 16 bits might be monitored are listed explicitly by name. Then the World object is asked for the bit number of each name, one-by-one. That sequential process fills up the array bitlist. As a result, it is a bit difficult to maintain this code and I wish there were an easy way out of this. But I didn't find it yet (2001-11-01)

It got to be tedious and boring to maintain getX methods, one for each instance variable, so if other classes want values out of this class, they can use either of 2 routes. Both are used in BFagent.m, just to keep up the variety. One way is the standard Objective-C method to obtain instance variable values, the -> operator. Look for usages like "privateParams->lambda". The other is a more Swarm oriented probe mechanism. Notice the functions at the top of the file BFParams.m, like getInt() and getDouble(). To get the lambda parameter, one can say getDouble(privateParams,"lambda"). Either of these works, and it frees us from the need to constantly add and edit get methods when we add or change instance variables in here.

## Synopsis:

MAXCONDBITS80

## Synopsis:

WORD(bit)

`int`

numfcasts;

`int`

condwords;

`int`

condbits;

`int`

mincount;

`int`

gafrequency;

`int`

firstgatime;

`int`

longtime;

`int`

individual;

`double`

tauv;

`double`

lambda;

`double`

maxbid;

`double`

bitprob;

`double`

subrange;

`double a_min,`

a_max;

`double b_min,`

b_max;

`double c_min,`

c_max;

`double a_range,b_range,`

c_range;

`double`

newfcastvar;

`double`

initvar;

`double`

bitcost;

`double`

maxdev;

`double`

poolfrac;

`double`

newfrac;

`double`

pcrossover;

`double`

plinear;

`double`

prandom;

`double`

pmutation;

`double`

plong;

`double`

pshort;

`double`

nhood;

`double`

genfrac;

`double`

gaprob;

`int`

npool;

`int`

nnew;

`int`

nnulls;

`int *`

bitlist;

`double *`

problist;

`int`

npoolmax;

`int`

nnewmax;

`int`

ncondmax;

numfcasts number of forecasts maintained by this agent condwords number of words of memory required to hold bits condbits number of conditions bits are monitored mincount minimum number of times forecast must be used to become active gafrequency how often is genetic algorithm done? firstgatime after how many time steps is the genetic algorithm done longtime unused time before Generalize() in genetic algorithm individual No description. tauv No description. lambda No description. maxbid No description. bitprob No description. subrange fraction of min-max range for initial random values a_max min and max for p+d coef b_max min and max for div coef c_max min and max for constant term c_range No description. newfcastvar variance assigned to a new forecaster initvar variance of overall forecast for t<200 bitcost penalty parameter for specificity maxdev max deviation of a forecast in variance estimation poolfrac fraction of rules in replacement pool newfrac fraction of rules replaced pcrossover probability of running Crossover(). plinear linear combination "crossover" prob. prandom random from each parent crossover prob. pmutation per bit mutation prob. plong long jump prob. pshort short (neighborhood) jump prob. nhood size of neighborhood. genfrac fraction of 0/1 bits to generalize gaprob derived: 1/gafrequency npool derived: replacement pool size nnew derived: number of new rules nnulls unnused bits bitlist dynamic array, length condbits problist dynamic array, length condbits npoolmax No description. nnewmax No description. ncondmax No description.

- - init
- - getBitListPtr
- - copyBitList:Length:
- - getProbListPtr
- - copyProbList:Length:
- - copy:

`- (BFParams *)`

**copy:**(id <Zone>)*aZone*

Create a copy of this BFParams instance. Note this copies EVERY instance variable, one by one

`- (void)`

**copyBitList:**(int *)*p* **Length:**(int)*size*

if passed a pointer to an array of integers of length *size*, this
frees the old bitlist and puts the new one in its place

`- (void)`

**copyProbList:**(double *)*p* **Length:**(int)*size*

if passed a pointer to a double with a given *size*, this frees the
old bitlist and puts the new one in its place

`- (int*)`

**getBitListPtr**

No method description.

`- (double *)`

**getProbListPtr**

No method description.

`- `

**init**

Init does an awful lot of work for the BFParam object. It takes note of the number of condition bits that can be used and allocates space. It also uses a special function ReadBitname to access the World object to find out which bit in the World represents which piece of information.

Following ASM-2.0, this version of BFParams has condbits set equal to 16 bits. In the World, all possible bits are maintained, and one can ask for an attribute of the market history by a descriptive name like 'pr/d>1/4' and get back the integer value indicating which bit in the world keeps that information. The integer keys for the moitored bits then get translated into the forecast's instance variable bitlist, an an array of integers. Whenever the BFagent needs to make sure than a forecast is up to date, it takes that bitlist and checks the conditions against the state of the world for the monitored bits.

Again following ASM-2.0, we have here forecasts that only use a relatively small part of the world, 16 bits. These particular BFCasts monitor 10 bits which measure the size of price*interest/dividend, 4 more indicators of the change in moving averages of prices for various widths of the moving average, and two "dummy" bits fill out the array.

It is possible to revise this method to allow monitoring of more bits. To add more bits, it is necessary to change the condbits instance variable and then write out the names of some variables to be monitored inside this init method. As long as the number condbits is correct, then the init method should recalculate the amount of storage required. In future revisions of ASM, a cleanup and revision of this design should be a top priority.

Another issue to consider is the assumption that all forecasts used by an agent will use a subset of a given set of bits from the world. Probably it would be better to put a bitlist into each forecast, and completely de-couple the forecasts.

Version 1.1 Copyright ©2001. All Rights Reserved.