Urban Pigeon-inspired Model for Unconstraint Optimisation

Urban Pigeon-inspired Model for Unconstraint Optimisation preview image

1 collaborator

Tags

bio-inspired model 

Tagged by Sergio Rojas-Galeano over 4 years ago

flocking model 

Tagged by Sergio Rojas-Galeano over 4 years ago

meta-heuristic 

Tagged by Sergio Rojas-Galeano over 4 years ago

optimization 

Tagged by Sergio Rojas-Galeano over 4 years ago

swarm algorithm 

"pigeon-inspired model"

Tagged by Sergio Rojas-Galeano over 4 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.0 • Viewed 649 times • Downloaded 134 times • Run 0 times
Download the 'Urban Pigeon-inspired Model for Unconstraint Optimisation' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This is a reworking as an agent-based model of a recently introduced swarm-based search algorithm for numeric real-valued unconstraint optimisation, inspired in the foraging behaviour of urban pigeons (see [1] for details). The model is intended to find valuable areas or spots in a simulated optimisation landscape, by mimicking how pigeons manage to discover sources of food as they navigate their natural territories, i.e urban parks. The landscape obeys to the variation of a cost function evaluated in the different coordinates of the search space (here, a 2D space).

We define three distinct pigeon roles or agent types: a leader, who is the pigeon located at the richest source of food at any moment during the simulation, the followers, who are pigeons pursuing the leader in the hope of getting a share of his food, and the walkers, who are pigeons wondering around aimlessly but with an eye looking for food too.

HOW IT WORKS

The problem is determined by the LANDSCAPE that is obtained as a discrete projection of the cost function onto the 2D grid of cells comprising the simulation view area. Therefore, pigeons will "search for food" in the projection of said landscape into the view area. Since the purpose of the model is optimisation, the goal is to discover the spot which optimises the value of the cost function evaluated at the coordinates of each cell. Notice that in the current version the algorithm minimises, that is, it searches for a spot with the lowest cost function value.

Each pigeon is characterised by a location in the landscape (x, y) and the perceived density of food (or cost) in such location which determines its fitness to solve the problem.

Besides, all pigeons in the population can sense who is the leader (that is, we enable a global information-sharing mechanism). Followers will move towards the leader, so their location is updated in the direction of the leader's location. The walkers, in contrast, move randomly in any direction. Pigeons may change their roles during their lifetime as the simulation progresses, depending on their current fitness.

We defined two types of pigeon breeds, namely followers and walkers. The initial population is created with an amount of pigeons given by the parameter POP-SIZE, with the subset of walkers assigned randomly in proportion to the parameter WALKERS-RATE; the remainder pigeons are assigned to the subset of followers.

Afterwards, each step of the simulation performs four simple actions: find the leader, move the followers, move the walkers and update the best solution found so far. These actions correspond to the following routines: FIND-LEADER (chooses as leader pigeon the one having the best fitness and updates the best fitness ever if necessary), FOLLOW-MOVE (moves each follower towards the leader with the step-size ALPHA, plus a random shift in its orientation due to wind or collisions), and WALK-MOVE (moves each walker around randomly with a step-size SIGMA). These two movement rules correspond to the exploration/exploitation mechanisms of the search algorithm (see [1] for more details).

The simulation is terminated either after a maximum number of steps, MAX-STEPS, or when the truth optimal solution is found prematurely.

HOW TO USE IT

Firstly choose an optimisation problem to be solved from the LANDSCAPE pull-down list. For any of these problems, then define the appropriate limits of the search space coordinates, namely the XY-BOUNDS. Additionally, choose the algorithm parameters POP-SIZE, WALKERS-RATE, ALPHA and SIGMA. You can also set the termination criterium MAX-TICKS. Then press SETUP, then GO.

The initial location of the population of pigeons will be assigned randomly within the boundaries of the landscape. Afterwards, at each time step pigeons move according to its role, the population fitness is updated, and if needed, the leader is re-assigned. The emergent behaviour of the pigeon flock will show up, while they attempt to discover the promising regions within the landscape; the simulation will show the three breeds of pigeons, leader, followers and walkers with different colors (red, blue and red, respectively).

The output monitors show the location and cost of the true solution for the problem, the best location and best cost ever found by the algorithm during the simulation, and the location and cost associated to the current leader. If the algorithm is able to find the true solution, then the BEST-TICK and RUNTIME monitors will display a "!!!" sign inserted behind their actual values.

Lastly, the model also outputs the plot of the leader fitness vs time, the plot of fitness of the best solution found vs time and the plot of flock cohesion vs time if the COHESION? switch is enabled. The latter implies an additional cost to the running time, as the model needs to compute distances between all the pigeons in the follower's flock.

THINGS TO NOTICE

You can see that the flock of follower pigeons moves out from one local minima to another. This is explained because every certain number of ticks, the entire population become walkers that start looking around for other regions as sources of food. This phenomenon is attested by the fitness variation of the leader pigeon during the simulation timeline, as it can be seen in the corresponding plot. Nonetheless, the best found ever solution always has a decreasing fitness as it can be verified in its respective plot.

Similarly, the transition of the flock from one local minimum location to another is depicted in the periodic patterns that appear in the cohesion plot.

THINGS TO TRY

The model includes the mathematical expression and projection of a set of widely-known benchmark functions for unconstrained continuous optimisation: SPHERE, RASTRIGIN, ROSENBROCK, HIMMELBLAU, EGGHOLDER (the actual mathematical expressions and 2D landscapes can be seen in the Appendix of [1]) . In addition to these benchmarks, we defined a RANDOM landscape that is generated on- the-fly with values sampled from a scaled normal distribution; hence, in this problem the real optimum is not known in advance, in contrast to the other functions. Lastly, a seventh benchmark was included, a modified SPHERE with the optimum shifted to the second quadrant. Each benchmark problem exhibits different properties (multi-modality, convexity, separability, etc.) and search ranges (we suggest using a XY-BOUNDS of 512 for EGGHOLDER and XY-BOUNDS of 6 for the other problems).

Notice that all the problems produce a constant landscape (except RANDOM), so you can try and see the effect of varying the different parameters. For starters, a typical configuration can be: POP-SIZE=20, WALKERS-RATE=0.25, ALPHA=0.1, SIGMA=1, MAX-TICKS=10000, XY-BOUNDS=6 (or 512 if LANDSCAPE is EGGHOLDER). If you want to highlight the location of the true solution or the current leader turn on the SPOTLIGHT.
The RANDOM problem produces a different landscape and true solution each time you press SETUP. It is interesting to see how the pigeon-inspired algorithm is able to solve it nonetheless most of the times.

EXTENDING THE MODEL

An interesting question arising is if the convergence speed of the algorithm can be improved without compromising its simplicity for practical purposes, for example using time-decay updates of the step sizes of pigeon movements. In addition, the experiments with the RANDOM benchmark hints at the possibility of the model to solve non-stationary problems, that is, problems were landscape may vary over time, an interesting setting for real-world problems.

Other topics for further research are validating wether the ABM approach to swarm intelligence can be extended or is feasible to address optimisation in higher dimensions, different function domains (continuous, binary, combinatorial) or to incarnate other metaphors originating from the field of collective intelligence.

RELATED MODELS

Modeling Commons -> Particle Swarm Optimization (PSO), see [2].

CREDITS AND REFERENCES

Authors:

Sergio Rojas-Galeano and Martha Garzon

Copyright (c) July 2020

email: srojas@udistrital.edu.co

Version 1.16

Licenses:

References:

[1] Garzon, M., and Rojas-Galeano, S. (2019, November). An Agent-Based Model of Urban Pigeon Swarm Optimisation. In 2019 IEEE Latin American Conference on Computational Intelligence (LA-CCI) (pp. 1-6). IEEE. doi: 10.1109/LA-CCI47412.2019.9036758. https://ieeexplore.ieee.org/document/9036758

[2] Stonedahl, F. and Wilensky, U. (2008). NetLogo Particle Swarm Optimization model. http://ccl.northwestern.edu/netlogo/models/ParticleSwarmOptimization. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

;; --------------------------------------------------------------------------
;; Particle Urban Pigeon Inspired (PUPI) Algorithm for
;; Unconstrained Numerical Optimization.
;;
;; A model by Sergio Rojas-Galeano and Martha Garzon
;; v1.16 Copyright (c) July 2020 The authors
;; Correspondance email: srojas@udistrital.edu.co
;; Universidad Distrital Francisco Jose de Caldas, Bogota, Colombia
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License (GPLv3)
;; (see license at: https://www.gnu.org/licenses/gpl-3.0.txt)
;;
;; The model is made publicly available in the hope that it will be useful
;; to modelers, but WITHOUT ANY WARRANTY whatsoever (see license for details).
;; --------------------------------------------------------------------------

globals[
  ;; PUPI globals
  pupi-leader         ; best pigeon in current iteration
  pupi-leader-fitness ; highest value found by PUPI
  pupi-best-patch     ; best patch found by PUPI
  pupi-runtime        ; total algorithm runtime (ms)
  pupi-cohesion       ; flock cohesion
  pupi-best-tick      ; tick where optimum was found

  ;; Problem variables
  true-best-patch   ; patch with the true best value
]

patches-own[
  x     ; simulated pxcor, depending on the bounds range of vars
  y     ; simulated pycor, depending on the bounds range of vars
  value ; each patch has a value depending on cost_function and its coordinates
        ; the goal of PUPI algorithm is to find the patch with the best fitness value within the search space
]

;; PUPI breeds
breed [walkers walker]
breed [followers follower]


;; Create the fitness landscape depending on optimisation problem

to setup-search-landscape
  clear-all

  ;; make a landscape with hills and valleys according to chosen cost function
  ask patches [
    set x pxcor * (xy-bounds / max-pxcor)
    set y pycor * (xy-bounds / max-pycor)

    set value (ifelse-value
      landscape = "Sphere" [
        x ^ 2 + y ^ 2
      ]
    	landscape = "Sphere-offset" [
        (x - 50 * (xy-bounds / max-pxcor) ) ^ 2  + (y + 50 * (xy-bounds / max-pxcor) ) ^ 2
      ]
      landscape = "Rastrigin" [ ; note that degrees, not radians, are needed for cos function
        20 + ((x ^ 2) -  10 * cos ( (180 / pi) * (2 * pi) * x )) + ((y ^ 2) -  10 * cos ( (180 / pi) * (2 * pi) * y ))
    	]
      landscape = "Rosenbrock" [
        100 * (y - (x ^ 2))^ 2 + (1 - x)^ 2
      ]
      landscape = "Himmelblau" [
        ((x ^ 2) + y - 11) ^ 2 + (x + (y ^ 2) - 7)^ 2
      ]
      landscape = "Eggholder" [ ; note that degrees, not radians, are needed for sin function
        ( (- x) * sin ( (180 / pi) * sqrt (abs (x - (y + 47))))) - (y + 47) * sin ( (180 / pi) * sqrt (abs ((x / 2) + (y + 47))))
      ]
      [ random-normal 0 500  ] ; the last case is a random landscape
    )
  ]

  if landscape = "Random" [
    ask min-one-of patches [value][ set value value - 500 ]
    repeat 10 [ diffuse value 1 ]
  ]

  ;; find the true best value
  ask min-one-of patches [value][ set true-best-patch self ]

	;; scale patches color within values limits
  let min-val min [value] of patches
  let max-val max [value] of patches
	ask patches [ set pcolor scale-color yellow value min-val log abs max-val 1.05 ]
end 

to setup
  setup-search-landscape

  ;; create PUPI breeds of pigeons and place them randomly in the world
  create-walkers pop-size * walkers-rate [
    setxy random-xcor random-ycor  ; set walker pigeons starting position
    set color green                ; assing walker color
    set size 8										 ; make pigeons slightly bigger
  ]
  create-followers pop-size - count walkers [
    setxy random-xcor random-ycor  ; set follower pigeons starting position
    set color blue                 ; assing walker color
    set size 8										 ; make pigeons slightly bigger
  ]
  ;; initialise pupi best patch randomly
  set pupi-best-patch patch random-xcor random-ycor

  reset-ticks
end 

to go
  reset-timer
;    ifelse ticks mod 1000 > 800 [
  ifelse ticks mod 500 > 400 [
    ;; PUPI wild search (starvation) moves
    ask (turtle-set followers walkers) [ walk-move ]
  ][
    ;; PUPI normal search moves
    find-leader
    ask followers [ follow-move ]
    ask walkers [ walk-move ]
    ask pupi-leader [ set color red ]
  ]
  set pupi-runtime pupi-runtime + timer
  if cohesion? [ set pupi-cohesion sum [distance pupi-leader] of followers ]

  update-spotlight
  tick
  if (ticks > max-ticks) or ((pupi-best-tick > 0) ) [stop]
end 

;; find leader pigeon and update its fitness value

to find-leader
  ;; leader is best pigeon either follower or walker
  ask min-one-of (turtle-set followers walkers) [value][
    set pupi-leader self     ; update leader
    set pupi-leader-fitness value
    if pupi-leader-fitness < [value] of pupi-best-patch [
        set pupi-best-patch patch-here
        if pupi-best-patch = true-best-patch [ set pupi-best-tick ticks ]
    ]
  ]
end 

;; move followers towards pigeon leader

to follow-move
  face pupi-leader fd (distance pupi-leader) * alpha
  rt one-of [0 90 180 270] fd random-normal 0 2  ; a small route deviation due to collisions or wind
  set color blue
end 

;; move walkers around

to walk-move
  rt one-of [0 90 180 270] fd (sigma * random-normal 0 1)
  set color green
end 

;; turn on the spotlight on the chosen agent

to update-spotlight
  ifelse spotlight = "Pupi best ever"
  [ watch pupi-best-patch]
  [ ifelse spotlight = "True best"
    [  watch true-best-patch ]
    [ ifelse spotlight = "Pupi leader"
      [  watch pupi-leader ]
      [  reset-perspective ]
    ]
  ]
end 

There are 28 versions of this model.

Uploaded by When Description Download
Sergio Rojas-Galeano over 4 years ago Link to paper Download this version
Sergio Rojas-Galeano over 4 years ago Info tab encoding error fixed (finally!) Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab encoding error fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab encoding error fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Info tab fixed Download this version
Sergio Rojas-Galeano over 4 years ago Initial upload Download this version

Attached files

File Type Description Last updated
PUPIReal_UserGuide.pdf pdf User guide over 4 years ago, by Sergio Rojas-Galeano Download
Urban Pigeon-inspired Model for Unconstraint Optimisation.png preview Preview for 'Urban Pigeon-inspired Model for Unconstraint Optimisation' over 4 years ago, by Sergio Rojas-Galeano Download

This model does not have any ancestors.

This model does not have any descendants.