code/inC/empiridata.c File Reference

Collects empirical data for our CA fitness program. More...

#include <stdio.h>
#include <stdlib.h>
#include "cellularAutomata.h"

Go to the source code of this file.

Data Structures

struct  SimResult
 Represents the result of a simulation on a CA, with respect to majority classification. More...

Defines

#define MAX_CA_ITERATIONS   200
 The number of iterations that the rule has to classify the CA, no more.

Functions

void simulate (CA *curr, CA *next, int rule[], SimResult *result)
 Runs through all the iterations of the CA, cutting off the evaluation at MAX_CA_ITERATIONS if the simulation runs too long.
void usage ()
 Explains how to use this program.
void correctClassification (int argc, char **argv)
 Determines both the frequency with which a rule set correctly classifies as a function of the percentage of ones in a CA and the average number of iterations that correct classifications requires.
int main (int argc, char **argv)
 Basically calls the correct sub-function, based on the first argument, which indicates what empirical data to collect.

Detailed Description

Collects empirical data for our CA fitness program.

Author:
Ben Edwards <bedwards@cs.unm.edu>
Tyler Rush <me@tylerlogic.com>
Date:
Thursday April 9, 2010
Version:
1.0.0

Definition in file empiridata.c.


Define Documentation

#define MAX_CA_ITERATIONS   200

The number of iterations that the rule has to classify the CA, no more.

Definition at line 15 of file empiridata.c.


Function Documentation

void correctClassification ( int  argc,
char **  argv 
)

Determines both the frequency with which a rule set correctly classifies as a function of the percentage of ones in a CA and the average number of iterations that correct classifications requires.

Parameters:
argc The number of arguments passed to the program.
argv The arguments passed to the program.

Definition at line 73 of file empiridata.c.

int main ( int  argc,
char **  argv 
)

Basically calls the correct sub-function, based on the first argument, which indicates what empirical data to collect.

Although this is kind of stupid considering we only collect one kind of data set.

Parameters:
argc The number of arguments passed to the program.
argv The arguments passed to the program.

Definition at line 45 of file empiridata.c.

void simulate ( CA curr,
CA next,
int  rule[],
SimResult result 
)

Runs through all the iterations of the CA, cutting off the evaluation at MAX_CA_ITERATIONS if the simulation runs too long.

The values of a SimResult are calculated along the way.

Parameters:
curr The initial state of the CA.
next Just a already memory allocated CA that is used in the transition function from one CA iteration to the next.
rule The rule being evaluated.
result The struct that will be set with the information regarding the number of steps that it took to classify the CA and also whether or not the CA was correctly classified.

Definition at line 133 of file empiridata.c.

void usage (  ) 

Explains how to use this program.

Definition at line 152 of file empiridata.c.


Generated on Mon Apr 12 21:34:48 2010 for CS523: Complex Adaptive Systems, Spring 2010, Assignment 2 by  doxygen 1.6.1