Robot Agent  1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
pheromone.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include "pheromone.h"
#include "enviroment.h"
#include "general.h"
#include "def.h"
#include "debug.h"

Go to the source code of this file.

Functions

pheromone_t * pheromone_init (enviroment_t *env, int width, int lifetime, int pheromone_radius, int eval_radius, int eval_dist, int sector_max_size)
 
void pheromone_destroy (pheromone_t *ph)
 
void pheromone_make_stencil (int ***stencil, int size)
 
void pheromone_put (pheromone_t *ph, int x, int y)
 
int pheromone_eval (pheromone_t *ph, robot_t *robot)
 
void pheromone_map_update (pheromone_t *ph, pheromone_map_sector_t *phms)
 
pheromone_map_sector_t ** pheromone_map_extract (pheromone_t *ph)
 
void pheromone_map_destroy (pheromone_t *ph, pheromone_map_sector_t **phms)
 

Detailed Description

Author
Eriks Zaharans
Date
18 Jul 2013

DESCRIPTION

Pheromone library.

Definition in file pheromone.c.

Function Documentation

void pheromone_destroy ( pheromone_t *  ph)

Deinitialize pheromones

Parameters
phPointer to pheromone structure
Returns
Void

Definition at line 109 of file pheromone.c.

int pheromone_eval ( pheromone_t *  ph,
robot_t *  robot 
)

Evaluate smell in pheromone map and return new heading direction

Parameters
phPointer to pheromone structure
robotRobot structure
Returns
Direction to move

Definition at line 219 of file pheromone.c.

pheromone_t* pheromone_init ( enviroment_t *  env,
int  width,
int  lifetime,
int  pheromone_radius,
int  eval_radius,
int  eval_dist,
int  sector_max_size 
)

Initialize pheromones

Parameters
phPointer to pheromone structure
envnviroment structure
width
lifetime
smell_radius
scan_radius
sector_max_size
Returns
Pointer to pheromone structure

Definition at line 40 of file pheromone.c.

void pheromone_make_stencil ( int ***  stencil,
int  size 
)

Make stencil - generate circle area in 2D array

Parameters
stencilPointer to 2D array
sizeSize of the stencil
Returns
Void

Definition at line 146 of file pheromone.c.

void pheromone_map_destroy ( pheromone_t *  ph,
pheromone_map_sector_t **  phms 
)

Destroy (free memory) array of pheromone map sectors

Parameters
phPointer to pheromone structure
phmsPointer to array of pheromone map sector structures
Returns
Void

Definition at line 449 of file pheromone.c.

pheromone_map_sector_t** pheromone_map_extract ( pheromone_t *  ph)

Extract array of pheromone map sectors

Parameters
phPointer to pheromone structure
Returns
Pointer to array of pheromone map sector structures

Definition at line 371 of file pheromone.c.

void pheromone_map_update ( pheromone_t *  ph,
pheromone_map_sector_t *  phms 
)

Update pheromone map

Parameters
phPointer to pheromone structure
phmsPointer to pheromone map sector structure
Returns
Void

Definition at line 336 of file pheromone.c.

void pheromone_put ( pheromone_t *  ph,
int  x,
int  y 
)

Put pheromone in pheromone map

Parameters
phPointer to pheromone structure
xX coordinate of pheromone center
yY coordinate of pheromone center
timeTime of placment
Returns
Void

Definition at line 174 of file pheromone.c.