Top Banner
LoLoLA Documentation Release 1.750 H. W. Hamacher, Andrea Maier, Aleksandra Gross, Philipp Heßle July 26, 2016
72

LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

Mar 09, 2018

Download

Documents

buianh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA DocumentationRelease 1.750

H. W. Hamacher, Andrea Maier, Aleksandra Gross, Philipp Heßler

July 26, 2016

Page 2: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in
Page 3: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

CONTENTS

1 What is LoLoLA? 11.1 Library of Location and Layout Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Screenshots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Install LoLoLA 32.1 Required Packages for API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 Required Packages for GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.3 Optional Packages for Unittesting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.4 Optional Packages for Documenting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3 What is a Location Problem? 53.1 Classification Scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53.2 Planar Location Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.3 Network Location Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.4 Discrete Location Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.5 The multicriteria case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.6 Notes on Single- and Multifacility Location Problems . . . . . . . . . . . . . . . . . . . . . . . 17

4 What is a Layout Problem? 194.1 Mathematical Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194.2 Example: Urban Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

5 Tutorials 255.1 API Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255.2 GUI Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355.3 LoLoLA File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

6 List of LoLoLA Algorithms 616.1 Planar Location Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616.2 Network Location Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616.3 Discrete Location Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626.4 Layout Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

7 Licenses and Software-packages 637.1 LoLoLA-License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637.2 Third-party software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

i

Page 4: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

ii

Page 5: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

CHAPTER

ONE

WHAT IS LOLOLA?

Contents

• What is LoLoLA?– Library of Location and Layout Algorithms– Screenshots

1.1 Library of Location and Layout Algorithms

LoLoLA (Library of Location and Layout Algorithms) is a Python based software package, that contains algo-rithms for solving location and layout problems. LoLoLA consists of a GUI (graphical user interface) and aPython API (application programming interface), providing the following features:

• Python language data structures for all Problem instances

– easy to teach

– fast

– multi-platform

• additional GUI to generate location and layout problems

– no need of programming knowledge

– wizard that guides through the creation of a problem

– also multi-platform

• detailed documentation

• graphical interpretation of solution

• suitable for multicriteria problems

– finds representative system of pareto solutions

– shows those pareto solutions, that fulfill given restrictions

The Software started out to be a support tool for the BMBF1 Project Multikosi2 and was partially supported undergrant FKZ 13N12826.

1http://www.bmbf.de/en/index.php2http://www.multikosi.de/

1

Page 6: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

1.2 Screenshots

2 Chapter 1. What is LoLoLA?

Page 7: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

CHAPTER

TWO

INSTALL LOLOLA

Developers and user who want to get the programming interface working have to install the following packages toget LoLoLA working:

2.1 Required Packages for API

LoLoLA was implemented and tested with Python 2.7. Although most might work with Python version 3 andlater, it is recommended to use version 2.7, since it has some additional libraries which do not completely workwith Python 3. You can get Python at http://www.python.org.

The following are required packages to make LoLoLA completely work:

2.1.1 NetworkX

NetworkX provides modeling of graphs which are used for network location problems. http://networkx.github.io/

2.1.2 NumPy

Numpy is used for matrix computations in the algorithms. You can get NumPy at: http://scipy.org/Download

2.1.3 Matplotlib

Matplotlib is used for drawing LocationProblems. http://matplotlib.sourceforge.net/

2.1.4 PuLP

In some cases a linear program must be solved. This is done via the python package PuLPhttps://pypi.python.org/pypi/PuLP/.

2.1.5 Solver

For some algorithms LoLoLA needs a linear programming solver. A free one (GLPK), whichis also shipped with the GUI is available at https://www.gnu.org/software/glpk/. However, it isalso possible to integrate other solvers like Gurobi(http://www.gurobi.com/) or CPLEX(http://www-01.ibm.com/software/commerce/optimization/cplex-optimizer/)

PuLP might require some tweaking of the file <python-install-dir>/Lib/site-packages/pulp/pulg.cfg.<operatingsystem>. For example, to enable the GLPK solver in PuLP the GlpkPath must be set in this file.

3

Page 8: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

2.2 Required Packages for GUI

If you additionally want to use the graphical user interface you need the following packages

2.2.1 PyGTK and GTK+

Interface between python and GTK+. Avaible at http://pygtk.org/. We recommend to use the all in one installerwhich installs all further dependencies (PyGTK, PyGObject, PyCairo, and a GTK+ runtime).

2.3 Optional Packages for Unittesting

If you want to get unittesting working, you need some optional packages.

2.3.1 nose

Nose is an extension for unittests to make them much easier. https://pypi.python.org/pypi/nose/

2.3.2 mock

To have all unittests independent from each other, mock is used. https://pypi.python.org/pypi/mock

2.4 Optional Packages for Documenting

2.4.1 Sphinx

For Documentation the tool Sphinx was used http://sphinx-doc.org/

2.4.2 numpydoc

In addition to Sphinx numpydoc makes documenting Classes much easier.https://pypi.python.org/pypi/numpydoc.

4 Chapter 2. Install LoLoLA

Page 9: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

CHAPTER

THREE

WHAT IS A LOCATION PROBLEM?

Contents

• What is a Location Problem?– Classification Scheme– Planar Location Problems

* The distance function* The objective function* Example: Maximizing profit* Example: Maximizing security* Example: Maximizing security with restrictions

– Network Location Problems* The distance function* The objective function* Example: New York Elections* Example: Catching the criminal

– Discrete Location Problem– The multicriteria case

* Example: Food stall at street festival– Notes on Single- and Multifacility Location Problems

A location problem deals with finding optimal locations for one or several new facilities. These optimal locationsare influenced by several parameters given by demand points, sometimes referred to as existing facilities (forexample train stations or parking spaces), the amount of clients the new facilities have to serve, and many more.

Location problems are distinguished in three major parts: planar, network and discrete location problems. Be-fore explaining these problems, we will introduce a classification scheme for differentiating all kinds of locationproblems.

Note: Although there are mathematical definitions in the next parts, the documentation is written in such away, that everyone should understand what the differences between the parameters are, even when skipping theformulas.

3.1 Classification Scheme

We use 5 positions to distinguish our problem and write it in terms of 𝑃𝑜𝑠1/𝑃𝑜𝑠2/𝑃𝑜𝑠3/𝑃𝑜𝑠4/𝑃𝑜𝑠5.

𝑃𝑜𝑠1 contains the number of new facilities.

𝑃𝑜𝑠2 contains the type of location problem

• 𝑃 means planar problem

• 𝐺 means network problem

• 𝐷 means discrete location problem.

5

Page 10: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

𝑃𝑜𝑠3 contains specials, like restricted areas or uniform weights

𝑃𝑜𝑠4 contains the type of distance, depending on the problem itself

𝑃𝑜𝑠5 contains the objective function

•∑︀

means median problem

• max means center problem

The next table illustrates a short overview of the different parameters. The specific entries will be explained in thenext sections.

Planar Network DiscretePos 1 Number of new facilitiesPos 2 P G: undirected graph D

𝐺𝐷: directed graphT: Tree

Pos 3 R: Restriction𝑤 = 1: unweighted problem

Q-criteria: multicirteria problemPos 4 𝑙2, 𝑙𝑝, 𝑙1, 𝑙∞ ‘d(V,V)‘: vertex problem 𝑙𝑚𝑒𝑡𝑟: discrete metric

‘d(V,G)‘: absolute problemPos 5 Σ: median Σ: median

Σ−: in-medianΣ+: out-median

max: center max: centermax−: in-centermax+: out-center

Note: In multicriteria problems 𝑄−Σ or 𝑄−max is often used at position 5, instead of Q-criteria at position 3.

The next paragraphs will explain the different parameters of the classification scheme. There are several exampleswith a solution given. How to solve these examples will be explained in the Tutorials section.

3.2 Planar Location Problems

Like the name says, in a planar or also called continuous location problem, one is interested in finding newlocations in the plane. In contrast to the other location problems, where the locations are kind of predefined, theselocations are given by the x- and y-coordinates and can be anywhere except in the forbidden regions if existent.

Feasible parameters for this problem would be a distance measure to other facilities and, if necessary, the impor-tance/priority to these demand points, which is usually given by different weights.

A very intuitive distance measure is the straight distance (or Euclidean distance). However, other mathematicaldistance measures as the Manhattan distance or the Chebyshev distance might be useful as well.

3.2.1 The distance function

There are several distance measures in the planar case. The following paragraph will explain the most importantones:

• 𝑙2 , Euclidean distance: This is the airline distance, hence, the straight line from a demand point to the newfacilities is measured.

𝑙2(𝑥, 𝑦) =√︀

(𝑥1 − 𝑦1)2 + (𝑥2 − 𝑦2)2

6 Chapter 3. What is a Location Problem?

Page 11: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

• 𝑙22 , squared Euclidean distance: This distance measure is the square of the Euclidean distance. It can beused as an approximation for the Euclidean distance. Problems of this kind are often easier to solve.

𝑙22(𝑥, 𝑦) = (𝑥1 − 𝑦1)2 + (𝑥2 − 𝑦2)2

• 𝑙1 , Manhatten distance: In this distance, people are only allowed to go horizontal or vertical ways. Thisdistance is useful, when having a street grid like Manhattan.

𝑙1(𝑥, 𝑦) = |𝑥1 − 𝑦1| + |𝑥2 − 𝑦2|

• 𝑙∞ , Chebychev distance: Only considers the maximal absolute value of the first and second coordinates.This norm can be used, for example, when a location for a robot must be found. The arms of robots canoften be moved in two directions independently, thus only the maximal distance of the two direction matters.

𝑙∞(𝑥, 𝑦) = max{|𝑥1 − 𝑦1|, |𝑥2 − 𝑦2|}

3.2.2 The objective function

Depending on the purpose of the new facilities, there are different kinds of objective functions. In the followingpart 𝑑(·, ·) will be any of the distance measures introduced in the previous paragraph.

3.2. Planar Location Problems 7

Page 12: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

• median: The median objective minimizes the total sum of all distances from existing facilities to newfacilities and, if weights are unequal to zero, from new facilities to other new facilities in the multifacilitycase. This function is useful when maximizing profit.

If ℳ = {1, . . .𝑀} is the index set of all demand points at locations 𝑎𝑖, each associated with a positiveweight 𝑤𝑖 for 𝑖 ∈ 𝑀 , then the single facility median objective can be written as

min

𝑀∑︁𝑖=1

𝑤𝑖𝑑(𝑥, 𝑎𝑖).

And, similarly for the multifacility case with N new locations:

min

𝑀∑︁𝑖=1

𝑁∑︁𝑗=1

𝑤𝑖𝑗𝑑(𝑥𝑗 , 𝑎𝑖) +∑︁

1≤𝑖<𝑗≤𝑁

𝑣𝑖𝑗𝑑(𝑥𝑖, 𝑥𝑗).

• center: The center objective minimizes the maximum distance from the new facilities to the demand points.This is helpful if someone wants to maximize security or safety, for example when a good position for afirst aider should be found such that he can be as fast as possible to any demand point.

With the same notation as in the median case, the center objective for single facility (and multifacilityrespectively) can be written as:

min𝑥∈R2

max𝑖∈ℳ

{𝑤𝑖𝑑(𝑥, 𝑎𝑖)}

min max

{︂max{𝑤𝑖𝑗𝑑(𝑎𝑖, 𝑥𝑗) : 𝑖 ∈ ℳ, 𝑗 ∈ 𝒩}max{�̂�𝑖𝑗𝑑(𝑥𝑖, 𝑥𝑗) : 𝑖 ∈ 𝒩 , 𝑗 ∈ 𝒩}

}︂

Warning: Although in the examples the profit or the security is maximized, the objective function wasdesigned to find a minimum. Hence, we have to think the other way round, the smaller the objective value thebetter.

To illustrate the difference between the center and the median objective, the next two examples might be helpful.

3.2.3 Example: Maximizing profit

Assume there is a big event with lots of people and those people are hanging out in groups. Those groups arerepresented by demand points 𝑎𝑖, and distributed like shown in the picture. Each group has the same priority, soall weights are equal to 1.

Note: In a mathematical model the groups of people will be represented by simple dots. Without doing thissimplification the model would become too complex to solve.

The organizer of this event wants to know where to place an ice cream stall to maximize the profit. The event takesplace on a meadow, thus the people can directly go to the stall. A possible objective is to minimize the overalldistance the people have to go, hence we consider the median objective. Assume the stall can be anywhere in theevent area. Thus, we have to solve a 1/𝑃/𝑤 = 1/𝑙2/

∑︀location problem.

See also:

• Programming Code

• JSON Code

The picture shows that the optimal position of the salesman is basically in the center where most people are.

8 Chapter 3. What is a Location Problem?

Page 13: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

3.2.4 Example: Maximizing security

Now assume the organizer also wants to place a first aider. Since the first aider and the ice cream store have norelation to each other, this can be considered as a separate location problem.

In contrast to the first problem, the aim is not to minimize the overall distance people are going. The first aider hasto be as fast as possible at each group in case of an emergency. Since we do not know where an emergency canoccur, we have to consider all of the groups. Hence, we want to minimize the maximum distance from the firstaider to any of the groups and, thus, use the center objective. The problem to be solved is a 1/𝑃/𝑤 = 1/𝑙2/maxlocation problem.

See also:

• Programming Code

• JSON Code

The solution to this problem is shown in the next picture. One can clearly see the difference to the ice cream stall.While the stall is more in the center where most groups are, except group 𝑎4 which is not taken much into account,the security guard is not allowed to neglect 𝑎4. Therefore, he is closer to that group than the store. Moreover, theposition of the guard is exactly between 𝑎1 and 𝑎4 since those are the points furthest away.

3.2. Planar Location Problems 9

Page 14: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

3.2.5 Example: Maximizing security with restrictions

Now assume the first aider is not allowed to locate himself wherever he wants. For organizational reasons, the firstaider is only allowed to be at the border of the event area, such that he is not in the visitors’ way. Therefore, thereis a restricted area in the middle, as shown in the next picture. The problem changes to a 1/𝑃/𝑤 = 1, 𝑅/𝑙2/maxlocation problem.

See also:

• Programming Code

• GUI Manual

• JSON Code

As you can see, the optimal solution will be at the border of the restricted area.

10 Chapter 3. What is a Location Problem?

Page 15: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

3.3 Network Location Problems

One easily sees, that sometimes it is not reasonable to use the planar location model, for example, when placing anew facility in the street network of a city. Because of streets, walls, or other possible structures, one cannot usestraight lines, but has to navigate through the infrastructure of the city. This observation leads to the idea of usinggraphs and networks, where the name Network Location Problem comes from.

In the next figure, a mathematical abstraction of a road system is given.

The nodes, denoted by the capital letters, represent crossings and locations of existing facilities. The numbers nextto the arrows between two nodes represent the time or effort to pass from one node to the other. This examplerepresents a directed graph, in which all edges are directed, hence the roads are only one way. In an undirectedgraph the direction one can pass an edge is not specified.

We recognize some differences to the Planar Location Problem

• In general we do not have symmetry anymore. The distance from H to I is 1 but the distance from I to H is10 (from I to J, then from J to F, and then from F to H).

• Between some points there is no direct connection and we have to figure out the shortest way with analgorithm (e.g. Bellman-Ford).

• There are no coordinates anymore.

In general, optimal solutions can be allowed to be on edges or only on nodes. For more information about thistype of problem see S. Nickel Discrete and Network Location Theory. [TODO: Link oder mehr Informationen]

3.3.1 The distance function

Note that the distance depends on whether we have a planar location problem or a network location problem. Inthe planar case the distance is given by the coordinates and the distance function, whereas in network case thedistance is given by the shortest way in the network.

If we allow the new location to be on an edge, then the distance measure on Pos4 in the classification scheme isd(V,G), otherwise, i.e. when the new locations may only be located on nodes, it is d(V,V).

3.3.2 The objective function

Like in the planar case, there are median and center functions. However, like already realized, the distance measureis not symmetric anymore. Hence, the way to the new facility might be shorter than the way back. Therefore, thein-median/in-center which considers the way to the new facilities and out-median/out-center which considersthe way back from the new facilities are introduced.

3.3. Network Location Problems 11

Page 16: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Let 𝑀 be the set of indices, 𝑤𝑖 the weights of location 𝑖, and 𝑑(𝑢, 𝑣) the distance from 𝑢 to 𝑣. Let X either bethe set of all vertices in the graph if the distance measure is d(V,G) or the set of all points P(G) if the measure isd(V,V).

The in-median, minimizing the average distance from the customers to the facility tries to find the minimum of:

𝑓−(𝑥) =∑︁𝑖∈𝑀

𝑤𝑖 · 𝑑(𝑣𝑖, 𝑥).

The out-median, minimizing the the average distance from the facility back to where the customers came from,finds the minimum of:

𝑓+(𝑥) =∑︁𝑖∈𝑀

𝑤𝑖 · 𝑑(𝑥, 𝑣𝑖).

And finally, the median problem which considers both ways is given by:

𝑓(𝑥) =1

2· (𝑓−(𝑥) + 𝑓+(𝑥)).

In the multifacility case, there are different types of objectives. On the one hand, if the new facilities offer differentkinds of services, the median objective is given by:

𝑓(𝑥) =∑︁𝑖∈𝑀

∑︁𝑗∈𝑁

𝑤𝑖𝑑(𝑣𝑖, 𝑥𝑗) +∑︁

𝑖,𝑗∈𝑁 :𝑖>𝑗

�̂�𝑖𝑗𝑑(𝑥𝑖, 𝑥𝑗),

which is equivalent to the planar case.

On the other hand, if the new facilities provide similar services (like supermarkets or cinemas), the clients usuallyonly visit the closest. Then the objective functions, again considering the way to the facility, from the facility andboth ways, are given by:

𝑓−(𝑋) =∑︁𝑖∈𝑀

𝑤𝑖𝑑(𝑣𝑖, 𝑋)

𝑓+(𝑋) =∑︁𝑖∈𝑀

𝑤𝑖𝑑(𝑋, 𝑣𝑖)

𝑓(𝑋) =1

2· (𝑓−(𝑋) + 𝑓+(𝑋)),

where

𝑑(𝑋, 𝑦) := min𝑥∈𝑋

𝑑(𝑥, 𝑦),

𝑑(𝑦,𝑋) := min𝑥∈𝑋

𝑑(𝑦, 𝑥).

The center function for a single facility minimizes the maximal distance to any demand point, i.e. the longestway/time from the new facility to any demand point will not be greater than the corresponding of the followingvalues:

𝑔−(𝑥) = max𝑖∈𝑀

𝑤𝑖 · 𝑑(𝑣𝑖, 𝑥)

𝑔+(𝑥) = max𝑖∈𝑀

𝑤𝑖 · 𝑑(𝑥, 𝑣𝑖)

𝑔(𝑥) = 𝑔−(𝑥) + 𝑔+(𝑥)

and in the multifacility case:

𝑔(𝑥) = max

{︃max{𝑤𝑖𝑗𝑑(𝑣𝑖, 𝑥𝑗) : 𝑖 ∈ 𝑀, 𝑗 ∈ 𝑁}max{�̂�𝑖𝑗𝑑(𝑥𝑖, 𝑥𝑗) : 𝑖 ∈ 𝑁, 𝑗 ∈ 𝑁}

and

𝑔−(𝑋) = max𝑖∈𝑀

𝑤𝑖𝑑(𝑣𝑖, 𝑋)

𝑔+(𝑋) = max𝑖∈𝑀

𝑤𝑖𝑑(𝑋, 𝑣𝑖)

𝑔(𝑋) = (𝑔−(𝑋) + 𝑔+(𝑋)).

12 Chapter 3. What is a Location Problem?

Page 17: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

3.3.3 Example: New York Elections

New York wants to elect a new mayor, so they want to set up a polling station such that the way for the inhabitantsof Staten Island, Manhattan, Brooklyn, Queens and the Bronx is as short as possible. Hence, we want to find alocation such that the overall time for the inhabitants to come to the polling station is minimized. Since in NewYork there are a lot of streets and a lot of traffic, it is reasonable to model this situation as a network and not as aplanar location problem. The polling station is only allowed in the different boroughs, not between them. In ourclassification scheme that means we have a 1/𝐺/./𝑑(𝑉, 𝑉 )/

∑︀problem.

See also:

• Programming Code

• GUI Manual

• JSON Code

With the values shown in the graph, the polling station should be opened in Queens. Of course, only one pollingstation for all the people in New York would be a little insufficient. In reality we would make a graph withmany more vertices and we would set more than one polling station. This would result in a 𝑁/𝐺/./𝑑(𝑉, 𝑉 )/

∑︀problem, where N can be any natural number.

If we also allow the polling stations to be on edges, i.e. somewhere on the streets, the problem becomes a𝑁/𝐺/./𝑑(𝑉,𝐺)/

∑︀problem.

3.3.4 Example: Catching the criminal

The most of us have played the game Scotland Yard, where the goal is to catch the mysterious Mister X in thestreets of London. The game is played on a street map that consists of hubs that are connected by streets or othermeans of transportation, like the Metro. A person can move from one hub to another by walking, using the Metro,or using a ship. Going by Metro one travels further and faster. Each hub can be modeled as a vertex and the streetsconnecting the hubs as edges in a graph. The different travel times can be modeled by distances on the edges.

Assume there is one policeman, who wants to catch Mister X. We want to find the optimal place, so that he canreach Mister X’ position as fast as possible. By experience, the policeman knows where criminals linger, so everynode in the network gets a weight according to his experience. A high weight means that it is very probable thatMister X shows up. The policeman has to solve a 1/𝐺/./𝑑(𝑉, 𝑉 )/max problem to find a good position to catchMister X. The mathematic graph of the above excerpt, including subway connections, is given in the followingnetwork.

3.3. Network Location Problems 13

Page 18: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

See also:

• Programming Code

• JSON Code

The optimal solution for this excerpt is vertex 130 and the objective value is 42. Hence, if Mister X shows up atany point, the maximum distance the policeman has to travel is 42 (units).

3.4 Discrete Location Problem

The discrete location problem is the most theoretical problem. However, it might also be the most importantproblem in a practical application. In a discrete location problem there is no underlying network or other visualstructure like in the network or planar location problem. The user has to predefine possible sites of locations, thedistances between the locations and the weights by himself.

3.5 The multicriteria case

Often, there is not only one objective to consider, but more than one. This happens, when for example organizerspursue several aims, like maximizing profit, security, etc. Often these aims are conflicting, such that if you improveone aim, another one worsens. A solution, in which you cannot improve one objective value without worseninganother one, is called Pareto solution. Since Pareto solutions cannot be improved, the set of all Pareto solutions isoften considered to be the ‘optimal’ solution to a multicriteria problem. These sets can be quite large. LoLoLAfinds representative systems of the set of all Pareto solutions.

The next example illustrates the concept.

3.5.1 Example: Food stall at street festival

Consider a big street festival in a district of Mannheim. Since the streets of Mannheim partition the city intosquares, it is possible to use a network location model as well as a planar model with rectilinear distance. Assumethat a butchery wants to open a stall on the streets and they have several options where to put the stall. On the oneside, they want to maximize their profit, but on the other side they also want to provide good quality meat.

14 Chapter 3. What is a Location Problem?

Page 19: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

The four important locations of possible customers are marked by blue circles and red squares in the followingpicture.

The blue circles mark places next to schools. These locations promise a good profit since a lot of the pupils willget their lunch from the stall. However, they must be served fast and the quality of the meat will suffer due to thistime pressure.

In contrast, the red squares mark locations in a residential zone. Here the number of customers is lower and theprofit is lower than at the blue circles. The customers will show up throughout the day, though, and, thus, the meatcan be prepared more carefully which increases the quality.

This problem can be modelled as a 1/𝑃/2 − 𝑐𝑟𝑖𝑡𝑒𝑟𝑖𝑎/𝑙1/∑︀

location problem.

See also:

• Programming Code

• GUI Manual

• JSON Code

In the next picture the mathematical model with according weights is given. The weights labelled with a p arefor the profit objective, while the weights labelled with a q belong to the quality objective. Since we considerminimization problems, the gathering points around the schools (𝑎1 and 𝑎2) have a high profit value and a lowquality value. Opening the stall close to these locations results in a low (i.e. good) profit value while opening thestall further away results in a quite large (i.e. bad) profit value. Since the quality value of these locations is nothigh, the influence on the quality objective does not depend so much on the distance between the stall and thesetwo locations. For the other two gathering points (𝑎3 and 𝑎4) the influce on the profit and the quality value isreversed.

As seen in the solution, moving the stall along the solution space, one objective will become better, while the otherone worsens. Hence, the butchery must find a compromise between profit and quality.

3.5. The multicriteria case 15

Page 20: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Warning: Recall that the objective functions were designed to find a minimum, hence, larger function valuesare worse than smaller ones. As a consequence, solution 1 has the best profit and the worst advertising, whilesolution 3 has the worst profit, but best advertising. Solution number 2 is a compromise between profit andadvertising.

16 Chapter 3. What is a Location Problem?

Page 21: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

3.6 Notes on Single- and Multifacility Location Problems

In most problems the location of a single new facility is seeked. In this case, the problem is called a SingleFacility Location Problem. If we want to open several new facilities, the problem is called Multi Facility LocationProblem. This distinction is benefical, because computing a good location to open one new facility is usually lesscomplex than finding locations for two new facilities since the location of the first location might affect the optimallocation of the second one and vice versa. These problems are in most cases NP-complete. For an NP-completeproblem, there is probably no algorithm which identifies the optimal solution in an acceptable amount of time.For these problems LoLoLA uses algorithms that identify a good solution, but in general not the optimal one.

3.6. Notes on Single- and Multifacility Location Problems 17

Page 22: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

18 Chapter 3. What is a Location Problem?

Page 23: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

CHAPTER

FOUR

WHAT IS A LAYOUT PROBLEM?

Contents

• What is a Layout Problem?– Mathematical Model– Example: Urban Event

In contrast to location problems where the focus for each facility is the absolute location in layout problems thelocation relative to the other (new) facilities is more important. The location of one facility influences the qualityof the locations of the other facilities. With the help of layout problems, optimal locations and assignments offood stands at a public event can be found. In this example the goal is to spread the stands over the area, such thatpeople are not concentrated at one place as this might lead to problems in an emergency situation. Another goalcan be to locate stands, where they attract visitors, which will maximize the profit. One might also be wishing tolocate food stands far from other facilities such as stages or toilets.

4.1 Mathematical Model

The Quadratic Assignment Problem (QAP) is often used to model layout problems. In this model, 𝑁 facilties areassigned to 𝑁 locations. This is done by minimizing a weighted sum of distances between the new facilities. Inurban event planning, it is possible that the number of possible locations is bigger than the number of facilitiesto place. Also, some locations of facilities are already predefined, for example the stage or electrcity connectors.Therefore, the Quadratic Assignment Problem is extended in the following definition.

𝑀 Number of possible locations for new facilitiesℳ = {1, . . . ,𝑀} Set of possible locations for new facilities𝑁 Number of new facilities𝒩 = {1, . . . , 𝑁} Set of new facilities𝑛 Number of fixed facilities𝑑𝑖𝑗 Distance from location 𝑖 to 𝑗 for 𝑖, 𝑗 ∈ {1, . . . ,𝑀 + 𝑛}𝑤𝑖𝑗 Weight between facilities 𝑖 and 𝑗 for 𝑖, 𝑗 ∈ {1, . . . , 𝑁 + 𝑛}

For 𝑖 ∈ 𝒩 and 𝑗 ∈ ℳ define

𝑥𝑖𝑗 =

{︃1 if new facility 𝑖 ∈ 𝒩 is assigned to location 𝑗 ∈ ℳ0 else

Assuming that the fixed facilities are assigned to locations {𝑀 + 1, . . . ,𝑀 + 𝑛}, 𝑥𝑖𝑗 is extended to

𝑥𝑖𝑗 =

{︃1, if 𝑖 = 𝑗 for 𝑖, 𝑗 ∈ {𝑀 + 1, . . . ,𝑀 + 𝑛}0, if 𝑖 ̸= 𝑗 for 𝑖, 𝑗 ∈ {𝑀 + 1, . . . ,𝑀 + 𝑛}}.

19

Page 24: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Then the optimization problem can be formulated as:

min

𝑁+𝑛∑︁𝑘=1

𝑀+𝑛∑︁𝑙=1

𝑁+𝑛∑︁𝑖=1,�̸�=𝑘

𝑀+𝑛∑︁𝑗=1,𝑗 ̸=𝑙

𝑤𝑖𝑘𝑑𝑗𝑙𝑥𝑖𝑗𝑥𝑘𝑙

s.t.𝑁∑︁𝑖=1

𝑥𝑖𝑗 ∈ {0, 1} 𝑗 ∈ ℳ

𝑀∑︁𝑗=1

𝑥𝑖𝑗 = 1 𝑖 ∈ 𝒩

4.2 Example: Urban Event

See also:

• GUI Tutorial

• JSON Tutorial

In the next example six locations have to be found for food stores. The stores are named Food1, Food2, Food3,BBQ, ice-cream and Smoothies. The event area is shown in the picture below.

Fig. 4.1: Plan of urban event, provided by Vabeg (http://www.vabeg.com/).

In this example the food stands cannot be located anywhere on the event area, because they might block the stageview or the emergency escape routes. There are several existing locations or demand points like power connectors,bars, emergency exits, dance floors, stages and so on.

The possible locations are illustrated as red crosses in the next Figure, the fixed locations are black crosses. Bothof them have been determined by an expert. Note that in the mathematical model the facilties do not have an area,but are represented by points in the plane.

20 Chapter 4. What is a Layout Problem?

Page 25: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 4.2: Event plan with possible locations (red crosses) and existing facilities (black crosses)

Between the different types of food stores the following weights have been assigned by the user, where Food1,Food2 and Food3 is summarized as one type “Food”:

Food Ice-cream Smoothies BBQFood -500

Ice-cream -50 0Smoothies -50 50 0

BBQ -20 50 -50 0

A negative weight means that the two stores should be further away, while a positive one means that the storesshould be closer. This can also be done between the new and the fixed facilties

Exit Bar People Stage Electricity WCFood -70 70 30 -10 20 -50

Ice-cream -100 -100 70 -20 50 -50Smoothies -100 -100 70 -20 50 -50

BBQ -70 60 50 -30 100 -50

To simplify this problem the distance between the different locations is the Euclidean distance. In the followingpictures two solutions return by LoLoLA are shown, one without the existing facilities and one with existingfacilties.

4.2. Example: Urban Event 21

Page 26: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 4.3: Solution computed by LoLoLA.

Fig. 4.4: Solution with existing facilties.

As final step the user or the expert (in this case Vabeg1) can draw the food stands with their area, like seen in thefinal picture.

1http://www.vabeg.com/

22 Chapter 4. What is a Layout Problem?

Page 27: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 4.5: Final layout.

4.2. Example: Urban Event 23

Page 28: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

24 Chapter 4. What is a Layout Problem?

Page 29: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

CHAPTER

FIVE

TUTORIALS

5.1 API Tutorial

Contents

• API Tutorial– Location Problems

* Creating a location Problem· Planar Locations· Network Locations· Specifications· Examples

* Reading and writing a location problem* Solving a location problem* Plotting a solution* Examples

· Example: Maximizing profit· Example 2: Maximizing security· Example: Maximizing security with restrictions· Example: New York Elections· Example: Catching the criminal· Example: Food Stall at Street Festival

– Layout and Art Gallery Problems (Camera Problems)

5.1.1 Location Problems

In the previous section the different types of location problems - planar, network and discrete - have been intro-duced. As its name says, the planar location problem is a problem on the plane, where each location is representedby its coordinates. In a network location problem instead of a plane a graph is used and in the discrete case alllocations are already predefined.

In the LoLoLA API any location problem is of the type LocationProblem and, therefore, the first thing to dois to import LoLoLa library lolola which contains this class.

>>> import lolola

A location problem consists of a list of locations and a list of specifications according to the classification scheme.

Creating a location Problem

To create a location problem one must define a list of locations representing the demand points. They must bemembers of the class Location.

25

Page 30: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Planar Locations

For a planar location problem, a location is determined by its place, i.e. the coordinates, and a name. Thecoordinate will be defined by a Point on the plane.

>>> from lolola.geometry import Point

In the following example each existing location is a city in Germany which is given by a point on the plane(coordinates of the city) and its name.

>>> koeln = lolola.Location(Point(15, 16), 'Koeln')>>> duesseldorf = lolola.Location(Point(10, 36), 'Duesseldorf')>>> duisburg = lolola.Location(Point( 9, 52), 'Duisburg')>>> essen = lolola.Location(Point(20, 53), 'Essen')>>> dortmund = lolola.Location(Point(42, 58), 'Dortmund')>>> muenster = lolola.Location(Point(48, 90), 'Muenster')>>> planar_locations = [koeln, duesseldorf, duisburg, essen, dortmund, muenster]

Network Locations

In case of a network location problem, each existing location is defined by a vertex of a network and a name.Similar to planar problem, locations must be members of the class Location. For example if a graph has fourvertices named 1 to 4, the locations can be given by:

>>> koeln = lolola.Location(1, 'Koeln') #location 'Koeln' at vertex 1>>> duesseldorf = lolola.Location(2, 'Duesseldorf')>>> duisburg = lolola.Location(3, 'Duisburg')>>> essen = lolola.Location(4, 'Essen')

For our example the locations are:

>>> network_locations = [koeln, duesseldorf, duisburg, essen]

Specifications

For the problem specification, we have to import specifications. This module contains all specifications forlocation problems available in LoLoLA.

>>> from lolola import specifications as specs

The following specifications should be included in a location problem:

• Problem type: In case of a planar problem specifications must contain Planar as a problem type andNetwork for the network problem.

Note: While Planar can be used as is, Network requires the input of a network.

• Objective function: There are two functions which can be used as objective - either Median or Center.In a problem with median objective we minimize the weighted sum of distances between existingfacilities and a new location. In case of center objective we minimize the maximum of the distances.

In a network location problem, In-Median or Out-Median and In-Center or Out-Centercan be used as variants of the Median or Center objective. The solutions for these objectives willonly differ in directed graphs.

If the objective function is multicriterial then specification Multicriteria must be added.

• Distance measure: In case of a planar problem, depending on the norm of the problem, the distancesbetween facilities will be calculated. The following norms are available: Manhattan norm,Euclidean norm, squared Euclidean norm, p-norm, max-norm.

26 Chapter 5. Tutorials

Page 31: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

For network problems, if the new location is also allowed to be on an edge on the graph, the underlyingproblem is an absolute problem, else, the new location of the facility is only allowed to be on avertex of the graph, then we have a vertex problem.

• Weights: If the existing facilities of a problem have different weights, then we have a weighted problem.Otherwise our problem is unweighted.

Note: For the weighted case, the weights are always given by a list of lists or dictionaries, seeweighted. The number of lists or dictionaries equals the number of objective functions, while theentries in the lists or dictionaries are the weights according to each facility. Note that the ordering ofthe weights must be the same as the order of the locations given as input parameter in the Location-Problem.

>>> # for a single criterion weighted problem with 5 existing facilities:>>> weights = [[1, 2, 1, 0, 3]]>>> weight_spec1 = specs.Weighted(weights)>>> # in the multicriteria case>>> weights = [[1, 2, 1, 0, 3], [4, 0, 2, 4, 3]]>>> weight_spec2 = specs.Weighted(weights)>>> # unweighted, all weights are equal to 1>>> unweighted = specs.Unweighted

• Restrictions: If it is not allowed to place a new facility on some particular area in a planar location problem,then polygons and other restrictions can be used to model this area.

>>> from lolola.geometry import Polygon>>> restricted_area = Polygon((0, 1), (1, 1), (1, 0), (0, 0))>>> restriction = specs.ConvexPolygonRestriction(restricted_area)

Restrictions can also be given by complements, i.e. by specifying an area inwhich the new facility must be placed. For this type of restriction, additionallyto the specification describing the geometry of the restriction, an object of typeComplementRestriction<lolola.specifications.planar.ComplementRestrictionmust be given

>>> from lolola.geometry import Polygon>>> restricted_area = Polygon((0, 1), (1, 1), (1, 0), (0, 0))>>> restrictions = [specs.ConvexPolygonRestriction(restricted_area), specs.ComplementRestriction]

For every network location problem a specification must be given whether the problem is anabsolute or a vertex problem.

In a absolute network location problem, it is possible to restrict some edge segments of the graph:

>>> # s1: restricted area on edge is: {((2,1),t)|t in (0.25,0.75)}:>>> s1 = specs.EdgeSegment(2, 1, 0.25, 0.75)>>> s2 = specs.EdgeSegment(1, 3, 0, 0.6)>>> edge_restriction = specs.EdgeRestriction(s1, s2)

Examples

Planar Single Facility: To generate a 1|𝑃 | · |𝑙22|2 − Σ problem, we first have to define the locations and weightsof the existing facilities, as done in Planar Locations and Specifications. An example with three facilities:

>>> import lolola>>> from lolola.geometry import Point>>> import lolola.specifications as specs>>> # Generate list of locations>>> loc1 = lolola.Location(Point(110, 30), "Train Station")>>> loc2 = lolola.Location(Point( 50, 60), "Bus Station")>>> loc3 = lolola.Location(Point( 4, 120), "Parking Area")

5.1. API Tutorial 27

Page 32: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

>>> transport_assembly_points = [loc1, loc2, loc3]>>> # Now, we have to define weights for our facilities:>>> weights = [[3,1,2], [4,2,1]]>>> weight_spec = specs.Weighted(weights)>>> # Initialize Problem>>> planar_problem = lolola.LocationProblem(transport_assembly_points,... [specs.Planar, specs.Median,... specs.L2SquareNorm,... specs.Multicriteria, weight_spec])

Planar multifacility: To initialize a 2|𝑃 | · |𝑙1|max problem, we take the assembly points from the previousexample. Instead of locating one new facility, we want to locate two. Also, the distance between the two newfacilities might also be important. Recall that the objective function in the multifacility case is:

min

𝑁∑︁𝑖=1

𝑀∑︁𝑚=1

𝑤𝑚||𝑥𝑖 − 𝑎𝑚|| +∑︁

1≤𝑖<𝑗≤𝑁

𝑣𝑖𝑗 ||𝑥𝑖 − 𝑥𝑗 ||

Therefore, we have to initialize two weights, one for the weighting between the existing facilities and the newones and one for the weighting between the new two locations among themselves. This is done the following way:

>>> existing_facility_weights = [[4, 2, 3]]>>> new_facility_weights = [[0, 4],[0, 0]] # upper triangular 2x2 matrix>>> objective = specs.MultiFacilityWeights(existing_facility_weights, new_facility_weights)>>> weight_spec = specs.Weighted([objective])>>> # Initialize the location problem>>> multifac_prob = lolola.LocationProblem(transport_assembly_points,... [specs.Planar, specs.L1Norm,... specs.MultiFacility,... weight_spec, specs.Center])

Network Location: In a network location problem, an underlying graph must be specified. Graphs are modeledusing the NetworkX library.

>>> import networkx as nx>>> graph = nx.Graph()>>> edges = [(1, 2, 1), # edge from vertex 1 to 2 of length 1... (2, 3, 3), # edge from vertex 2 to 3 of length 3... (3, 4, 5)] # edge from vertex 3 to 4 of length 5>>> graph.add_weighted_edges_from(edges)

A 1-center weighted network location problem with only vertices allowed to be a solution is initialized as follows.

>>> weights = [[4, 1, 2, 2]]>>> network_problem = lolola.LocationProblem(locations, [specs.Network(graph),... specs.Center,... specs.Vertex,... specs.Weighted(weights)])

Reading and writing a location problem

Every full defined problem created via the API can be saved in a LoLoLA specific JSON format (see this tutorialfor more details on the file format).

>>> planar_problem.save_to_file("planar problem.json")

Problems saved in the LoLoLA specific JSON format can be read again.

>>> planar_problem = lolola.LoLoLAProblem.load_from_file("planar poblem.json")>>> print planar_problem.locations[0].nameTrain Station

28 Chapter 5. Tutorials

Page 33: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Solving a location problem

LoLoLA is able to automatically find the best suited algorithm for a LoLoLA problem. However, it is alsopossible to set an algorithm for solving the above planar location problem. In our example we will use theS_P___l2sqr_Median algorithm.

>>> from lolola.algorithms.planar import S_P___l2sqr_Median>>> planar_problem.set_algorithm(S_P___l2sqr_Median)

If this step is not performed, then based on the problem specifications the best algorithm will be found. Therefore,it is important that your specifications are well defined and none is forgotten.

Note: Every algorithm has an attribute called specifications. The specifications of the location problem haveto be the same, or at least be contained in the algorithm’s specification in order to solve the problem. Otherwise,an Exception will be raised.

Now all that is left to do is to solve the problem and display the results. After the method solve() is called thesolution set of the problem will be generated.

>>> planar_problem.solve()>>> solution_set = planar_problem.solution_set>>> print solution_set.solution[Point(24.0000000000000, 50.8333333333333)]>>> print solution_set.objective_value[[4442.83]]

In case of a network location problem the solution will look like this:

>>> network_problem.solve()>>> solution_set = network_problem.solution_set>>> print solution_set.solution[2, 3]>>> print solution_set.objective_value[[16]]

Plotting a solution

After solving a location problem, one can plot the problem. On the left hand side, the plot will show the existingfacilities and the new location, and on the right hand side, the plot will show the objective function values, whichwill be helpful in the multicriteria case.

>>> network_problem.plot()>>> planar_problem.plot()

5.1. API Tutorial 29

Page 34: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.1: Plot of a network problem.

30 Chapter 5. Tutorials

Page 35: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.2: Plot of a planar problem.

Examples

The following code segments will illustrate the examples already used in the previous section.

Example: Maximizing profit

See also:

• Example: Maximizing profit

• JSON Code

import lololaimport lolola.specifications as specsfrom lolola.geometry import Point

loc1 = lolola.Location(Point( 2, 8), '1')loc2 = lolola.Location(Point( 6, 9), '2')loc3 = lolola.Location(Point( 4, 3), '3')loc4 = lolola.Location(Point(14, 2), '4')loc5 = lolola.Location(Point( 5, 4), '5')loc6 = lolola.Location(Point( 9, 5), '6')loc7 = lolola.Location(Point( 6, 6), '7')loc8 = lolola.Location(Point( 3, 6), '8')locations = [loc1, loc2, loc3, loc4, loc5, loc6, loc7, loc8]

problem = lolola.LocationProblem(locations, [specs.Planar,

5.1. API Tutorial 31

Page 36: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

specs.Median,specs.L2Norm(),specs.Unweighted])

problem.solve()problem.plot()print problem.solution_set.solution_mapping# {28.3: [Point(5.6378575261494168, 5.6440586607912389)]}

Example 2: Maximizing security

See also:

• Example: Maximizing security

• JSON Code

import lololaimport lolola.specifications as specsfrom lolola.geometry import Point

loc1 = lolola.Location(Point( 2, 8), '1')loc2 = lolola.Location(Point( 6, 9), '2')loc3 = lolola.Location(Point( 4, 3), '3')loc4 = lolola.Location(Point(14, 2), '4')loc5 = lolola.Location(Point( 5, 4), '5')loc6 = lolola.Location(Point( 9, 5), '6')loc7 = lolola.Location(Point( 6, 6), '7')loc8 = lolola.Location(Point( 3, 6), '8')locations = [loc1, loc2, loc3, loc4, loc5, loc6, loc7, loc8]

problem = lolola.LocationProblem(locations, [specs.Planar,specs.Center,specs.L2Norm(),specs.Unweighted])

problem.solve()problem.plot()print problem.solution_set.solution_mapping# {6.7082039324993694: [Point(8.0, 5.0)]}

Example: Maximizing security with restrictions

See also:

• Example: Maximizing security with restrictions

• GUI

• JSON Code

import lololaimport lolola.specifications as specsfrom lolola.geometry import Point, Polygon

loc1 = lolola.Location(Point( 2, 8), '1')loc2 = lolola.Location(Point( 6, 9), '2')loc3 = lolola.Location(Point( 4, 3), '3')loc4 = lolola.Location(Point(14, 2), '4')loc5 = lolola.Location(Point( 5, 4), '5')loc6 = lolola.Location(Point( 9, 5), '6')loc7 = lolola.Location(Point( 6, 6), '7')

32 Chapter 5. Tutorials

Page 37: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

loc8 = lolola.Location(Point( 3, 6), '8')locations = [loc1, loc2, loc3, loc4, loc5, loc6, loc7, loc8]

r = Polygon((0.5, 0.5), (14.5, 0.5), (14.5, 9.5), (0.5, 9.5))

problem = lolola.LocationProblem(locations, [specs.Planar,specs.Center,specs.L2Norm(),specs.Unweighted,specs.PlanarRestriction(r)])

problem.solve()problem.plot()print problem.solution_set.solution_mapping{6.7082039324993694: [Point(8.0, 5.0)]}

Example: New York Elections

See also:

Example: New York Elections

import networkx as nximport lololaimport lolola.specifications as specs

StatenIsland = lolola.Location(1, 'StatenIsland')Manhattan = lolola.Location(2, 'Manhattan')Brooklyn = lolola.Location(3, 'Brooklyn')Queens = lolola.Location(4, 'Queens')Bronx = lolola.Location(5, 'Bronx')network_locations = [StatenIsland, Manhattan, Brooklyn, Queens, Bronx]

edgelist = [(1, 3, 25),(3, 2, 29),(3, 4, 28),(2, 4, 25),(2, 5, 16),(4, 5, 20)]

graph = nx.Graph()graph.add_weighted_edges_from(edgelist)

weights = [[444, 1635, 2557, 2229, 1385]]

problem = lolola.LocationProblem(network_locations,[specs.Network(graph),specs.Median,specs.Vertex,specs.Weighted(weights)])

problem.solve()problem.plot()solution_set = problem.solution_set

Example: Catching the criminal

See also:

• Example: Catching the criminal

• JSON Code

5.1. API Tutorial 33

Page 38: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

import lololaimport networkx as nximport lolola.specifications as specsfrom lolola.algorithms.network import core

v1 = lolola.Location( 1, '109')v2 = lolola.Location( 2, '111')v3 = lolola.Location( 3, '112')v4 = lolola.Location( 4, '113')v5 = lolola.Location( 5, '125')v6 = lolola.Location( 6, '131')v7 = lolola.Location( 7, '132')v8 = lolola.Location( 8, '124')v9 = lolola.Location( 9, '130')v10 = lolola.Location(10, '168')v11 = lolola.Location(11, '139')v12 = lolola.Location(12, '140')v13 = lolola.Location(13, '152')v14 = lolola.Location(14, '154')v15 = lolola.Location(15, '151')v16 = lolola.Location(16, '153')v17 = lolola.Location(17, '166')v18 = lolola.Location(18, '155')network_locations = [v1, v2, v3, v4, v5, v6,

v7, v8, v9, v10, v11, v12,v13, v14, v15, v16, v17, v18]

edgelist = [( 1, 2, 3),( 2, 3, 1),( 3, 4, 3),( 1, 8, 2),( 2, 8, 4),( 3, 5, 1),( 5, 4, 2),( 2, 16, 6),( 5, 6, 1),( 6, 7, 5),( 6, 9, 2),( 8, 9, 4),( 7, 12, 2),( 8, 10, 2),( 9, 11, 1),(11, 12, 6),( 9, 13, 2),(11, 16, 3),(11, 14, 4),(16, 12, 6),(14, 12, 4),(15, 13, 2),(13, 16, 2),(16, 14, 4),(15, 17, 2),(17, 16, 1),(16, 18, 6),(14, 18, 3)]

graph = nx.Graph()graph.add_weighted_edges_from(edgelist, weight='length')

weights = [[1, 2, 4, 5, 6, 2, 3, 1, 1, 4, 1, 3, 2, 4, 6, 2, 3, 4]]

problem = lolola.LocationProblem(network_locations,[specs.Network(graph),specs.Center,

34 Chapter 5. Tutorials

Page 39: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

specs.Absolute,specs.Weighted(weights)])

problem.solve()

Example: Food Stall at Street Festival

See also:

• Example: Food stall at street festival

• JSON Code

import lololafrom lolola import specifications as specsfrom lolola.geometry import Point

a1 = lolola.Location(Point(2, 3), "a1")a2 = lolola.Location(Point(4, 6), "a2")a3 = lolola.Location(Point(8, 3), "a3")a4 = lolola.Location(Point(6, 0), "a4")locations = [a1, a2, a3, a4]

weights = [[9, 8, 3, 5],[2, 3, 7, 9]]

problem = lolola.LocationProblem(locations,[specs.Planar,specs.Median,specs.L1Norm(),specs.Weighted(weights),specs.Bicriteria])

problem.solve()problem.plot()

5.1.2 Layout and Art Gallery Problems (Camera Problems)

5.2 GUI Tutorial

5.2. GUI Tutorial 35

Page 40: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Contents

• GUI Tutorial– Planar Location Problems

* Example: Maximizing security with restrictions* Example: Food stall at street festival

– Network Location Problems* Example: New York Elections

– Layout Problems* Example: Urban Event

– Art Gallery Problems (Camera Problems)

In this section a short introduction to the graphical user interface is given. In the starting window the user cancreate a new problem, give it a name, and choose its type. A problem can also be loaded from a json file.

Fig. 5.3: LoLoLA Starting Window

Note: You can simultaneously create and edit several problems and compare their solution, as the starting windowwill always remain opened in the background.

Depending on the type of problem the following window will look different. It will reflect the ClassificationScheme used for location problems. The window will assist in inputing the different positions of the scheme andadding the required information. The following examples will show the workflow for inputing the data for thevarious problem types.

5.2.1 Planar Location Problems

Example: Maximizing security with restrictions

See also:

36 Chapter 5. Tutorials

Page 41: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

• Example: Maximizing security with restrictions

• API Code

• JSON Code

In this example the positioning of a first aider inside a festival environment will be modeled as a planar locationproblem.

After choosing a planar location problem the user first has to input further details of the classification scheme.Therefore, several informations are queried like the number of new facilities, the number of demand points/existingfacilities, the metric, and so on. This frame is shown in the next figure. Note that the restrictions will be specifiedlater on. Until a restriction is given there will be a ∙ on the third position above the main frame.

Fig. 5.4: Starting window of planar location problem: specify the classification scheme

After the classification scheme is specified, the user is guided through the inputs on the left side of the window. Inthe next frame the user is asked to input the names and coordinates of the existing facilities.

Fig. 5.5: Adding facility names

5.2. GUI Tutorial 37

Page 42: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.6: Adding coordinates to the existing facilities

The next tab on the left side is about the weights. As there is only one facility in the example, only the weightsbetween the new and existing facilities are important. If the problem at hand is a multifacility problem, the weightsbetween the new facilities can be specified in an additional tab above the input window. In the multicriteria casethere will be additional tabs for the other objectives.

Fig. 5.7: Weight matrix between the new and existing facilties

As there is a restricted area, we would like to specify a restriction. Possible restrictions are a circle or a convexpolygon. In the example the restriction is a polygon with four extreme points which can be entered after clickingon “Add Polygon”. If there are several restrictions in the problem there is an option to deactivate each restrictionindividually. Also note, that after adding a restriction an R should appear in the third position of the classificationscheme.

Note: Only active restrictions are saved in a file.

38 Chapter 5. Tutorials

Page 43: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.8: Adding restrictions

Now the problem is fully specified and can be solved by pressing the solve button. Another window will pop upand show the solution and the objective value of this solution.

Fig. 5.9: Solution window of LoLoLA

5.2. GUI Tutorial 39

Page 44: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.10: Plotting the solution

It is possible to analyze different points in the decision space and see how the objective value changes.

Fig. 5.11: Objective value gets worse if the first aider is located slighty right from the optimal point

40 Chapter 5. Tutorials

Page 45: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.12: Objective value gets worse if the first aider is located slighty left from the optimal point

Fig. 5.13: Unfortunately this is in the restricted area

5.2. GUI Tutorial 41

Page 46: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Example: Food stall at street festival

See also:

• Example Food stall at street festival

• Programming Code

• JSON Code

In this example a good location for a food stall in a street festival should be computed.

In contrast to the problem before this problem is a bicriteria problem. Therefore, two objectives are chosen in thefirst window. Giving facilties names and coordinates is the same as in the single facility case, however, there willbe two objective weights as shown in the pictures below.

Fig. 5.14: Basic window of planar location problem

Fig. 5.15: First Objective

42 Chapter 5. Tutorials

Page 47: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.16: Second Objective

Solving this problem yields a line segment as solution.

Fig. 5.17: The pareto solution is a line segment

In the plot the line segment forming the solution set is shown in the decision space on the left hand side and onthe right hand side a representative system of the objective values in the objective space is given. In this case thereare only two representative values as the solution set is only a line segment. It is possible to click on the differentpoints in the decision space to calculate the objective vector as shown in the second picture below. In the objectivespace it is only possible to click on the representative points to see the according solution in the decision space.

5.2. GUI Tutorial 43

Page 48: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.18: Decision space on the left hand side and objective space on the right hand side

Fig. 5.19: Clicking on a point in the pareto set returns the objective value on the right hand side

44 Chapter 5. Tutorials

Page 49: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.20: Another pareto solution

Fig. 5.21: This is not a pareto solution, but it is still possible to calculate the objective value

5.2. GUI Tutorial 45

Page 50: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.22: Clicking on a representative point in the objective space gives the corresponding point in the decisionspace

5.2.2 Network Location Problems

Example: New York Elections

See also:

• Example: New York Elections

• Programming Code

• JSON Code

In this example a network location problem is used to model the location of a polling station, therefore, we choosenetwork in the starting window. As in the planar case we first define our classification scheme in the basic tab onthe left side.

46 Chapter 5. Tutorials

Page 51: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.23: Specifying the cassification scheme

Afterwards the left panel will guide through the different inputs as in the planar case. After choosing the facilties,which represent the nodes in the network, it is possible to add the edges and the distances of the network and thenthe weights. Adding edges is simplified by an autocomplete function. After solving the problem the solution canbe plotted.

Note: As the nodes do not have specific coordinates it is possible that the network will look different each timeit is plotted.

Fig. 5.24: Specifying nodes/facilities on the network

5.2. GUI Tutorial 47

Page 52: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.25: Adding the distances between the existing facilities

Fig. 5.26: Adding weights of the facilities

48 Chapter 5. Tutorials

Page 53: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.27: A Solution of the network problem

Fig. 5.28: Plotting the problem

Analyzing different solutions is similar to the planar case. It is possible to click on other nodes or edges in thenetwork to see how the solution value changes:

5.2. GUI Tutorial 49

Page 54: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.29: Objective value around Queens is slightly bigger than the optimal value

Fig. 5.30: Another value on an edge

50 Chapter 5. Tutorials

Page 55: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.31: Objective value for Staten Island

5.2.3 Layout Problems

Example: Urban Event

See also:

• Example: Urban Event

• JSON Tutorial

After clicking on Layout in the starting window, the basic tab for layout problems is loaded when creating aproblem. In this tab it is possible to specify background image for the problem (e.g. a plan of the event area)and the number of different facility types. In our case, there are four different types of new facilities: “Food”,“Ice-cream”, “Smoothies” and “BBQ”, and six types of existing facilities: “Exits”, “Bars”, “People”, “Stage”,“Electricity” and “WC”.

Fig. 5.32: Basic settings of a layout problem

The next tab is about the existing facilities, where the user can enter the names and the coordinates. If there is aplan of the event area, it is possible to add the coordinates graphically by clicking on the plan. To do so, click onthe Add coordinates button underneath the coordinate input.

5.2. GUI Tutorial 51

Page 56: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.33: Enter coordinates of existing facilities

A window of the plan is loaded, where the user can specify on the right side the active facility he/she wants toplace on the map. By clicking on the map, coordinates are added. It is possible to delete the coordinates byclicking on Undo. By closing the window, the coordinates are taken over to the existing facility tab, where theycan be modified manually.

Fig. 5.34: Click on location to add existing facilities

In the new facility tab the user can enter the coordinates of all possible spots to locate the new facilities. Like inthe existing facility case this can also be done graphically by clicking on Add coordinates. Also, names can begiven to the different types of new facilties and the number of new facilities of each type can be specified. In thisexample, 3 food stores should be placed.

52 Chapter 5. Tutorials

Page 57: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.35: Enter coordinates of new facilities

Fig. 5.36: Click on location to add new facilities

In the weight tab the user can enter the weights like given in the example. After entering the weights it is possibleto solve the problem.

Note: For layout problems it is only possible to get an approximate solution.

5.2. GUI Tutorial 53

Page 58: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.37: Enter weights between the new facilities

Fig. 5.38: Enter weights between the new and existing facilities

After solving the problem one can see the coordinate of the new facilties in the solution tab. By clicking on Plot,it is possible to see the solution visually on the map.

54 Chapter 5. Tutorials

Page 59: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Fig. 5.39: Approximate solution for the layout problem

Fig. 5.40: Plotting the solution

5.2.4 Art Gallery Problems (Camera Problems)

5.2. GUI Tutorial 55

Page 60: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

5.3 LoLoLA File Format

Contents

• LoLoLA File Format– Saving and loading a Problem– Planar Location Problem

* Example: Maximize Profit* Example: Maximize Security* Example: Maximize Security with restrictions* Example: Food stall at street festival

– Network Location Problem* Example: New York Elections* Example: Catching the criminal

– Layout Problems* Example: Urban Event

5.3.1 Saving and loading a Problem

Every problem in LoLoLA can be saved to a file. The file format used for LoLoLA Problems is JSON. Each JSONfile starts with an opening bracket { and ends with a closing bracket }, see JSON.org1 for more information.

Each LoLoLA JSON file has a key “type”, which indicates the type of the LoLoLA problem. Valid values are forexample “Planar”, “Network” or “Layout”.

Note: For the GUI it is possible to load a not well-defined problem, i.e. entries or data might be missing.However, it is only possible to save well-defined problems. For the programming interface the problem has to bewell-defined in both cases, otherwise LoLoLA will raise an Error.

5.3.2 Planar Location Problem

There are different keys and values possible to specify a planar location problem as shown in the table below.

Key Type Description Example"type" String Type of the problem "Planar""new_facilities" List of Strings Names of the new facilities ["Hospital", "Train Station"]"existing_facilities" List of Strings Names of the existing facilities ["Bus Station", "House", "Supermarket"]"coordinates" List of Integer Pairs Coordinates of the existing facilities [[2, 8], [6, 9] [4, 3]]"weights_new_existing" List of Matrices Weights between new and existing facilities [[[1, 2, 1], [5, 6, 1]],

[[2, 5, 1], [2, 5, 2]]]"weights_new_new" List of Matrices Weights between new facilities [[[0, 1], [0, 0]], [[0, 1], [0, 0]]]"distance" String Considered norm "l_p""p" Integer p-Value, only required if norm is "l_p" 1"restrictions" List of LoLoLA Restrictions Restricted areas [["polygon", [[ 0.5, 0.5],

[14.5, 0.5],[14.5, 9.5],[ 0.5, 9.5]]]

"objective" String Objective function "Median"

It is possible to save and load files in LoLoLA.

1http://json.org

56 Chapter 5. Tutorials

Page 61: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Example: Maximize Profit

See also:

• Example: Maximizing profit

• Programming Code

{"type": "Planar","new_facilities": ["X"],"existing_facilities": ["1", "2", "3", "4", "5", "6", "7", "8"],"coordinates": [[2, 8], [6, 9], [4, 3], [14, 2], [5, 4], [9, 5], [6, 6], [3, 6]],"weights_new_existing": [[[1, 1, 1, 1, 1, 1, 1, 1]]],"distance": "l_2","objective": "Median"

}

Example: Maximize Security

See also:

• Example: Maximizing security

• Programming Code

{"type": "Planar","new_facilities": ["X"],"existing_facilities": ["1", "2", "3", "4", "5", "6", "7", "8"],"coordinates": [[2, 8], [6, 9], [4, 3], [14, 2], [5, 4], [9, 5], [6, 6], [3, 6]],"weights_new_existing": [[[1, 1, 1, 1, 1, 1, 1, 1]]],"distance": "l_2","objective": "Center"

}

Example: Maximize Security with restrictions

See also:

• Example: Maximizing security with restrictions

• Programming Code

• GUI-Manual

{"type": "Planar","new_facilities": ["X"],"existing_facilities": ["1", "2", "3", "4", "5", "6", "7", "8"],"coordinates": [[2, 8], [6, 9], [4, 3], [14, 2], [5, 4], [9, 5], [6, 6], [3, 6]],"weights_new_existing": [[[1, 1, 1, 1, 1, 1, 1, 1]]],"distance": "l_2","objective": "Center","restrictions": [["polygon", [[0.5, 0.5], [14.5, 0.5], [14.5, 9.5], [0.5, 9.5]]]]

}

Example: Food stall at street festival

See also:

• Example Food stall at street festival

5.3. LoLoLA File Format 57

Page 62: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

• Programming Code

• GUI Manual

{"type": "Planar","new_facilities": ["X"],"existing_facilities": ["a1", "a2", "a3", "a4"],"coordinates": [[2, 3], [4, 6], [8, 3], [6, 0]],"weights_new_existing": [[[9, 8, 3, 5]], [[2, 3, 7, 9]]],"distance": "l_1","objective": "Median"

}

5.3.3 Network Location Problem

Like in the planar location problem there are different keys to define a network location problem, like the followingtable will show:

Key Type Description Example"type" String Type of the problem "Network""new_facilities" List of Strings Names of the new facilities ["School1", "School2"]"nodes" List of Strings Names of the nodes representing existing facilities ["District1", "District2", "District3"]"edges" List of Tuples Edges between nodes with given length [["District1", "District2", 10],

["District2", "District3", 5]]"weights" List of Integer Lists Weights of the existing facilities [[3, 1, 4]]"problem" String Description of feasible locations (vertex/absolute) "Absolute""objective" String Objective function "Median""lexicographic" Boolean True if only lexicographic solutions should be computed False

Example: New York Elections

See also:

• Example New York Elections

• Programming Code

• GUI Manual

{"type": "Network","new_facilities": ["X"],"nodes": ["StatenIsland", "Manhattan", "Brooklyn", "Queens", "Bronx"],"edges": [["StatenIsland", "Brooklyn", 25], ["Manhattan", "Brooklyn", 29],

["Manhattan", "Queens", 25], ["Manhattan", "Bronx", 16],["Brooklyn", "Queens", 28], ["Queens", "Bronx", 20]],

"weights": [[444, 1635, 2557, 2229, 1385]],"problem": "Vertex","objective": "Median"

}

Example: Catching the criminal

See also:

• Example: Catching the criminal

• Programming Code

58 Chapter 5. Tutorials

Page 63: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

{"type": "Network","new_facilities": ["X"],"nodes": ["109", "111", "112", "113", "125", "131", "132", "124", "130",

"138", "139", "140", "152", "154", "151", "153", "166", "155"],"edges": [["109", "124", 2], ["109", "111", 3], ["111", "124", 4], ["111", "112", 1],

["111", "153", 6], ["112", "113", 3], ["112", "125", 1], ["113", "125", 2],["125", "131", 1], ["131", "130", 2], ["131", "132", 5], ["132", "140", 2],["124", "138", 2], ["124", "130", 4], ["130", "139", 1], ["130", "152", 2],["139", "153", 3], ["139", "140", 6], ["139", "154", 4], ["140", "153", 6],["140", "154", 4], ["152", "153", 2], ["152", "151", 2], ["154", "153", 4],["154", "155", 3], ["151", "166", 2], ["153", "166", 1], ["153", "155", 6]],

"weights": [[1, 2, 4, 5, 6, 2, 3, 1, 1, 4, 1, 3, 2, 4, 6, 2, 3, 4]],"problem": "Absolute","objective": "Center"

}

5.3.4 Layout Problems

In the following table the keys for a Layout problem are listed.

Key Type Description Example"type" String Type of the problem "Layout""facilities" List of Tuples Names and number of the new facilities [["Food", 3], ["Bar", 4]]"fixed" List of Tuples Names of coorinates of the fixed facilities [["Exit", [[367.0, 302.0], [645.0, 460.0]]],

["WC", [[160.0, 540.0]]]]"locations" List of Integer Pairs Possible locations for the new facilities [[412.0, 399.0],

[445.0, 426.0],[476.0, 491.0]]

"weights" Integer Matrix Weights between the enw facilities [[3, 0], [1, -2]]"fixed_weights" Integer Matrix Weights between the new and the fixed facilities [[3, 0, -2], [1, -2, 3]]"image" Key-Value-Map Path and embedding of background image {"lower left": [ 0, 0],

"upper right": [10, 5],"name": "pfad/map_name.png"}

Example: Urban Event

See also:

• Example: Urban Event

• GUI Tutorial

{"type": "Layout","facilities": [["Food", 3], ["Ice-cream", 1], ["Smoothies", 1], ["BBQ", 1]],"fixed": [["Exit", [[367.0, 302.0], [645.0, 460.0], [92.0, 602.0], [265.0, 766.0]]],

["Bar", [[510.0, 500.0], [620.0, 760.0], [80.0, 740.0]]],["People", [[164.0, 714.0], [405.0, 610.0], [760.0, 610.0]]],["Stage", [[930.0, 570.0]]],["Electricity", [[500.0, 400.0], [40.0, 721.0], [307.0, 590.0]]],["WC", [[160.0, 540.0]]]],

"locations": [[412.0, 399.0], [445.0, 426.0], [476.0, 491.0], [485.0, 536.0], [445.0, 482.0],[557.0, 524.0], [745.0, 760.0], [702.0, 763.0], [545.0, 780.0], [360.0, 768.0],[323.0, 768.0], [192.0, 710.0], [326.0, 680.0], [335.0, 645.0], [335.0, 610.0],[330.0, 578.0], [331.0, 517.0], [336.0, 550.0], [267.0, 458.0]],

"weights": [[-500.0, -50.0, -50.0, -20.0], [-50.0, 0.0, 50.0, -50.0],[ -50.0, 50.0, 0.0, -50.0], [-20.0, -50.0, -50.0, 0.0]],

"fixed weights": [[-70.0, -100.0, -100.0, -70.0], [70.0, -100.0, -100.0, 60.0], [ 30.0, 70.0, 70.0, 50.0],[-10.0, -20.0, -20.0, -30.0], [20.0, 50.0, 50.0, 100.0], [-50.0, -50.0, -50.0, -50.0]],

5.3. LoLoLA File Format 59

Page 64: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

"solution": {"Food": [[412.0, 399.0], [745.0, 760.0], [192.0, 710.0]],"Ice-cream": [[330.0, 578.0]],"Smoothies": [[336.0, 550.0]],"BBQ": [[476.0, 491.0]]},

"image": {"lower left": [-0.5, 937.5], "upper right": [1337.5, -0.5], "name": "plan_bw.png"}}

60 Chapter 5. Tutorials

Page 65: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

CHAPTER

SIX

LIST OF LOLOLA ALGORITHMS

This is a list of currently implemented algorithms in LoLoLA. This list will be continuously updated. If you haveany suggestion which algorithm should be implemented next or even have an algorithm to contribute, please writeus an email.

6.1 Planar Location Problem

Median ProblemsSingle Facility Restrictions Multifacility Multicriteria1/𝑃/ ∙ /𝑙1/Σ 1/𝑃/𝑅 = 𝑐𝑜𝑛𝑣𝑒𝑥/𝑙1/Σ 𝑁/𝑃/ ∙ /𝑙1/Σ 1/𝑃/ ∙ /𝑙1/2 − Σ𝑝𝑎𝑟

1/𝑃/ ∙ /𝑙2/Σ1/𝑃/ ∙ /𝑙22/Σ

1/𝑃/𝑅/𝑙22/Σ

1/𝑃/𝑅𝐶/𝑙22/Σ

1/𝑃/𝑅 =𝑐𝑜𝑛𝑣𝑃𝑜𝑙𝑦/𝑙22/Σ

1/𝑃/𝑅 = 𝑝𝑜𝑙𝑦/𝑙22/Σ

𝑁/𝑃/ ∙ /𝑙22/Σ 1/𝑃/ ∙ /𝑙22/𝑄− Σ𝑝𝑎𝑟

1/𝑃/ ∙ /𝑙𝑝/Σ1/𝑃/ ∙ /𝑙∞/Σ 1/𝑃/𝑅 = 𝑐𝑜𝑛𝑣/𝑙∞/Σ

𝑁/𝑃/ ∙ /𝑙∞/Σ

𝑁/𝑃/ ∙ /𝛾𝑚/Σ

1/𝑃/ ∙ /𝑙∞/2 − Σ𝑝𝑎𝑟

Center ProblemsSingle Facility Restrictions Multifacility1/𝑃/ ∙ /𝑙1/𝑚𝑎𝑥

1/𝑃/𝑤𝑖 = 1/𝑙1/𝑚𝑎𝑥

1/𝑃/𝑅 = 𝑐𝑜𝑛𝑣/𝑙1/𝑚𝑎𝑥

𝑁/𝑃/ ∙ /𝑙1/𝑚𝑎𝑥

1/𝑃/ ∙ /𝑙2/𝑚𝑎𝑥 1/𝑃/𝑅 = 𝑐𝑜𝑛𝑣𝑃𝑜𝑙𝑦/𝑙2/𝑚𝑎𝑥1/𝑃/ ∙ /𝑙∞/𝑚𝑎𝑥

1/𝑃/𝑤𝑖 = 1/𝑙∞/𝑚𝑎𝑥

1/𝑃/𝑅 = 𝑐𝑜𝑛𝑣/𝑙∞/𝑚𝑎𝑥

𝑁/𝑃/ ∙ /𝑙∞/𝑚𝑎𝑥

6.2 Network Location Problem

Median Problems

61

Page 66: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Single Facility Multifacility Multicriteria

1/𝐺/ ∙ /𝑑(𝑉, 𝑉 )/Σ

1/𝑇/ ∙ /𝑑(𝑉, 𝑉 )/Σ

𝑁/𝐺/ ∙ /𝑑(𝑉, 𝑉 )/Σ

1/𝐺/ ∙ /𝑑(𝑉, 𝑉 )/𝑄− Σ𝑝𝑎𝑟

1/𝐺/ ∙ /𝑑(𝑉, 𝑉 )/𝑄− Σ𝑙𝑒𝑥

1/𝐺𝐷/ ∙ /𝑑(𝑉, 𝑉 )/Σ

1/𝐺𝐷/ ∙ /𝑑(𝑉, 𝑉 )/𝑄− Σ𝑝𝑎𝑟

1/𝐺𝐷/ ∙ /𝑑(𝑉, 𝑉 )/𝑄− Σ𝑙𝑒𝑥

1/𝐺/ ∙ /𝑑(𝑉,𝐺)/Σ

1/𝑇/ ∙ /𝑑(𝑉, 𝑇 )/Σ

1/𝐺/ ∙ /𝑑(𝑉,𝐺)/2 − Σ𝑝𝑎𝑟

1/𝐺𝐷/ ∙ /𝑑(𝑉,𝐺)/Σ

1/𝐺𝐷/ ∙ /𝑑(𝑉,𝐺)/𝑄− Σ𝑝𝑎𝑟

1/𝐺𝐷/ ∙ /𝑑(𝑉,𝐺)/𝑄− Σ𝑙𝑒𝑥

Center ProblemsSingle Facility Multifacility Multicriteria

1/𝐺/ ∙ /𝑑(𝑉, 𝑉 )/𝑚𝑎𝑥

1/𝑇/ ∙ /𝑑(𝑉, 𝑉 )/𝑚𝑎𝑥

𝑁/𝐺/ ∙ /𝑑(𝑉, 𝑉 )/𝑚𝑎𝑥

1/𝐺/ ∙ /𝑑(𝑉, 𝑉 )/𝑄−𝑚𝑎𝑥𝑝𝑎𝑟

1/𝐺/ ∙ /𝑑(𝑉, 𝑉 )/𝑄−𝑚𝑎𝑥𝑙𝑒𝑥

1/𝐺𝐷/ ∙ /𝑑(𝑉, 𝑉 )/𝑚𝑎𝑥

1/𝐺/ ∙ /𝑑(𝑉, 𝑉 )/𝑄−𝑚𝑎𝑥𝑝𝑎𝑟

1/𝐺/ ∙ /𝑑(𝑉, 𝑉 )/𝑄−𝑚𝑎𝑥𝑙𝑒𝑥

1/𝐺/ ∙ /𝑑(𝑉,𝐺)/𝑚𝑎𝑥

1/𝑇/ ∙ /𝑑(𝑉, 𝑇 )/𝑚𝑎𝑥

1/𝐺𝐷/ ∙ /𝑑(𝑉,𝐺)/𝑚𝑎𝑥

6.3 Discrete Location Problem

𝑁/𝐷/𝐾 − 𝑏𝑒𝑠𝑡/ ∙ /Σ

6.4 Layout Problem

QAP-Heuristic

62 Chapter 6. List of LoLoLA Algorithms

Page 67: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

CHAPTER

SEVEN

LICENSES AND SOFTWARE-PACKAGES

7.1 LoLoLA-License

LoLoLA is a free software published under the terms of the GNU General Public License.

LoLoLA version 1.754University of KaiserslauternDepartment of Mathematics and Optimization Research GroupAuthors: Horst W. Hamacher, Andrea Maier, Aleksandra Gross, Philipp Heßler

Copyright (C) 2015 Horst W. Hamacher, Andrea Maier, Aleksandra Gross,Philipp Heßler

LoLoLA is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.

LoLoLA is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.

You should have received a copy of the GNU General Public Licensealong with LoLoLA. If not, see <http://www.gnu.org/licenses/>.

7.2 Third-party software

LoLoLA uses following third-party software under the licenses:

7.2.1 GLPK

For solving linear programs the free GLPK1 solver (Version 4.34) is used. It is distributed under the GNU GeneralPublic License.

1https://www.gnu.org/software/glpk/

63

Page 68: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,2009, 2010, 2011, 2013 Andrew Makhorin, Department for AppliedInformatics, Moscow Aviation Institute, Moscow, Russia. All rightsreserved. E-mail: <[email protected]>.

GLPK is free software: you can redistribute it and/or modify itunder the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.

GLPK is distributed in the hope that it will be useful, but WITHOUTANY WARRANTY; without even the implied warranty of MERCHANTABILITYor FITNESS FOR A PARTICULAR PURPOSE. See the GNU General PublicLicense for more details.

You should have received a copy of the GNU General Public Licensealong with GLPK. If not, see <http://www.gnu.org/licenses/>.

7.2.2 PyGTK and GTK+

The graphical user interface is build using PyGTK3 (Version 2.24.0) and GTK+4. Both are licensed under theGNU Lesser General Public License.

Copyright (C) 1998-2003 James Henstridge2004-2006 Johan Dahlin

This library is free software; you can redistribute it and/ormodify it under the terms of the GNU Lesser General PublicLicense as published by the Free Software Foundation; eitherversion 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNULesser General Public License for more details.

You should have received a copy of the GNU Lesser General PublicLicense along with this library; if not, write to the Free SoftwareFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301USA

3http://pygtk.org/4http://www.gtk.org/

64 Chapter 7. Licenses and Software-packages

Page 69: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

7.2.3 NetworkX

For solving location problems in graphs, LoLoLA makes use of the NetworkX5 (Version 1.9.1) library 6. It isdistributed with the BSD License.

Copyright (C) 2004-2012, NetworkX DevelopersAric Hagberg <[email protected]>Dan Schult <[email protected]>Pieter Swart <[email protected]>All rights reserved.

Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions are met:

• Redistributions of source code must retain the above copyrightnotice, this list of conditions and the following disclaimer.

• Redistributions in binary form must reproduce the abovecopyright notice, this list of conditions and the followingdisclaimer in the documentation and/or other materials providedwith the distribution.

• Neither the name of the NetworkX Developers nor the names of itscontributors may be used to endorse or promote products derivedfrom this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ANDCONTRIBUTORS“AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOTLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESSFORA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THECOPYRIGHTOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOTLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ONANYTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THEUSEOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

7.2.4 Numpy

In order to do mathematical calculations, Numpy10 (Version 1.10.1) is used with the following BSD license.

5https://networkx.github.io/6 Aric A. Hagberg, Daniel A. Schult and Pieter J. Swart, “Exploring network structure, dynamics, and function using NetworkX” , in

Proceedings of the 7th Python in Science Conference (SciPy2008), Gäel Varoquaux, Travis Vaught, and Jarrod Millman (Eds), (Pasadena, CAUSA), pp. 11–15, Aug 2008

10http://www.numpy.org

7.2. Third-party software 65

Page 70: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Copyright (C) 2005-2015, NumPy Developers.All rights reserved.

Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions aremet:

• Redistributions of source code must retain the above copyrightnotice, this list of conditions and the following disclaimer.

• Redistributions in binary form must reproduce the abovecopyright notice, this list of conditions and the followingdisclaimer in the documentation and/or other materials providedwith the distribution.

• Neither the name of the NumPy Developers nor the names of anycontributors may be used to endorse or promote products derivedfrom this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ANDCONTRIBUTORS“AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOTLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESSFORA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THECOPYRIGHTOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOTLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ONANYTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THEUSEOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

7.2.5 Matplotlib

In order to plot LoLoLA problems, Matplotlib (Version 1.5.0) is used, which uses a license based on the PythonSoftware Foundation PSF11.

11https://docs.python.org/2/license.html

66 Chapter 7. Licenses and Software-packages

Page 71: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Copyright (c) 2012-2013 Matplotlib Development Team.All Rights Reserved

• This LICENSE AGREEMENT is between the Matplotlib Development Team (“MDT”),and the Individual or Organization (“Licensee”) accessing and otherwiseusing matplotlib software in source or binary form and its associateddocumentation.

• Subject to the terms and conditions of this License Agreement, MDT herebygrants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,analyze, test, perform and/or display publicly, prepare derivative works,distribute, and otherwise use matplotlib 1.5.0 alone or in any derivativeversion, provided, however, that MDT’s License Agreement and MDT’s notice ofcopyright, i.e., “Copyright (c) 2012-2013 Matplotlib Development Team; AllRights Reserved” are retained in matplotlib 1.5.0 alone or in any derivativeversion prepared by Licensee.

• In the event Licensee prepares a derivative work that is based on orincorporates matplotlib 1.5.0 or any part thereof, and wants to make thederivative work available to others as provided herein, then Licensee herebyagrees to include in any such work a brief summary of the changes made tomatplotlib 1.5.0.

• MDT is making matplotlib 1.5.0 available to Licensee on an “AS IS” basis. MDTMAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BYWAY OF EXAMPLE,BUT NOT LIMITATION, MDT MAKES NO AND DISCLAIMS ANYREPRESENTATION OR WARRANTYOF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE ORTHAT THE USE OFMATPLOTLIB 1.5.0 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.

• MDT SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OFMATPLOTLIB 1.5.0 FORANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS ARESULT OFMODIFYING, DISTRIBUTING, OR OTHERWISE USING MATPLOTLIB 1.5.0, ORANYDERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.

• This License Agreement will automatically terminate upon a material breach ofits terms and conditions.

• Nothing in this License Agreement shall be deemed to create any relationshipof agency, partnership, or joint venture between MDT and Licensee. ThisLicense Agreement does not grant permission to use MDT trademarks or tradename in a trademark sense to endorse or promote products or services ofLicensee, or any third party.

• By copying, installing or otherwise using matplotlib 1.5.0, Licensee agrees tobe bound by the terms and conditions of this License Agreement.

7.2.6 PuLP

To facilitate the creation of linear programs PuLP12 (Version 1.5.9) is used. This tool is distributed under the MITLicense.

12https://projects.coin-or.org/PuLP

7.2. Third-party software 67

Page 72: LoLoLA Documentation - · PDF fileLoLoLA Documentation Release 1.750 ... This is done via the python package PuLP ... to enable the GLPK solver in PuLP the GlpkPath must be set in

LoLoLA Documentation, Release 1.750

Copyright (c) 2002-2005, Jean-Sebastien Roy ([email protected])Modifications Copyright (c) 2007- Stuart Anthony Mitchell ([email protected])

Permission is hereby granted, free of charge, to any person obtaining acopy of this software and associated documentation files (the“Software”), to deal in the Software without restriction, includingwithout limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and topermit persons to whom the Software is furnished to do so, subject tothe following conditions:

The above copyright notice and this permission notice shall be includedin all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,EXPRESSOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE ANDNONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FORANYCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OFCONTRACT,TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THESOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

This documentation was generated with Sphinx15, Apidoc16 and Numpydoc17.

15http://sphinx-doc.org/16https://pypi.python.org/pypi/ApiDoc/1.217https://pypi.python.org/pypi/numpydoc

68 Chapter 7. Licenses and Software-packages