BehaviourComposer: ignore everything before this.
Begin micro-behaviour
Begin description:
Lay out a set of agents where the agents repel each other and the links between them act like springs.
End description
Lay out linked agents
Begin NetLogo code:
substitute-text-area-for repetitions 500 substitute-text-area-for nodes-to-layout all-individuals substitute-text-area-for links-in-layout links substitute-text-area-for spring-constant .2 substitute-text-area-for spring-length 5 substitute-text-area-for repulsion-constant 1 substitute-text-area-for setup-code ; place for code to set things up (if needed) no-display setup-code repeat repetitions [layout-spring nodes-to-layout links-in-layout spring-constant ; a measure of the "tautness" of the spring spring-length ; the "zero-force" length or the natural length of the springs repulsion-constant] ; a measure of repulsion between the nodes display
End NetLogo code
All the text areas can be edited. If you want to limit the agents involved edit the first box. E.g. To only layout sheep replace it with all-of-kind "Sheep". To limit the layout to a subset of the links replace the contents of the second text area.
This uses the NetLogo layout-spring primitive to place the agents. It repeats calls to layout-spring since each time the constraints are solved bringing the configuration of agents closer to the ideal solution.
Lay out linked agents was implemented by Ken Kahn on 1 February 2011.
BehaviourComposer: ignore everything after this.