1 Introduction

The year 2020 will undoubtedly be remembered as the year of the COVID-19 pandemic. This global scale epidemic has not only altered the normal lives of citizens around the world, but has reoriented many lines of research and scientific development to the study of the epidemic from its multiple aspects (biological, medical, pharmacological, sociological, etc.). The lines of work in computer science, information systems and tools provided by AI and other related disciplines have not been abstracted from this struggle. Thus, we have seen a multitude of applications aimed at predicting the evolution of the pandemic (mainly under the paradigm of the SIR model [14] and its variants [18]), while other tools have been oriented towards the control of the mobility of individuals with the aim of tracking possible infections. Nor should we forget the tools aimed at supporting research into the development of new vaccines that have come to light in the last year. In this sense, bioinformatics, genomic information processing and other related areas have become particularly relevant.

In this environment, a multidisciplinary work team formed by epidemiologists, computer scientists, microbiologists, physicians, etc. joined our efforts in the development of a tool that could evaluate different scenarios of the pandemic and project its evolution over time. In this way, decision-makers (e.g. imposing restrictions on mobility, use of masks, confinement, etc.) could have a tool with which they could adjust various parameters (some purely biological, others of a social nature, etc.) and see the effects they could have in the short and medium term. This tool is not so much based on the use of data to make a more or less adjusted prediction (statistical predictive approach). The proposed tool is based on the scientific evidences that were being produced about the virus and its effects (transmission rates with or without masks, time of symptom development, average length of stay in ICUs, etc.). Obviously, our proposal has not been the only one and we can affirm that many different models have been proposed to evaluate and predict the evolution of the pandemic. To cite a couple of them, we could refer to the proposal by Wong et al. [24] where they propose a Bayesian approach for modeling the pandemic in Illinois, USA, and the work of Bertozzi et al. [2] that is also especially interesting, given that they discuss three different macroscopic models (including a SIR approach) that can be labelled as parsimonious models.

We have designed and we have developed the LOIMOS tool (from ancient Greek, “pestilence, plague”) which is an epidemiological scenario simulator designed and developed entirely under the paradigm of membrane computing. Our choice in designing LOIMOS was based on the team’s previous experience developing ARES, which is a successful simulator for the evolution of antibiotic resistance dynamics [1, 4,5,6]. ARES was developed entirely under the paradigm of membrane computing and it is currently a functional tool that assists in decision making and clinical research developed in hospital environments. The main advantages of ARES, which is also inherited by LOIMOS, are that it offers the possibility of modeling predictive multilevel scenarios that can be interrogated, edited and re-simulated if necessary, with different parameters. Therefore, LOIMOS is not only useful for the COVID-19 pandemic but it is ready to be easily adapted to any other pandemic caused by different viruses. In addition, LOIMOS does not depend on the availability of public data that occur during the pandemic and that, on some occasions, have caused controversies.

In this work we describe LOIMOS. We establish its internal architecture and the types of rules it uses within the wide range of possibilities offered by P systems, and we show some examples of its use. LOIMOS has been validated from an epidemiological point of view and it is currently used to model different scenarios that help decision-making in hospital and social settings [7].

2 P systems

We assume that the reader is familiar with the basic concepts of membrane computing [19,20,21]. In this work, we use cell-like P systems with active membranes without polarization that are defined as follows.

Definition 1

A P system with active membranes of degree \(m \ge 1\) is defined by the tuple \(\Pi = (V, H, \mu , w_1, w_2, \ldots , w_m, R, i_0)\), where

  1. 1.

    V is the alphabet of objects

  2. 2.

    H is the alphabet of labels for membranes

  3. 3.

    \(\mu\) is the initial membrane structure, of degree m, with all membranes labeled with elements of H. Polarizations are not considered in the system. A membrane with label h is represented as [ \(]_h\)

  4. 4.

    \(w_1, w_2, \ldots , w_m\) are strings over V specifying the multiset of objects initially in the regions defined by \(\mu\)

  5. 5.

    R is a finite set of rules of the following types:

    1. (a)

      \([ v \rightarrow w ]_h\) with \(v,w \in V^*\) (evolution rules)

    2. (b)

      v[ \(]_h \rightarrow [w ]_h\) with \(v,w \in V^*\) (‘in’ communication rules)

    3. (c)

      \([v]_h \rightarrow w[\) \(]_h\) with \(v,w \in V^*\) (‘out’ communication rules)

    4. (d)

      \([v]_h \rightarrow [\) \([w]_j ]_h\) with \(v,w \in V^*\) (membrane creation with object evolution)

    5. (e)

      [ [ u \(]_{h_1}\) \(]_{h_2}\) [ \(]_{h_3}\) \(\rightarrow [\) \(]_{h_2}[\) [ \(w ]_{h_1}\) \(]_{h_3}\) (membrane movement)

  6. 6.

    \(i_0 \in \{ 0, \ldots , m \}\) indicates the region where the result of a computation is obtained (0 represents the environment).

The rules of the P system are applied in a maximally parallel manner according to a probability distribution and a priority assignment. The computation of the system finishes whenever no rule can be applied. A configuration of the system at time t during a computation is defined by the membrane structure \(\mu _t\) and the multisets of objects at every region in \(\mu _t\). Every rule \(\alpha \overset{p,q}{\longrightarrow } \beta\) has two parameters p and q. The parameter \(p \in [0, .. , 1 ]\) is a probability value that models the stochastic aspects necessary for a reliable simulation of real systems. In our case, despite having only one environment modeled as a cell-like P-system, our approach to stochastic simulation is similar to that developed for multi-environment P systems as in [22]. However, the mechanism for the application of the rules and the distribution of probabilities is inspired by the DCBA algorithm [17]. Ultimately, the mechanisms for applying rules to obtain a stochastic simulation environment have been those already developed in [5]. The parameter \(q \in \mathbb {N}\) is a priority value.

3 A P system for the LOIMOS simulator

LOIMOS integrates all those significant elements that can be found in the simulation of an epidemiological scenario such as the one caused by SARS-CoV-2. For example, the virus itself is considered an object that can move, sometimes freely and sometimes according to a set of constraints influenced by the other agents in the scenario.

We will now describe the most important elements of LOIMOS.

3.1 Membranes

Every membrane in the system has an integer value to denote its capacity that means the number of objects and membranes that the region it delimits holds. The capacity of any membrane cannot be exceeded. We have defined membrane labels in the system that correspond to the following elements in the epidemiological scenario:

  1. 1.

    Echo: membrane containing the epidemiological scenario. This is the skin membrane and it does not contain any rule.

  2. 2.

    Membranes that simulate places:

    1. (a)

      House\(_i\) for \(1 \le i \le 4000\). Every house is a family nucleus where the members of a family spend most of their time.

    2. (b)

      Hospital. A place where the seriously infected go.

    3. (c)

      ICU. A place where the critically infected go.

    4. (d)

      Hospital aux. A place that serves as a passageway from the hospital to the ICU.

    5. (e)

      Post-hospital. A place where cured patients go to recover before returning to normal life.

    6. (f)

      Residence. A house where elderly persons live.

    7. (g)

      Elderly day center. A place where a good percentage of retirees go and spend part of the day.

    8. (h)

      Primary school. A place where children go to study.

    9. (i)

      Secondary school. A place where teenagers go to study.

    10. (j)

      Workplace. A place where people go to work.

    11. (k)

      Common area. A place where everyone passes through to go from one area to another (except from one part of the hospital to another part).

    12. (l)

      Leisure area. A place where teenagers and middle-aged people go on the weekends at night.

    Note that in each area the dynamics of interaction between the objects and membranes within it are different from the others, both in terms of their rules of behavior and the parameters and constants that operate in that region. Similarly, the interactions between different areas may be different when communicating objects and membranes,

  3. 3.

    h\(_1\): membranes that simulate people. All people are considered of the same type. To define characteristics of the person (i.e. age) or role (i.e. a worker), a number of objects are defined that provide these characteristics within the region delimited by the membrane (that is inside the persons).

The membrane structure of the P system is defined in such a way that the skin membrane is the echo membrane, inside of which we have all the places on the same level (houses, hospital, residences, ...), and finally the hosts (people) are inside the places. The hosts always go from one place to another (they never go out to the P system environment). To move into a place, the region that models the host enters into the region that models the place using a membrane movement rule.

3.2 Objects

The rest of the elements that play an important role in the scenarios have been defined as objects. This allows us to have within each membrane those characteristic elements that fix the behaviours and all the interaction dynamics. The main objects used in the system are as follows:

  1. 1.

    Hour\(_i\) for \(0 \le i \le 23\). It denotes every day’s hour and controls the schedule inside every host.

  2. 2.

    d\(_i\) for \(1 \le i \le 7\). It denotes the day of the week and it is inside each host to control its schedule (some hosts have different schedules during the week than on weekends).

  3. 3.

    Objects to denote the age range:

    1. (a)

      ss1 a host between 0 and 12 years old,

    2. (b)

      ss1b a host between 13 and 19 years old,

    3. (c)

      ss2 a host between 20 and 59 years old, and

    4. (d)

      ss3 a host over 60 years old.

  4. 4.

    Objects to define the roles (work, school1, school2, retired, resident,...) inside each host. These objects define how and where every host moves (i.e. a school1 host will go to primary school, a worker host will go to a work place except at the weekends,...), and so on.

  5. 5.

    Objects to guide the infection dynamics: here we have defined many types of objects. First an infected host can send to another host a virus object, this randomly changes to one of the four possible types of active infections. There are rules that can make an infected person infect to other people, and cure or get worse depending on the type of infection he/she has. When the infection ends, the host is marked with an object as having passed a certain type of infection because this is important in case there is reinfection or loss of immunity. There is a type of infection (the most serious) that is simulated with a quantity x of object v\(_1\), the more v\(_1\) objects the more infected the patient is, the membrane representing the patient has antiv objects (antibodies) that can eliminate v\(_1\), but with a very small probability. In addition, it can happen that an antiv object is transformed into an antivesp object which indicates that antibodies have been obtained, and antivesp eliminates v\(_1\) in a much more efficient way (if a predefined number of antivesp objects are obtained, v\(_1\) disappears completely and the host is cured).

  6. 6.

    E1, E2, E3 and E4 objects denote the hosts status: E1 means the host is well (can be asymptomatic infected), E2 is mildly symptomatic, E3 is severe and E4 is critical. Each status triggers different processes, E2 causes a host to stay at home, E3 causes a host to go to hospital and E4 causes a host to need to go to ICU. In E3 and E4 states death can occur (it causes the only membrane dissolution in the P system). Each host in E4 state can decrease the ICU membrane capacity. A host that is cured or dies in the ICU increases the ICU capacity by one.

  7. 7.

    Addresses: each host has an object inside with the name of the house where he/she lives that correspond to a membrane label. It serves for modelling the mobility of persons.

In addition, marker objects are used to count how many times a rule is executed. This is especially interesting to obtain internal usage statistics to evaluate how many times the rules have been used. Each time a rule is executed, in some cases, it sends out a marker object that serves as a source of information for the aforementioned statistics.

3.3 Rules

The rules defined in the system have been designed according to Definition 1. In LOIMOS, the number of rules exceed 30.000. Many of them have been designed according to the indexes used in membranes and objects. The rules model aspects of the scenarios such as the processes of contagion, mobility, scheduling established for different populations, recovery or death, etc. We will show, as an example, the rules involved in some processes.

A basic contagion process We use the following objects: v\(_1\) object denotes one per thousand of active infection, v\(_1\_\)ino object denotes one per thousand of harmless infection (virus no longer reproducing), antiv object denotes one per thousand of non-specialised antibodies, antivesp object denotes one per thousand of specialised antibodies (they are much more effective), phag (of phagocyte), they make the v\(_1\_\)ino disappear, sint is an object that triggers other processes. Observe that only objects v\(_1\) and v\(_1\_\)ino reduce the membrane capacity whenever they enter the host membranes.

When a host infects another host it passes a virus object and the rule \(virus \rightarrow v_1^5\) starts the infection.

A host membrane (delimiting the one that contains the infection) has 1000 capacity and this capacity simulates the degree of the infection: if the host has 1000 v\(_1\) objects it means that it is at its maximum point of active infection, if it has 100 it is at 10% of its possible maximum active infection, if it has 100 v\(_1\) and 100 v\(_1\_\)ino it is at 20%, but of this percentage half of the infection is innocuous.

  • antiv \(v_1\) \(\overset{0.001,2}{\longrightarrow }\) antiv \(v_1\_ino\) sint. Non-specialised antibodies fight against the infection.

  • antivesp \(v_1\) \(\overset{1,2}{\longrightarrow }\) antivesp \(v_1\_ino\) sint. Specialised antibodies fight against the infection (increased likelihood of rule execution).

  • \(v_1\) \(\overset{0.035, 1}{\longrightarrow }\) \(v_1\) \(v_1\) sint Virus growth.

  • \(antiv^{200}\) \(v_1^{200}\) \(\overset{0.012, 3}{\longrightarrow }\) antivesp \(v_1\_ino\) \(antiv^{199}\) \(v_1^{199}\) \(sint^{200}\). Immunity is acquired (specialised antibodies), 200 objects antiv and 200 objects v\(_1\) are needed to obtain immunity in a biological sense. Since it takes a certain amount of time for an infection to occur, the 200 objects mentioned above ensure the necessary time for the infection to grow up to 20%.

  • \(v_1\_ino\) phag \(\overset{1,1}{\longrightarrow }\) phag Body-harmless viruses are eliminated.

Addition to the infection (symptomatology) In this process, we use the following objects: E\(_1\) the host has no symptoms (may or may not be infected), E\(_2\) the host has mild symptoms, E\(_3\) the host has severe symptoms, E\(_4\) the host has critical symptoms (needs ICU), the flag object is used to establish whether the host has reached a high viral load. In such a case, the flag object generates a cont object that is responsible for triggering the other actions associated with that high viral load. Every host has only one object E\(_x\) with \(x \in \{ 1,2,3, 4\}\) that defines its status. Observe that the initial configuration of the system before starting a simulation process, establishes that a predetermined number of \(E_x\) objects with \(x \in \{ 1,2,3, 4\}\) are initially in the system.

  • sint \(\overset{1,1}{\longrightarrow }\) \(\lambda\) Deletion of leftover sint objects. This rule has a very low priority. In this case, the object sint is used to know how many objects v\(_1\) there were in a previous step. They are used to know if a dangerous viral load is reached. If they are not used then they are deleted.

  • \(sint^{700}\) flag \(\overset{1,2}{\longrightarrow }\) cont flag The object cont triggers some processes when the viral load is high.

  • flag \(\overset{1,1}{\longrightarrow }\) flag \(clear\_cont^{1000}\) \(clear\_cont\) cont \(\overset{1,2}{\longrightarrow }\) \(\lambda\) \(clear\_cont\) \(\overset{1,1}{\longrightarrow }\) \(\lambda\). The above rules are used when the viral load is not high. If we look at the previous rule, when we have 700 sint objects, they take the object flag and they generate the high viral load state which is represented by cont, but when these 700 sint objects do not exist, the flag object is not selected so the rules defined above are executed, the object flag generates objects that delete all the cont objects and, therefore, they eliminate the host symptoms.

  • \(E_1\) cont \(\overset{1,3}{\longrightarrow }\) \(E_2\) This rule changes from asymptomatic to mild symptoms. This occurs the first time a dangerous viral load is reached.

  • \(E_2\) cont \(\overset{0.003,3}{\longrightarrow }\) \(E_3\) This rule changes from mild to severe symptoms, This occurs if the host is mildly symptomatic and maintains a high viral load. The probability of this rule is deduced from the probability of a host worsening to severe.

  • \(E_3\) cont \(\overset{0.0025,3}{\longrightarrow }\) \(E_4\) This rule carries out the transition from severe to critical symptoms. This occurs if the host is severely symptomatic and maintains a high viral load. The probability of this rule is deduced from the probability of a host worsening and transitioning to critical status.

  • \(E_2\) cont \(\overset{1,2}{\longrightarrow }\) \(E_2\) cont \(E_3\) cont \(\overset{1,2}{\longrightarrow }\) \(E_3\) cont \(E_4\) cont \(\overset{1,2}{\longrightarrow }\) \(E_4\) cont. If the object cont exists then the host remains in the same state given that the viral load is dangerous and the health state, if it does not worsen, is maintained.

  • \(E_2\) \(\overset{1,1}{\longrightarrow }\) \(E_1\) \(E_3\) \(\overset{1,1}{\longrightarrow }\) \(E_1\) \(E_4\) \(\overset{1,1}{\longrightarrow }\) \(E_1\) The host is cured, the viral load is not dangerous (there is no object cont) and the symptoms disappear.

4 Defining scenarios with LOIMOS

It is possible to design a la carte scenarios with LOIMOS based on the specification of the system parameters. These parameters refer to possible alterations of the known scientific evidence at any given time (i.e. infection rate in enclosed spaces using masks) and also to the scalability of the system by adjusting the number of hosts, locations, mobility rates, etc.

In any scenario that has been defined, the initial conditions are always identical: all hosts start at time hour\(_0\) and day d\(_ 1\) (00:00 on Monday), they start in their homes and all other areas are empty except the residences. Following this initial situation, the general scenario processes are the following: In each execution step the time of all hosts advances by one (and every 24 h advances one day), each host has a schedule according to its role that makes that, for example, at 8:00 the worker leaves home to the common area and at 9:00 the worker goes from the common area to work, and then he/she returns home when he/she finishes work. When several hosts are in the same area, contagion rules can be triggered, the probability of these rules depends on the area they are in (i.e. there is more probability of contagion in the leisure area than in the school), the probability also depends on the type of host (i.e. a child is less likely to become contagious than an adult), and on the host’s state of health (an infected host starts to become contagious three days before the symptoms appear and up to ten days after).

From the point of view of the P system, no new membranes are created (neither membrane division rules nor membrane duplication rules are used) and membranes are only dissolved whenever a host h\(_1\) dies. Every computation step simulates 1 h of real life.

The rates of transmission in various settings and through various agents of transmission in the population are based on estimates drawn from scientific evidence such as [3, 8,9,10, 12, 13, 15, 16] and [23], and public data [11]. Some of the rates used by LOIMOS are shown in Table 1.

Table 1 Estimated contagion index per contact person and hour, considering the spaces where the hosts are located, and the age and severity of the infection

4.1 Setting up the scenario parameters

In this section, we provide an example of a scenario developed with LOIMOS. We describe the characteristics of the scenario and provide an example of the results that the simulator provides from the execution of the system.

We describe the scenario as follows.

Age ranges

  • from 0 to 12 years old.

  • from 13 to 19 years old.

  • from 20 to 59 years old.

  • over 60 years old.

The ages are used to define the health of the host and to assign roles. A child is twice as likely to generate acquired immunity as an adult, and an elderly or vulnerable person is a third as likely to generate acquired immunity as an adult.

Areas that can be occupied by hosts

  • House: area where a family lives.

  • Work: place where workers meet during working hours.

  • School for children: area where hosts with an age range of 0–12 years old stay during school hours.

  • High school for teenagers: area where hosts with an age range of 13–19 years old are hosted during school hours.

  • Common area: symbolises the street and common spaces that serve as communication between all the other areas. If a host goes from one area to a different area then he/she has to pass through the common area.

  • Hospital: Area to which the hosts who suffer from the infection in a serious or chronic state go.

  • ICU: When an infected patient becomes critically ill, an ICU is required for their care. If there is space, he/she will be moved to this area. Critically ill patients in the ICU will have a lower rate of mortality than then critically ill patients outside the ICU.

  • Post-hospital: A place where the hosts who have overcome an infection in the hospital (severe or chronic infection) recover.

  • Elderly day center: 40% of the over-60s meet there every day.

  • Residence: A group of hosts over 60 reside there permanently.

  • Leisure area: a place where a large part of the 13–19 age group and some of the 20–59 age group meet for parties and nightlife at weekends and during holidays.

Schedules according to role

  • Worker Monday to Friday:

    • 07:00 to 08:00 in common area.

    • 08:00 to 17:00 at work.

    • 17:00 to 19:00 in common area.

    • 19:00 to 07:00 at home.

  • Adult at home Monday to Friday: (10%) stay at 08:00,09:00,10:00, 16:00, 17:00 or 18:00. They stay for 1 h (40%), 2 h (24%) or 3 h (36%). The adult goes out to do some tasks in the common area. Every day for 6 specific hours a day there is a 10% probability of going out to perform a task. This outing can be for 1 h with a 40% probability, for 2 h with a 24% probability and for 3 h with a 36% probability.

  • Children 0–12 years old Monday to Friday:

    • 08:00 to 09:00 common area.

    • 09:00 to 17:00 school for children.

    • 17:00 to 18:00 (20%), to 19:00 (48%), to 20:00 (32%) common area. Children may be delayed on their way home for 1, 2 or 3 h.

    • 18:00,19:00 or 20:00 to 08:00 home.

  • Children 13–19 years old Monday to Friday:

    • 08:00 to 09:00 common area.

    • 09:00 to 17:00 High school.

    • 17:00 to 18:00 (20%), to 19:00 (48%), to 20:00 (32%) common area. Teenagers may be delayed on their way home for 1, 2 or 3 h.

    • 18:00,19:00,20:00 to 08:00 home.

  • Day shift medical staff or residence carers:

    • 07:00 to 08:00 common area.

    • 08:00 to 17:00 hospital, ICU or residence (it depends on the role).

    • 17:00 to 19:00 common area.

    • 19:00 to 07:00 at home.

  • Night shift medical staff or residence carers:

    • 18:00 to 20:00 in common area.

    • 20:00 to 06:00 hospital, ICU or residence depending on role.

    • 06:00 to 07:00 in common area.

    • 07:00 to 18:00 home.

  • Retiree: (40% chance of going to the elderly day center):

    • 08:00 to 09:00 common area.

    • 09:00 to 18:00 elderly day center.

    • 18:00 to 19:00 common area.

    • 19:00 to 08:00 home.

    If the retiree does not go to the elderly day center, then he/she can go out to the common area as an adult at home.

  • Elderly in residence: Spends the whole day in the residence.

Other activities carried out by the hosts

  • During the weekends the workers, the adults at home, the younger students or teenager students can go out to the common area. Departure times are 10:00 (30%), 17:00 (35%) or 18:00 (35%). They stay at the common area for 1 h (40%), 2 h (24%) or 3 h (36%).

  • Visiting a relative in the residence: Those who have a relative in a residence can go on the weekend for a visit.

    • 09:00 to 10:00 common area.

    • 10:00 to 16:00 residence.

    • 16:00 to 17:00 common area.

  • Going out to the leisure area: In the early hours of Friday to Saturday or Saturday to Sunday, a large percentage of teenagers and a small percentage of adults go to a leisure area.

    • 00:00 to 01:00 common area.

    • 01:00 to 06:00 leisure area.

    • 06:00 to 07:00 common area.

    Chances of going out to the leisure area: Friday teenage 50% , Friday adult 15%, Saturday teenage: 80% and Saturday adult: 30% .

Population

  • 1,372 children students (every day they go to school).

  • 848 teenager students (every day they go to high school).

  • 4324 workers (every day they go to work).

  • 1266 household (objects ss2) (adults who take care of the house and go out from time to time).

  • 2380 household (objects ss3) (elderly/sensitive adults who take care of the household and go out from time to time).

  • 5 medical staff hospital day (every day they go to the hospital).

  • 5 medical staff hospital night (every day they go to the hospital).

  • 5 medical staff ICU day (every day they go to ICU).

  • 5 medical staff ICU night (every day they go to the ICU).

  • 5 residential staff day.

  • 5 night residential staff.

  • 100 stay in residence.

Host ages

  • 1372 hosts aged 0–12 years old.

  • 848 hosts aged between 13 and 19 years old.

  • 5620 hosts aged 20–59 years old.

  • 2480 hosts aged over 60 years old.

Basic measures for healthcare personnel

Healthcare workers have a prevention measure in the hospital whereby if a host with the virus is going to infect them, they have only a 20% chance of becoming infected.

Household types

  • 175: 1 adult working, 1 adult household and 2 children.

  • 30: 1 adult working, 1 adult household and 2 children, one minor and one teenager.

  • 105: 1 working adult, 1 adult household and 2 teenagers.

  • 30: 1 adult medical or residential staff, 1 adult household and 2 minor children.

  • 1190: 2 elderly or sensitive persons (household type).

  • 496: 1 working adult, 1 adult household.

  • 276: 1 adult working, 1 adult household and 1 minor child.

  • 184: 1 working adult, 1 adult household and 1 teenager.

  • 175: 2 working adults and 2 children.

  • 30: 2 adults working and 1 child and 1 teenager.

  • 105: 2 adults working and 2 teenager.

  • 744: 2 working adults.

  • 276: 2 working adults and 1 child.

  • 184: 2 adults working and 1 teenager.

Initial conditions

We start with 3 infected workers.

Dynamics for the sick population

  • A host that is well keeps on its routine (work, school, etc).

  • A host that reaches a viral load of 70% will notice the first symptoms, will become mildly ill and will stay at home until he/she is well.

  • A host in the residence with mild symptoms will stay in the residence.

  • Every hour there is a 0.003 chance that a mildly ill person will get worse and become severely ill. If this happens, the infected person will go to the hospital.

  • Every hour there is a 0.0025 probability that a severely ill person will deteriorate to critically ill. If this happens, the infected person will be transferred to the ICU as long as there is any vacancy.

  • Every hour there is a 0.0005 chance that a severely ill patient will die.

  • Every hour there is a 0.003 chance that a critically ill patient will die if they are in the ICU.

  • Every hour there is a 0.006 chance that a critically ill patient will die if he/she is not in the ICU.

  • A patient who is cured in the hospital (critically ill patients) will spend, on average, recovery time of one week in hospital and then return home and resume his/her routine activities.

Infection dynamics

  • A host can receive a contagion and he/she can spread it if he/she is infected. There is a probability of infecting (this is set before) and a probability that if the host is infected it will suffer the infection (this is set to 100%, but it can be lowered by simulating prevention measures).

  • When an infection is received, it starts as one of the four types that we will describe later.

  • The virus in an infected host which is going to overcome the infection with acquired immunity grows. The viral load goes from 0 to 1000.

  • When the infection is going to be overcome by acquired immunity, we simulate the infection as follows: first the innate immune system fights the infection (not very effectively) by disabling some viruses (0–1000), then antibodies are generated, these specific antibodies disable the virus very effectively, and finally, virus can no longer enter cells and cannot reproduce. The disabled viruses are eliminated by phagocytes.

All values of disabling a virus and getting more specific antibodies can be changed and adjusted.

Immunity

  • Infection overcome by innate immunity generates antibodies and thus infection passes without symptoms. Hosts that pass this type of infection cannot be re-infected.

  • Infection overcome by innate immunity that does not generate antibodies, but the innate immune system is so strong that the infection passes asymptomatically. Hosts that pass this type of infection can be re-infected and the re-infection will be of this type.

  • Infection overcome by innate immunity that does not generate antibodies. In this case, the immune system is weak, so that symptoms can be seen, although they will never go beyond mild symptoms. These hosts can be reinfected and this reinfection can be of this type.

  • Infection overcome with acquired immunity. Here, we have two different cases, one produces immunity and the other does not. The last is a case such that the innate immunity is not sufficient and the patient presents symptoms that can range from mild to critical symptoms and may even result in death.

With regards to reinfections, the host will behave in a very similar way to previous infections. Therefore a host that has undergone an infection overcome by innate immunity and has not acquired immunity, if reinfected, will suffer the same type of infection. A host that has passed the infection by acquired immunity and has not acquired enough immunity will pass an infection that requires acquired immunity again, but this time it has a 50% probability of acquiring immunity.

ICU places

In this scenario, there are 2 ICU places.

Types of infection (taken from [7])

First, there are those who acquired the virus, which can replicate until reaching 20% of the maximal viral load. During this process, the innate immunity is triggered, causing the viral load to decrease. An acquired immune response does not occur. These cases are either asymptomatic or have very mild symptoms. This type is here designed as the ‘efficient innate immunity/lacking acquired immunity/mild to no symptoms’ (E-inn/L-acq/N) type.

Second, there are those in whom the viruses are efficiently cleared by their innate immunity but that cross the viral load threshold for triggering acquired immunity. In most cases, these hosts remain asymptomatic or have mild symptoms. This type is designed as the ‘efficient innate immunity/normal acquired immunity/mild to no symptoms’ (E-inn/N-acq/N) type.

Third, there are the hosts whose innate immunity is insufficient for reducing the viral load, which increases accordingly and crosses the threshold after which symptomatic infection occurs and acquired immunity is developed. This type is designed as the ‘inefficient innate immunity/normal acquired immunity/symptomatic’ (I-inn/N-acq/S) type.

Fourth, there are the hosts whose innate immunity is insufficient to clear the virus, resulting in a symptomatic infection; however, their acquired immune response is weak or slow. This type is designed here as the ‘inefficient innate immunity/weak acquired immunity/symptomatic’ (I-inn/W-acq/S) type.

The infection rates are shown in Table  2.

Table 2 Rates of each type of infection by age range

Contagion

  • Contagion works in a different way depending on whether it is overcome by innate or acquired immunity.

  • If there is an infection that is going to be overcome by innate immunity, it starts to be contagious after 60 h.

  • If there is an infection that will be overcome by acquired immunity, it becomes infectious after exceeding a viral load of 20%, the rate of infection depends on where the host is located and the state in which he/she finds himself/herself (asymptomatic, mild symptoms, severe infection or critical infection).

Other Indexes

  • Probability of death of critical patient in ICU: 0.003/h. In 7 days, the probability of death is 39.63%. In 14 days, the probability of death is 63.56%.

  • Probability of death for critical patient outside the ICU: 0.006/h. In 7 days, the probability of death is 63.62%. In 14 days, the probability of death is 86.76%.

  • Probability of death of seriously ill patient: 0.0005/h. In 7 days, the probability of death is 8.05%. In 14 days, the probability of death is 15.47%.

  • Probability of an infected person from mild to severe illness: 0.003/h. In 7 days, the probability of going from mild to severe is 39.63%. In 14 days, the probability of going from mild to severe is 63.56%.

  • Probability for an infected person from severe to critical illness : 0.0025/h. In 7 days, the probability from severe to critical is 34.33%. In 14 days, the probability from severe to critical is 56.87%.

Other contagion rates

  • Infection overcome by innate immunity:

    • Most: 0.02/h.

    • Contagions in 6 h 0.12.

    • Contagions in 12 h 0.24.

    • Contagions in 1 day 0.48.

    • Contagions in 7 days 3.36.

  • Infections overcome by acquired immunity:

    • (most commonly used) Asymptomatic at home, common area, and work: 0.1/h.

      • Contagious in 6 h 0.6.

      • Contagious within 12 h 1.2.

      • Contagious in 1 day 2.4.

      • Contagious in 7 days 16.8.

    • (highest outside the hospital) Asymptomatic and mildly ill elderly in residence: 0.4/h.

      • Contagions in 6 h 2.4.

      • Contagions in 12 h 4.8.

      • Contagions in 1 day 9.6.

      • Contagions in 7 days 67.2.

    • (controversial) leisure area: 0.3/h.

      • Contagions in 6 h 1.8.

      • Contagions in 12 h 3.6.

      • Contagions in 1 day 7.2.

      • Contagions in 7 days 50.4.

4.2 Three different scenario assays

Once the parameters and characteristics of the scenarios described in the previous section have been set, we show the results obtained by the simulator in three different situations, which are detailed in the following:

  • Scenario 1: The evolution of the scenario is obtained without adopting any measure of correction or prevention.

  • Scenario 2: 30 days without measures, confinement from day 30 to day 90, no measures from day 90 onwards.

  • Scenario 3: 30 days no measures, confinement from day 30 to day 90, from day 90 onwards curfew (no night-time recreation), 80% reduction of infections in hospital and residence and 40% elsewhere.

When the confinement is applied, we apply the 95% reduction of infection in hospital and residence and 60% in the rest of the sites. The schedules are reduced to what is strictly necessary.

Fig. 1
figure 1

Evolution of the three different scenarios.We show the number of infected populations (according to the four categories showed in Table 1) and its prevalence index. In the top, we have an scenario without adopting any measure. In the middle, the first 30 days are without adopting any measure (before the first vertical bar) then confinement (up to the second vertical bar) and again without measures. In the bottom, the first 30 days are without any measure (first vertical bar), then confinement (up to the second vertical bar) and then some restrictions such as confinement in the night hours)

In Fig.  1, we see the evolution of the three scenarios previously defined. We can observe the evolution during 7000 computation steps which amounts to 291 days of real life approximately. On the vertical axis we represent the number of infected people depending on the categories defined in Table  1, as well as the prevalence index referring to the entire population. It can be seen, in particular in scenario 2, the effect of the famous waves of infections that epidemiologists have repeatedly mentioned as a result of ceasing the restrictive measures to be adopted by the population.

5 Conclusions

In this paper, we have presented a new application of membrane computing and P systems to modeling complex systems. In our case, the application of these models in the area of epidemiology takes on special relevance due to the events that we have suffered in recent months on a global scale.

The advantages of membrane computation models over other more classical simulation models such as those based on ODE are multiple: on the one hand, the compartmentalization of the actor agents in the system to be simulated is an innate ingredient in P systems. In addition, the scalability of the model as well as the ease of introducing new concepts and evidences make its development, both at the design and implementation level, extremely easy. The hierarchies established between all the elements of the simulated scenarios are also defined in a very natural way in the P systems.

Currently, in relation to the LOIMOS system, we are developing interfaces that facilitate its use by stakeholders in decision-making during the pandemic. Note that the LOIMOS system is prepared to work with pandemics other than those caused by the SARS-CoV-2 coronavirus. In this sense, the adaptation of LOIMOS would only be carried out by altering those parameters that have been defined as a result of biological evidence, while the population parameters and assumptions could remain unaltered.