Demand allocation to facilities

I'm facing the following problem as I am trying to model a problem where people visit facilities according to their age and per a time horizon. Additionally, I am trying to allocate specific commodity types to these demands, as in certain people cannot receive certain type of product at these facilities. Till now, I have only managed to write the following variables, parameters and constraints.

J: Set of location of facilities

I : Set of locations of the demand

A: Set of age groups of the demand i.e., 80 and over, 70-79, and so on till 19 and below.

C: Set of commodity types i.e A, B, C

$$S_a$$: Social cost per age group A

$$MV_a$$: Maximum workload that can be done by the staff per time period t

$$f_j$$: Fixed opening cost of a facility at a location j

$$HC_j$$: People handling capacity of a facility at location j

$$SC_j$$: Storage capacity of a facility at location j

$$IV_j$$: Inventory holding cost of a facility at a location j

$$O_{j}$$: Operating cost of a facility at a location j

$$VP_t$$: Pay of staff at facility per time period t

$$D_{ia}$$; Demand from location i of age group a

$$D_{ij}$$: Distance between location i and location j(facility)

$$S_{jct}$$: Supply of commodity c at location j at time period t

$$z_{ijat}$$: demand at location i of a particular age group a to location j at time period t

$$y_j$$: 1, If location j is opened or not; 0 otherwise

$$i_{jct}$$: Inventory at location j of commodity c at time period t

$$vs_{jt}$$: Staff at location j at time period t

I have the following constraints:

$$\sum_{j \in J}\sum_{t \in T} \sum_{i \in I} \sum_{a \in A} z_{ijta} D_{ij} O_j + \sum_{j \in J} \sum_{t \in T} vs_{jt} VP_t + \sum_{j in J} \sum_{c \in C} \sum_{t \in T} I_{jct} IV_{j}$$

Constraints:

$$\sum_{t \in T}\sum_{j \in J} z_{ijta} = D_{ia} S_{a} \forall i \in I, a \in A$$

$$\sum_{i \in I} \sum_{t \in T} \sum_{a \in A} z_{ijta} \leq MV_t* \sum_{t \in T} vs_{jt} \forall j \in J$$

$$MV_{t} * vs_{jt} \leq HC_j * y_j \forall j \in J, t \in T$$

$$\sum_{i \in I} \sum_{a \in A} z_{ijta} \leq \sum_{c \in C} I_{jct} * y_j \forall j \in J$$

$$\sum_{c \in C} I_{jct} = \sum_{c \in C} S_{jct} - \sum_{i \in I} \sum_{a \in A} z_{ijta}, t = 1, \forall t \in T, j \in J$$

$$\sum_{c \in C} I_{jct} = \sum_{c \in C} I_{jct-1} \sum_{c \in C} + S_{jct} - \sum_{i \in I} \sum_{a \in A} z_{ijta}, t > 1, \forall t \in T, j \in J$$

$$\sum_{t \in T} \sum_{c \in C} I_{jct} \leq SC_j \forall j \in J$$

Constraint(1) ensures that the demand from location i reaches location j as per a social cost, for instance the social cost might be 80+ - 1, 70- 79 - 0.1, etc. Constraint(2) ensures that the staff at the facilities is more than the demand received. Constraint(3) ensures that the staff at location j, is less than the handling capacity of the location. Constraint(4) ensures that the demand allocated at location is less than the inventory. Constraint(5) and constraint(6) ensure that inventory flow is maintained at each time period and it keeps getting updated for utilised demand, we minimise the inventory in the objective in order to have as small inventory as possible. Finally, constraint(7) ensures that the inventory is less than the storage at that location.

Additionally, we have the following: $$y_j \in \{0,1\}, z_{ijta}, i_{jct}, vs_{jt} \in R$$

• I'm afraid the first constraint makes no sense. I don't know what "as per a social cost" means, but costs would typically appear in the objective function (or as part of a budget constraint). Note that with fractional costs like 0.1 the right side of the constraint likely has a fractional component while the left side (sum of binary variables) is integer, meaning the model is likely to be infeasible as written. Aug 1 '21 at 19:13
• Apologies @prubin, z_ijta is a variable and not binary
– user4387
Aug 1 '21 at 19:43
• @prubin, with social cost, or any other way, I am trying to create a situation that if there are certain locations which have population over 80 and there are certain locations with less population over 80, we would want that people who are aged 80 and over to visit the facility first, however if there isn't any 80 and over population, it should look at the next age group. Is there any right way to do this?
– user4387
Aug 1 '21 at 19:46
• You can require that at least a certain percentage of the high priority demand be satisfied, or you can require that all demand in a high priority (80+) category be satisfied before any demand for a lower priority category is satisfied (might require binary variables), or you can just add penalty terms to the objective for unsatisfied demand in each category. Aug 2 '21 at 20:13
• Um, I am still struggling with this, can you show me how?
– user4387
Aug 3 '21 at 16:56

Before I dive into the proposed solutions, let's first define the set $$T = \mathbb{N}^{*}_{\leqslant m}$$, where $$m \in \mathbb{N}^{*}$$ is the available periods' number, since you did not define the set $$T$$.

Now, let's analyze your problems. From what I understood, we have two remaining requirements:

1. If a given age group $$a \in A$$ is serviced in a given facility $$j \in F$$ at the period $$t \in T$$, then all the age groups serviced in $$j$$ at the periods $$t^{'} \in T: t^{'} > t$$ must have a priority lower than $$a$$;
2. Certain types of commodities cannot be utilized by certain age groups.

First requirement

According to what you stated, what we need to ensure is that, if a given age group $$a \in A$$ is serviced in a given facility $$j \in F$$ at the period $$t \in T$$, then all the age groups serviced in $$j$$ at the periods $$t^{'} \in T: t^{'} > t$$ must have a priority lower than $$a$$.

To substantiate this requirement, let's define a function $$P: A \mapsto \mathbb{R}$$ as being the available group ages' priority function. In order for this function to suit your problem, we can say that $$P(a) > P(a^{'})$$ whenever the minimum allowed age of age group $$a \in A$$ is greater than or equals to the maximum allowed age of age group $$a^{'} \in A$$, note that I am not considering the possibility of overlapping ages between distinct periods since you did not explicit it. Therefore, we can represent the desired requirement by the following set of constraints:

$$1 - z_{ijta} \geqslant z_{ijt^{'}a^{'}} \quad \quad \forall i \in I, \\ \quad\quad\quad\quad\quad\quad\quad\quad\forall j \in J, \\ \quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\forall t \in T \backslash \{1\}, \forall t^{'} \in T : t^{'} < t, \\ \quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\forall a, a^{'} \in A : P(a^{'}) < P(a)$$

Second requirement

According to what you stated, what we need to ensure is that certain types of commodities cannot be utilized by certain age groups.

To substantiate this requirement, let's define a function $$B: a \mapsto \{c \in C : \text{ the commodity c can not be utilized be the age group a}\}$$ as being the commodities constricting function, and the parameter $$M_c \in \mathbb{R}$$ as being the commodity $$c \in C$$' available amount. Now, we just have to use it in a set of constraints:

$$i_{jct} \leqslant M_{c} (1 - z_{ijct}) \quad \quad \forall i \in I, \\ \quad\quad\quad\quad\quad\quad\quad\quad\quad\forall j \in J, \\ \quad\quad\quad\quad\quad\quad\quad\quad\quad\forall t \in T, \\ \quad\quad\quad\quad\quad\quad\quad\quad\quad\forall a \in A \\ \quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\forall c \in B(a)$$

If you find any errors, let me know.

• Are you taking $z_{ijta}$ to be a binary variable ?
– user4387
Aug 4 '21 at 11:49
• Additionally, can you tell me how to construct, this function $P(a)$ and $P(a^{'})$ in Pyomo
– user4387
Aug 4 '21 at 11:50