# Mathematical Model

We can define the problem as:

* I = set of demand nodes i.
* J = set of the candidate locations of the facilities j.
* dij = distance between the demand node i and its candidate facility located at site j.
* hi = demand of node i.
* p = number of facilities to locate.

Defining the following decision variables:

* χj = 1, if it is located in site j; 0, otherwise.
* yj = 1, if the demand of node i is assigned to the facility located in site j; 0, in another case.

The formulation is the following:

![](https://2572686366-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lj1MxDvUKWY654R_s1p%2F-Lj1Mz6ltII4pSRL6I6y%2F-Lj1NXnBwvlRc2Vlu63O%2FScreen%20Shot%202018-05-01%20at%2010.56.54%20PM.png?generation=1562334343424296\&alt=media)

The objective function (2.1) minimizes the total demand-distance between the demand nodes and the selected facilities. The restriction (2.2) means that there are facilities to be installed. The restriction (2.3) requires that each demand node be assigned to only one facility. The restriction (2.4) only allows the demand of a node to be assigned to an open facility, this is a selected facility. The set of constraints (2.5) and (2.6) establishes the entire nature of the model.
