Skip to content

Repository files navigation

ADGN

ADGN stands for Adhoc Dynamic Geometric Network.
This library uses a genetic algorithm to optimize a spatially embedded network where every vertex has a geometric constraint.

Running the GA

The GA loads the geometric constraints (i.e. Interest Areas) from a given path. (the file is json format with a specific schema provided in the schemas folder). Then an initial random population is generated and the GA evolution process begins.

Parameters

  • --interest-areas (required): the path to the json file containing the interest areas
  • --fitness-function (required): the fitness function for the GA.
    • 1: sum of the connectivity componenets squared - optimum is max
    • 3: harmonic average of all path length - optimum is min
  • --output-base-dir (required): the directory for the GA to output its results including statistics and process visualization
  • --initial-population (optional. default 10): the size of the initial population generated by the optimization process
  • --iterations (optional. default 300): how many iterations should the optimization process iterate over
  • --mutation-factor (optional. default 1): the probability [0,1] of mutation in the GA process. 0 will never mutate, 1 will always mutate.
  • --visualize (optional. defatul false): if the optimization process should output visualizations of the optimization process and its statistics
  • --parallel (optional. default false): should the GA use multiple processes to parallelize computation
  • --optimization-method (optional. default ga) what optimization method should be used.
    • ga - use the genetic algorithm process
    • sgd - use the stochastic gradient decent process

Examples

With GA
The following command will run the GA with the avg harmonic path length fitness function
python adgn.py --interest-areas=/tmp/interest_areas.json --fitness-function=3 --output-base-dir=simulations --iterations=500 --parallel=false --visualize=true --optimization-method=ga
With SGD
T.B.D

Generating random Interest Areas

To generate a interest areas json file with random interest areas, please use the following command
python ia_generator.py --amount=170 --xlim=8 --ylim=8 --output=/tmp/interest_areas.json

Parameters

  • --amount (required): the amount of interest areas to generate
  • --xlim (required): the absolute value of the limit of the x axis on the [xy] plane
  • --ylim (required): the absolute value of the limit of the y axis on the [xy] plane
  • --output (required): the file name (with path) to output the generated interest areas json file
  • --allow-overlap (optional. default false): can the interest areas overlap
  • --show (optional. default true): if set to true, at the end of the process, will show the generated interst areas on the [xy] plane
The interest areas will be generated in the rectangle [-xlim, xlim] X [-ylim, ylim] with a random radius between 0.3 and 0.5

Known issues

if the --allow-overlap is set to false, the interest areas random generator may result in an infinite loop. to avoid this, please set the --xlim and --ylim parameters to large enough values.

Logging

Every log will output to the stdout.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages