Skip to content

m1ng2e/Alfalo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 

Repository files navigation

Alfalo

Alfalo is an AnyLogic Library for Fast Layout Generation. It provides a easy way to generate complex layout programmatically in AnyLogic Models.

Use case:

There are cases where users may want to generate layout networks in AnyLogic programmatically with input from some databases, instead of drawing directly in AnyLogic software. For example, when the end user receives a stand-alone java application version of the simulation from the model builder, the end user do not have access to the wonderful AnyLogic space markup APIs, then to generate layout networks from databases enables the end user to test different layout networks. The Alfalo library simplifies the layout network generation from database process, making it fast, easy and intuitive. The types of network nodes that are currently supported are point node, polygonal node, and rectangular node.

Main Features

There are two main features: Node/Node Group Manipulation and Fast Path Generation.

Node/Node Group Manipulation:

Manipulation of nodes and node groups means applying flipping and rotation on defined prototypes around their origin. In lots of complex layouts, there are nodes and node groups that are the same but are just manipulated in some way. For example, in some manufacturing plants, stations (nodes) and centers (node groups) that are essentially the same are replicated across the plant. The Alfalo library enables the users to define prototypes for nodes and node groups, so that new nodes and node groups can be easily generated by specifying the position and the manipulation of the corresponding prototype, as shown in Figure 1 and 2. Note: When manipulating nodes and node groups, flipping operations will by default happen before rotation operations.

In some cases where of node/node group manipulation, user prefers to use AnyLogic's node constructor to generate nodes, the Alfalo library would also support it with no problem. The user can use putRectangularNode(), putPolygonalNode(), and putPointNode() method to add the generated node for final compilation.

Figure 1: Node Manipulation for a Rectangular Node

Figure 2: Node Group Manipulation

Fast Path Generation:

Rather than defining paths one by one and specifying source and target for each path, like how it is normally done in AnyLogic, the Alfalo library enables easy paths generation by requiring less parameters from the users by using Alfalo paths. When an Alfalo path is defined to cross one or more nodes, multiple paths connecting the nodes will be automatically generated, as shown in Figure 3. When two Alfalo paths are defined to cross each other, four paths connected by a point node will be automatically generated, as shown in Figure 4. The library will automatically figure out the source and target of each generated path.

Figure 3: Alfalo Path Crossing Rectangular Nodes

Figure 4: Alfalo Paths Crossing Each Other

Memory Feature

The memory feature saves the layout generated to a text file, so that the same layout does not need to be recalculated for each experiment instance. This is especially beneficial when doing replicated experiments. To activate the memory feature, use setStateFile(java.lang.String stateFileName).

Getting Started

These instructions will get Alfalo integrated with AnyLogic.

Prerequisite

You need to have AnyLogic with any valid license (PLE, University, or Professional) installed on your machine.

Installation

  1. Download the Alfalo.jar file (from the releases) and place it somewhere it won't be moved (or accidentally deleted).
  2. Add it to your AnyLogic palette. A step-by-step explanation of how to do this is available in the AnyLogic help article "Managing Libraries".
  3. You should see a new palette item for Alfalo with the Alfalo Layout Generator agent.

Example Implementation

The layout in Figure 5 is generated with the AnyLogic model Alfalo Library Example.zip.

image

Figure 5: Example Layout (Blue: Nodes, Black: Paths, Green: Attractors)