Skip to content

Generate code for experiment of Social Particle Swarm based on Preference.

Notifications You must be signed in to change notification settings

d0iasm/sps-p-gen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SPS-P generated by C++

This is the static site generator for experiments of SPS-P model simulation. You can simulate it with arbitrary options.

Usage

There are 2 binaries generator and generator-p which is in an open boundary and a periodic boundary respectively.

$ make && ./generator-p [options]

Options

$ ./generator-p [ -k1 k00 k01 k10 k11 ] [ -k2 ka kb kp km ] [ -init random/zero ]
[ -gen number ] [ -cycle number ] [ -seed number ]
[ -dynamic none/global-static-discrete/global-dynamic-discrete/local-static-discrete/local-dynamic-discrete/local-static-continuous/local-dynamic-continuous]
[ -path_html string ] [ -path_proto string ] [ -p1 double ] [ -p2 double ]

-k1        K paramters. k01 means the degree how the type 0 particle likes the type 1 particle.
-k2        K paramters. k00=ka, k01=kp+km, k10=kp-km, and k11=kb.
  e.g. N=50
  kij = {
    ka (1<=i<=25, 1<=j<=25)
    kp + km (1<=i<=25, 26<=j<=50)
    kp - km (26<=i<=50, 1<=j<=25)
    kb (26<=i<=50, 26<=j<=50)
  }
-init      The initial state for all particles. -init random indicates that all particles starts with a random K parameter. -init zero indicates that all particles starts with 0.
-gen       The number of maximum steps.
-cycle     The length of periodic boundary. It is useless for open boundary.
-seed      The seed number to be used for generating random number. Default value is 1.
-dynamic   The flag to change the K parameters dinamically based on static energy/dynamic energy/local static energy. K params are not updated if you omit thid flag.
-path_html The path directory for a html file.
-path_json The path directory for a protocol buffer binary.
-p1        The probability of noise for updateing K params.
-p2        The probability of noise for updateing paricle's positions.

Utils

  • main.py: Combine the following functions in one file so you can save your time opening a json file.
    • usage: main.py [-h] -src SRC -out OUT
  • stackplot.py: Generate an image from a json file. It is used for K parameters.
    • usage: stackplot.py [-h] -src SRC -out OUT
  • logplot.py: Generate an image from a json file. It is used for static energy and dynamic energy.
    • usage: logplot.py [-h] -src SRC -out OUT
  • loglogplot.py: Generate an image from a json file. It is used for X and V.
    • usage: loglogplot.py [-h] -src SRC -out OUT
  • clustering.py: Generate an image from a json file. It divides all points to a cluster.
    • usage: clustering.py [-h] -src SRC -out OUT

Dependencies

  • python libraries: You can install the following libraries by pip install <library-name>.
    • numpy
    • matplotlib
    • scipy
  • npm: cross-platform JavaScript run-time environment.
  • Protocol Buffers: language-neutral, platform-neutral, extensible mechanism for serializing structured data. To install protobuf, you can see the instruction

About

Generate code for experiment of Social Particle Swarm based on Preference.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published