0 2cm 9pt red  This preprint has not undergone peer review (when applicable)
or any post-submission improvements or corrections. The Version of Record of
this contribution is published in The Semantic Web. ESWC 2022. Lecture Notes
in Computer Science, vol 13261, and is available online at
https://doi.org/10.1007/978-3-031-06981-9_10
[datatype=bibtex][overwrite][fieldsource=doi, final][fieldset=url,
null][fieldset=eprint, null]

11institutetext: Heinz Nixdorf Chair for Distributed Information Systems,
Institute for Computer Science, Friedrich Schiller University Jena, Jena,
Germany
11email<EMAIL_ADDRESS>
# Why Not to Use Binary Floating Point Datatypes in RDF

Jan Martin Keil *  — and Merle Gänßinger *  —

###### Abstract

The XSD binary floating point datatypes are regularly used for precise numeric
values in RDF. However, the use of these datatypes for knowledge
representation can systematically impair the quality of data and, compared to
the XSD decimal datatype, increases the probability of data processing
producing false results. We argue why in most cases the XSD decimal datatype
is better suited to represent numeric values in RDF. A survey of the actual
usage of datatypes on the relevant subset of the September 2020 Web Data
Commons dataset, containing $14\,778\,325\,375$ literals from real web data,
substantiates the practical relevancy of the described problems:
$29\text{\,}\%$–$68\text{\,}\%$ of binary floating point values are distorted
due to the datatype.

###### Keywords:

Data Quality Datatypes Floating Point Precision Knowledge Graphs Numerical
Stability RDF XSD

##  1 Introduction

The Resource Description Framework (RDF) is the fundamental building block of
knowledge graphs and the Semantic Web. In RDF, values are represented as
literals. A literal consists of a lexical form, a datatype, and possibly a
language tag. The use of XML Schema (XSD) built-in datatypes [1] is
recommended by the RDF standard [2, Sec. 5.1]. For numeric values, this
includes the primitive types float, double and decimal as well as all
variations of integer111integer, long, int, short, byte, nonNegativeInteger,
positiveInteger, unsignedLong, unsignedInt, unsignedShort, unsignedByte,
nonPositiveInteger, and negativeInteger which are derived from decimal.

The datatype decimal allows to represent numbers with arbitrary precision,
whereas the datatypes float and double allow to represent binary floating
point values of limited range and precision [1]. However, in practice, the
binary floating point datatypes are regularly used for precise numeric values,
although the datatype can not accurately represent these values. Even a
popular ontology guideline [3] and a World Wide Web Consortium (W3C) working
group note [4] use binary floating point datatypes for precise numeric values
in examples.

In general, binary floating point numbers are meant to approximate decimal
values in a fixed length binary representation to limit memory consumption and
increase computation speed. In RDF, however, binary floating point numbers are
defined to represent the exact value of the binary representation: Binary
floating point values do not approximate typed decimals, as in programming
languages, but typed decimals are abbreviations for exact binary floating
point values. This causes ambiguity about the intended meaning of numeric
values. We show that $29\text{\,}\%$–$68\text{\,}\%$ of the floating point
values in real web data are distorted due to the datatype. With regard to the
growing use of RDF for the representation of data, including research data,
this ambiguity is concerning.

Further, the use of binary floating point datatypes for precise numeric values
regularly causes rounding errors in the values actually represented, compared
to typed values provided as decimals. Subsequently, error accumulation may
significantly falsify the result of processing these values. Disasters, such
as the Patriot Missile Failure, which resulted in 28 deaths, illustrate the
potential impact of accumulated errors in real world applications [5]. The
increasing relevance of knowledge graphs for real-world applications calls for
general awareness of these issues in the Semantic Web community.

In this paper, we discuss advantages and disadvantages of the different
numeric datatypes. We demonstrate the practical relevance of outlined problems
with a survey of the actual usage of datatypes on the relevant subset of the
September 2020 Web Data Commons dataset, containing $14\,778\,325\,375$
literals from real web data. We aim to raise awareness of the implications of
datatype selection in RDF and to enable a more informed choice in the future.
This work is structured as follows: In Section 2, we give an overview of
relevant standards and related work, followed by a comparison of the
properties of the binary floating point and decimal datatypes in Section 3. In
Section 4, we discuss the implications of the datatype properties in different
use cases. An approach for automatic problem detection is sketched in Section
5. In Section 6, we present a survey on the use of datatypes in the Word Wide
Web that demonstrates the practical relevance of the outlined problems.
Finally, we indicate approaches for the general mitigation of the problems in
Section 7.

##  2 Background

Each datatype in RDF consists of a lexical space, a value space, and a
lexical-to-value mapping. This is compatible with datatypes in XSD [2].

> The value space of a datatype is the set of values for that datatype [1, 2].

> The lexical space of a datatype is the prescribed set of strings, which the
> lexical mapping for that datatype maps to values of that datatype. The
> members of the lexical space are lexical representations (XSD) or lexical
> forms (RDF) of the values to which they are mapped [1, 2].

> The lexical mapping (XSD) or lexical-to-value mapping (RDF) for a datatype
> is a prescribed relation which maps from the lexical space of the datatype
> into its value space [1, 2].

RDF reuses many of the XSD datatypes [2]. For non-integer numbers, XSD
provides the datatypes decimal, float and double. The XSD datatype decimal
(xsd:decimal) represents a subset of the real numbers [1].

Value space of xsd:decimal:

The set of numbers that can be obtained by dividing an integer by a non-
negative power of ten: $\frac{i}{10^{n}}$ with
$i\in\mathbb{Z},n\in\mathbb{N}_{0},$ precision is not reflected [1].

Lexical space of xsd:decimal:

The set of all decimal numbers with or without a decimal point [1].

Lexical mapping of xsd:decimal:

Set $i$ according to the decimal digits of the lexical representation and the
leading sign, and set $n$ according to the position of the period or $0$, if
the period is omitted. If the sign is omitted,“$+$” is assumed [1].

The XSD datatype float (xsd:float) is aligned with the IEEE 32-bit binary
floating point datatype [6]222As the XSD recommendation refers to IEEE
754-2008 version of the standard, we do not refer to the subsequent IEEE
754-2019 version., the XSD datatype double (xsd:double) is aligned to the IEEE
64-bit binary floating point datatype [6]. Both represent subsets of the
rational numbers. They only differ in their three defining constants [1].

Value space of xsd:float (xsd:double):

The set of the special values positiveZero, negativeZero, positiveInfinity,
negativeInfinity, and notANumber and the numbers that can be obtained by
multiplying an integer $m$ whose absolute value is less than $2^{24}$ (double:
$2^{53}$) with a power of two whose exponent $e$ is an integer between $-149$
(double: $-1074$) and $104$ (double: $971$): $m\cdot 2^{e}$ [1].

Lexical space of xsd:float (xsd:double):

The set of all decimal numbers with or without a decimal point, numbers in
exponential notation, and the literals INF, +INF, -INF, and NaN [1].

Lexical mapping of xsd:float (xsd:double):

Set either the according numeric value (including rounding, if necessary), or
the according special value. An implementation might choose between different
rounding variants that satisfy the requirements of the IEEE specification.

Numbers with a fractional part of infinite length, like, for example, the
rational number $\frac{1}{3}=0.\bar{3}$ or the irrational number
$\sqrt{2}=1.4142\ldots$, are not in the value space of xsd:float or
xsd:double, as a number of finite length multiplied or divided by two is
always a number of finite length again. Consequently, a finite decimal with
sufficient precision can exactly represent every possible numeric value or
lexical representation of an xsd:float or xsd:double, except of the special
values positiveInfinity, negativeInfinity, and notANumber. In contrast, a
finite binary floating point value can not exactly represent every possible
decimal value.

Some serialization or query languages for RDF provide a shorthand syntax for
numeric literals without explicit datatype specification. In Turtle, TriG and
SPARQL a number without fraction is an xsd:integer, a number with fraction is
an xsd:decimal, and a number in exponential notation is an xsd:double [7, 8,
9]. In JSON-LD a number without fractions is an xsd:integer and a number with
fraction is an xsd:double, to align with the common interpretation of numbers
in JSON [10]. Other RDF languages, i.e. RDF/XML, N-Triples, N-Quads, and RDFa,
do not provide a shorthand syntax for numeric literals [11, 12, 13, 14]. Other
languages for machine-readable annotation of HTML, which are regularly mapped
to RDF, i.e. Microformats333https://microformats.org, and
Microdata444https://html.spec.whatwg.org/multipage/microdata.html, do not
incorporate explicit datatypes.

In addition to the core XSD datatypes, a W3C working group note introduces the
precisionDecimal datatype [15]. It is aligned to the IEEE decimal floating-
point datatypes [6] and represents a subset of real numbers. It retains
precision and permits the special values positiveZero, negativeZero,
positiveInfinity, negativeInfinity, and notANumber. Further, it supports
exponential notation. The precision and exponent values of the
precisionDecimal datatype are unbounded, but can be restricted in derived
datatypes to comply with an actual IEEE decimal floating-point datatype.
However, even though the RDF standard permits the use of precisionDecimal, it
does not demand its support in compliant implementations [2]. Therefore, RDF
frameworks can not be expected to always support precisionDecimal.

Another W3C working group note addresses the selection of proper numeric
datatypes for different use cases. It identified three relevant use cases of
numeric values: count, measurement, and constant. According to the note, the
usually appropriate datatypes are (derived datatypes of) the integer datatype
for counts, binary floating point datatypes for measurements, and the decimal
datatype for constants [4].

The popular ontology schema.org555http://schema.org, current version 13.0
defines alternative numeric datatypes schema:Integer and schema:Float and
their super datatype schema:Number. A usage note restricts the lexical space
of schema:Number to the digits 0 to 9 and at most one full stop. No further
restrictions of the lexical or value space are made. schema:Number is directly
in the range of 91 properties defined by schema.org and schema:Integer is
directly in the range of 47 properties. schema:Float is not directly in the
range of any property.

The digital representation or computation of numerical values can cause
numerical problems: An _overflow error_ occurs, if a represented value exceeds
the maximum positive or negative value in the value space of a datatype. An
_underflow error_ occurs, if a represented value is smaller than the minimum
positive or negative value different from zero in the value space of a
datatype. A _rounding error_ occurs, if a represented value is not in the
value space of a datatype and is represented by a nearby value in the value
space that is determined by a rounding scheme. A _cancellation_ is caused by
the subtraction of nearly equal values and eliminates leading accurate digits.
This will expose rounding errors in the input values of the subtraction.
_Error accumulation_ is the insidious growth of errors due to the use of a
numerically instable sequence of operations.

##  3 Properties of Binary Floating Point and Decimal Datatypes in RDF

Binary floating point and decimal datatypes in the context of RDF have
individual properties, which make them more or less suitable for specific use
cases:

xsd:float and xsd:double permit the use of positive and negative infinite
values. xsd:decimal supports neither positive nor negative infinite values.

xsd:float and xsd:double permit the exponential notation. Especially in case
of numbers with many leading or trailing zeros, this is more convenient and
less error-prone to read or write for humans. xsd:decimal does not permit the
exponential notation. There is no actual reason for this limitation. For
example, Wikibase666https://wikiba.se/, SPARQL endpoint example:
https://query.wikidata.org also accepts exponential notation for
xsd:double.777Example query: PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ("1e-9"^^xsd:decimal AS ?d) WHERE {} The XML Schema Working Group
decided against allowing exponential notation for xsd:decimal, as the
requirement to have a decimal datatype permitting exponential notation was
already met by precisionDecimal [16], which, however, has been dropped in the
later process of the standardization [17].

Figure 1: Possible processing paths of numeric literals depending on their
datatype.

The value spaces of xsd:float and xsd:double only provide partial coverage of
the lexical space. Therefore, the lexical mapping (\raisebox{-.9pt} {3}⃝ in
Figure 1) might require rounding to a possible binary representation and the
actual value might slightly differ from the lexical representation. For
example, xsd:float has no exact binary representation of $0.1$ and, if using
the default roundTiesToEven rounding scheme [6], the lexical representation
$0.1$ of xsd:float actually maps to a slightly higher binary representation of
$0.10000000149011612$. Depending on the used RDF framework, it might be
possible to preserve the exact value of the lexical representation by
implementing a custom mapping to decimal (\raisebox{-.9pt} {2}⃝ in Figure 1).
However, this causes additional development effort and introduces non standard
compliant behavior. The value space of xsd:decimal covers all values in the
lexical space. Therefore, the lexical mapping (\raisebox{-.9pt} {1}⃝ in Figure
1) always provides the exact numeric value described in the lexical
representation without any rounding. All three datatypes, xsd:float,
xsd:double, and xsd:decimal, do not cover the precision reflected by the
lexical representation. The only discussed datatype that preserves precision
is precisionDecimal.

The accuracy of calculations based on xsd:float or xsd:double literals
(\raisebox{-.9pt} {7}⃝ in Figure 1) is limited, as a properly implemented RDF
framework will use binary floating point arithmetic by default. For example,
this happens during the execution of SPARQL queries that include arithmetic
functions or aggregations. Therefore, the calculations might be affected by
various numeric problems, i.e. underflow errors, overflow errors, rounding
errors, cancellation, and error accumulation. Calculations based on
xsd:decimal literals (\raisebox{-.9pt} {6}⃝ in Figure 1) will by default use a
decimal arithmetic with arbitrary precision. Therefore, they might only be
affected by rounding errors in case of (intermediate) results with a
fractional part of infinite length, as well as accumulations of these rounding
errors. This different behavior is demonstrated in LABEL:fig_problems.
Depending on the used RDF framework, it might be possible to cast between the
datatypes (\raisebox{-.9pt} {4}⃝ and \raisebox{-.9pt} {5}⃝ in Figure 1).
However, a value cast from binary floating point to decimal (\raisebox{-.9pt}
{5}⃝ in Figure 1) is still affected by the rounding error of the floating
point value caused by the lexical mapping and subsequent calculations
(\raisebox{-.9pt} {8}⃝ in Figure 1) will still result in approximate results
only. In contrast, the results of calculations based on a value cast from
decimal to floating point (\raisebox{-.9pt} {4}⃝ in Figure 1) and based on an
initial floating point value (\raisebox{-.9pt} {3}⃝ in Figure 1) do not
differ, if the same rounding method is used. The SPARQL query in
LABEL:fig_problems and the according result provided by Wikibase6 demonstrates
different numerical problems of the datatypes. Other SPARQL endpoints, i.e.
Virtuoso 8.3888https://virtuoso.openlinksw.com/ and Apache Fuseki
5.16.0999https://jena.apache.org/, provide similar results.

⬇

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?datatype

(xsd:decimal(STRDT("0.1", ?datatype)) AS ?rounded)

(xsd:decimal(STRDT("1", ?datatype) / STRDT("3", ?datatype)) AS
?roundedInfinit)

(xsd:decimal(STRDT("1.0000001", ?datatype) - STRDT("1.0000000", ?datatype)) AS
?cancellation)

(STRDT("1000000000000000000000000000000000000000", ?datatype) AS ?overflow)

(STRDT("0.0000000000000000000000000000000000000000000001", ?datatype) AS
?underflow)

WHERE {VALUES ?datatype {xsd:float xsd:decimal}}\end{lstlisting}

\begin{tabular}{|l|ll|}

datatype & xsd:float & xsd:decimal \\\

rounded & \scalebox{1}{0.10000000149011612} & 0.1 \\\

roundedInfinit & \scalebox{1}{0.3333333432674408} &
\scalebox{1}{0.33333333333333333333} \\\

cancellation & \scalebox{.825}{0.00000011920928955078125} & 0.0000001 \\\

overflow & Infinity &
\scalebox{.825}{1000000000000000000000000000000000000000} \\\

underflow & 0.0 &
\scalebox{.825}{0.0000000000000000000000000000000000000000000001} \\\

\end{tabular}

\caption{Top: A SPARQL query that demonstrates differing numerical problems of
the datatypes float and decimal. Bottom: The corresponding query output
(transformed), as on
\href{https://query.wikidata.org/\\#PREFIX\%20xsd\%3A\%20\%3Chttp://www.w3.org/2001/XMLSchema\%23\%3E\%0ASELECT\%20\%3Fdatatype\%0A\%20\%20\%28xsd\%3Adecimal\%28STRDT\%28\%220.1\%22\%2C\%20\%3Fdatatype\%29\%29\%20AS\%20\%3Frounded\%29\%0A\%20\%20\%28xsd\%3Adecimal\%28STRDT\%28\%221\%22\%2C\%20\%3Fdatatype\%29\%20\%2F\%20STRDT\%28\%223\%22\%2C\%20\%3Fdatatype\%29\%29\%20AS\%20\%3FroundedInfinit\%29\%0A\%20\%20\%28xsd\%3Adecimal\%28STRDT\%28\%221.0000001\%22\%2C\%20\%3Fdatatype\%29\%20-\%20STRDT\%28\%221.0000000\%22\%2C\%20\%3Fdatatype\%29\%29\%20AS\%20\%3Fcancellation\%29\%0A\%20\%20\%28STRDT\%28\%221000000000000000000000000000000000000000\%22\%2C\%20\%3Fdatatype\%29\%20AS\%20\%3Foverflow\%29\%0A\%20\%20\%28STRDT\%28\%220.0000000000000000000000000000000000000000000001\%22\%2C\%20\%3Fdatatype\%29\%20AS\%20\%3Funderflow\%29\%0D\%0AWHERE\%20\%7BVALUES\%20\%3Fdatatype\%20\%7Bxsd\%3Afloat\%20xsd\%3Adecimal\%7D\%7D}{\ttfamily
http://query.wikidata.org}. }

\label{fig_problems}

\end{figure}

##  4 Implications for the Choice of Numeric Datatypes

The traditional use case of RDF is the representation of knowledge. The XSD
floating point datatypes provide two advantages for the knowledge
representation compared to xsd:decimal: Firstly, the permitted representation
of positive and negative infinite might be needed in some cases. Secondly, the
exponential notation eases the representation of very large and very small
values and reduces the risk of typing errors due to missing or additional
zeros. This would not be an issue in case of proper user interface support.
But popular tools, like, for example,
WebProtégé101010https://protege.stanford.edu/ and Protégé Desktop10, do not
help the user here. Further, projects that manipulate their RDF documents
under version control using SPARQL UPDATE queries, custom generation scripts
and manual edits do not have such a user interface at all.

However, in most cases, knowledge concerned with numbers deals with exact
decimal numbers or intervals of decimal values. Intervals are typically
described with two exact decimal numbers, either with a minimum value and a
maximum value (e.g. $[0.05,0.15]$) or an value and a measurement uncertainty
(e.g. $0.1\pm 0.05$) [18]. The binary floating point datatypes do not allow
the accurate representation of exactly known or defined numbers in many cases.
In addition, they entail the risk to fool data curators into believing that
they stated the exact number, as the lexical representation on first sight
appears to be exact. This becomes even more critical, if xsd:double was used
unintentionally due to a shorthand syntax in Turtle, TriG, SPARQL, or JSON-LD.
This way, the use of binary floating point datatypes produces ambiguity in the
data: The intended meaning could either be the actually represented number in
the value space or the verbatim interpretation of the lexical representation.
This ambiguity counteracts the basic ideas behind the Semantic Web and linked
open data to ease understanding and reuse of data. Therefore, binary floating
point datatypes are not suitable to fulfill the requirements for knowledge
representation.

In consequence, the knowledge can not be used for exact calculations without
programming overhead. The possible small rounding errors of binary floating
point input values might accumulate to significant errors in calculation
results. Disasters, as the Patriot Missile Failure, illustrate the potential
impact of accumulated errors in real world applications [5].

This contradicts a W3C working group note [4], stating that binary floating
point datatypes are appropriate for measurements. It provided the following
example representation of a measurement in the interval of $73.0$ to $73.2$:

    _:w eg:value     "73.1"^^xsd:float .
    _:w eg:errorRange "0.1"^^xsd:float .

However, if using the default roundTiesToEven rounding scheme [6], this
example actually represents a measurement in the interval
$72.99999847263098388$ to $73.19999847561121612$, as $73.1$ and $0.1$ are not
in the value space of xsd:float.111111Lexical mappings (roundTiesToEven
rounding scheme): $73.1\rightarrow 73.0999984741211$ and $0.1\rightarrow
0.10000000149011612$, Interval calculations: $73.0999984741211\pm
0.10000000149011612$ In consequence, the actual represented error interval
misses to cover all points between $73.19999847561121612$ and $73.2$. A common
solution for this problem is the use of different rounding schemes for the
calculation of the upper and lower bound of the interval (outward rounding)
[19]. However, this is not provided in current RDF frameworks and causes
additional programming effort. The example shows that also in case of
measurements binary floating point datatypes have clear disadvantages compared
to xsd:decimal.

Further, the use of binary floating point values in RDF restricts the
selection of the used arithmetic for calculations, as it causes an
implementation overhead for the application of decimal arithmetic with
arbitrary precision. It must be mentioned that calculations using decimal
arithmetic with arbitrary precision probably are significantly slower,
compared to calculations using binary floating point arithmetic with limited
precision. Hence, floating point calculations are better suited for many use
cases. However, in certain cases they are not. Therefore, the selection of an
arithmetic must be up to the application, not to the input data, as
applications might widely vary regarding the required accuracy and the
numerical conditioning of the underlying problem.

The same problem arises in use cases that involve the comparison of values,
like ontology matching or ontology based data validation, because comparison
values become blurred due to rounding. For example, if using the default
roundTiesToEven rounding scheme, an upper bound of "0.1"^^xsd:float in a
constraint still permits a value of 0.100000001. Thus, the use of binary
floating point datatypes for knowledge representation can systematically
impair the quality of data and increases the probability of data processing
producing false results.

In other use cases, RDF might be used for the exchange of initially binary
floating point values, as computational results or the output of analog-to-
digital converters. If the data to exchange are binary floating point values,
the original value can only contain values with an exact binary representation
and corruption of data with rounding is impossible. Thus, the use of floating
point datatypes for the exchange of computational results is reasonable.

##  5 Automatic Distortion Detection

The automatic detection of quality issues is key to an effective quality
assurance. Therefore, RDF editors, like Protégé10, or evaluation tools, like
the OntOlogy Pitfall Scanner! [20], would ideally warn data curators, if the
use of binary floating point datatypes would distort numeric values.

A simple test can be implemented by comparing the results of the default
mapping to a binary floating point value (\raisebox{-.9pt} {3}⃝ in Figure 1)
followed by an cast to decimal (\raisebox{-.9pt} {5}⃝ in Figure 1) and a
custom mapping to a decimal value (\raisebox{-.9pt} {2}⃝ in Figure 1). The
SPARQL query in LABEL:fig_detection demonstrates the approach.

⬇

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT

(xsd:decimal(?defaultMapping) AS ?float)

(?customMapping AS ?decimal)

(xsd:decimal(?defaultMapping) != ?customMapping AS ?distorted)

WHERE {

VALUES ?lexical {"10" "1" "0.1" "0.5"}

BIND(STRDT(?lexical, xsd:float) AS ?defaultMapping)

BIND(STRDT(?lexical, xsd:decimal) AS ?customMapping)

}\end{lstlisting}

\begin{tabular}{lll}

\hline

float & decimal & distorted \\\

\hline

0.5 & 0.5 & false \\\

0.10000000149011612 & 0.1 & true \\\

1 & 1 & false \\\

10 & 10 & false \\\

\hline

\end{tabular}

\caption{Top: A SPARQL query that demonstrates an approach to detect number
distortion. Bottom: The corresponding query output, as on
\href{https://query.wikidata.org/\\#PREFIX\%20xsd\%3A\%20\%3Chttp://www.w3.org/2001/XMLSchema\%23\%3E\%0ASELECT\%0A\%20\%20\%28xsd\%3Adecimal\%28\%3FdefaultMapping\%29\%20AS\%20\%3Ffloat\%29\%0A\%20\%20\%28\%3FcustomMapping\%20AS\%20\%3Fdecimal\%29\%0A\%20\%20\%28xsd\%3Adecimal\%28\%3FdefaultMapping\%29\%20\%21\%3D\%20\%3FcustomMapping\%20AS\%20\%3Fdistorted\%29\%0AWHERE\%20\%7B\%0A\%20\%20VALUES\%20\%3Flexical\%20\%7B\%2210\%22\%20\%221\%22\%20\%220.1\%22\%20\%220.5\%22\%7D\%0A\%20\%20BIND\%28STRDT\%28\%3Flexical\%2C\%20xsd\%3Afloat\%29\%20AS\%20\%3FdefaultMapping\%29\%0A\%20\%20BIND\%28STRDT\%28\%3Flexical\%2C\%20xsd\%3Adecimal\%29\%20AS\%20\%3FcustomMapping\%29\%0A\%7D}{\ttfamily
http://query.wikidata.org}.}

\label{fig_detection}

\end{figure}

##  6 Datatype Usage Survey

To determine the practical relevancy of the described problems, we conducted a
survey of the actual usage of datatypes. The survey is based on the September
2020 edition121212http://webdatacommons.org/structureddata/#results-2020-1 of
the Web Data Commons dataset [21]. The Web Data Commons dataset provides in
several N-Quads files the embedded RDF data of $1.7109$ HTML documents
extracted from all $3.4109$ HTML documents contained in the September 2020
Common Crawl
archive.131313https://commoncrawl.org/2020/10/september-2020-crawl-archive-
now-available/ The September 2020 Web Data Commons dataset is divided into
data extracted from embedded JSON-LD, RDFa, Microdata, and several
Microformats. We only considered data from embedded JSON-LD ( $7.7108$ URLs,
$3.21010$ triples) and RDFa ( $4.1108$ URLs, $5.9109$ triples), as Microdata
and Microformats do not incorporate explicit datatypes.

We created a Java program based on Apache Jena9 to stream and analyze the
relevant parts of the Web Data Commons dataset. The dataset replicates
malformed IRIs or literals as they appeared in the original source. To avoid
parsing failures of whole files due to single malformed statements, each line
was parsed independently. These failures were logged in a separate result
table. The main reasons for failures were malformed IRIs and illegal character
encodings. Transaction mechanisms were used to ensure the consistency of the
resulting dataset in case of temporary failures of involved systems. Per
source type, dataset file, property, and datatype we measured:

  * •

UnpreciseRepresentableInDouble: The number of lexicals that are in the lexical
space but not in the value space of xsd:double.

  * •

UnpreciseRepresentableInFloat: The number of lexicals that are in the lexical
space but not in the value space of xsd:float.

  * •

UsedAsDatatype: The total number of literals with the datatype.

  * •

UsedAsPropertyRange: The number of statements that specify the datatype as
range of the property.

  * •

ValidDecimalNotation: The number of lexicals that represent a number with
decimal notation and whose lexical representation is thereby in the lexical
space of xsd:decimal, xsd:float, and xsd:double.

  * •

ValidExponentialNotation: The number of lexicals that represent a number with
exponential notation and whose lexical representation is thereby in the
lexical space of xsd:float, and xsd:double.

  * •

ValidInfOrNaNNotation: The number of lexicals that equals either INF, +INF,
-INF or NaN and whose lexical representation is thereby in the lexical space
of xsd:float, and xsd:double.

  * •

ValidIntegerNotation: The number of lexicals that represent an integer number
and whose lexical representation is thereby in the lexical space of
xsd:integer, xsd:decimal, xsd:float, and xsd:double.

Unfortunately, the lexical representation of xsd:double literals from embedded
JSON-LD was normalized during the creation of the Web Data Commons dataset to
always uses exponential notation with one integer digit and up to 16
fractional digits.141414https://github.com/jsonld-java/jsonld-
java/blob/v0.13.1/core/src/main/java/com/github/jsonldjava/core/RDFDataset.java#L673
This is a legal transformation according to the definition of xsd:double, as
the represented value is preserved. However, this limits the use of the
according Valid… and Unprecise… measures. At the same time, this demonstrates,
that the use of xsd:float or xsd:double might easily cause the loss of
information reflected only in the lexical representation by legal
transformations during the processing.

The resulting dataset consist of two CSV files containing the measurement
results ($5.4107$ lines, $0.6\text{\,}\mathrm{GiB}$ compressed,
$11.0\text{\,}\mathrm{GiB}$ uncompressed) and the parsing failure log
($4.5107$ lines, $0.5\text{\,}\mathrm{GiB}$ compressed,
$9.7\text{\,}\mathrm{GiB}$ uncompressed). The analysis was conducted with
python scripts. The tool [22], the resulting dataset [23], and the analysis
scripts [24] are freely available for review and further use under permissive
licenses.

For the analysis, we first applied some data cleaning: Some properties and
datatypes where regularly denoted by IRIs in the http scheme as well as in the
https scheme. To enable proper aggregation, the scheme of all IRIs in the
dataset were unified to http. Further, the omission of namespace definitions
in the source websites causes the occurrence of prefixed names instead of full
IRIs. All prefixes in datatypes that occurred at least for one datatype more
than 1000 times and whose namespace was obvious, have been replaced with the
actual namespace. In the same way, all prefixes in properties that occurred at
least for one property more than 1000 times and whose namespace was obvious,
have been replaced with the actual namespace. We did not clean further kinds
of typos, like, for example, missing or duplicated # or / after the namespace.

For the results presentation, we use the following prefixes to abbreviate
IRIs:
dcterms: http://purl.org/dc/terms/ dv: http://rdf.data-vocabulary.org/# gr:
http://purl.org/goodrelations/v1# rev: http://purl.org/stuff/rev# rdf:
http://www.w3.org/1999/02/22-rdf-syntax-ns# schema: http://schema.org/ use:
http://search.yahoo.com/searchmonkey-datatype/use/ vcard:
http://www.w3.org/2006/vcard/ns# xsd: http://www.w3.org/2001/XMLSchema#

Table 1: The number of datatype occurrences in the Web Data Commons September
2020 dataset from RDFa and embedded JSON-LD sources in absolute numbers and
relative to the total number of literals in the source type. Only the top 10,
as well as selected further datatypes are shown.

RDFa
---
Datatype | Occurrences (rel)
rdf:langString |  $3\,179\,161\,585$ (.68)
xsd:string |  $1\,305\,371\,136$ (.28)
xsd:dateTime |  $102\,987\,223$ (.02)
rdf:XMLLiteral |  $62\,337\,177$ (.01)
xsd:integer |  $21\,547\,053$ (.00)
xsd:float |  $1\,025\,753$ (.00)
use:sku |  $729\,858$ (.00)
xsd:date |  $507\,454$ (.00)
xsd:boolean |  $348\,334$ (.00)
schema:Date |  $246\,995$ (.00)
xsd:decimal |  $8288$ (.00)
xsd:double |  $234$ (.00)
schema:Number |  $0$ (.00)
schema:Integer |  $0$ (.00)
schema:Float |  $0$ (.00)

Embedded JSON-LD
---
Datatype | Occurrences (rel)
xsd:string |  $11\,277\,500\,571$ (.76)
xsd:integer |  $2\,021\,243\,795$ (.14)
schema:Date |  $1\,313\,408\,439$ (.09)
xsd:double |  $101\,959\,406$ (.01)
xsd:boolean |  $26\,144\,338$ (.00)
schema:DateTime |  $25\,002\,464$ (.00)
rdf:langString |  $12\,934\,431$ (.00)
xsd:float |  $90\,895$ (.00)
xsd:dateTime |  $12\,260$ (.00)
rdf:HTML |  $5785$ (.00)
xsd:decimal |  $1$ (.00)
schema:Number |  $0$ (.00)
schema:Integer |  $0$ (.00)
schema:Float |  $0$ (.00)

Table 2: The number of property occurrences with XSD or schema.org numerical
datatypes in the Web Data Commons September 2020 dataset from RDFa and
embedded JSON-LD sources in absolute numbers and relative to the total number
of numeric literals in the source type. Only the top 10 are shown.

RDFa
---
Property | Occurrences (rel)
sioc:num_replies |  $21\,391\,187$ (.95)
gr:hasCurrencyValue |  $525\,491$ (.02)
gr:hasMinValue |  $137\,018$ (.01)
gr:amountOfThisGood |  $94\,978$ (.00)
gr:hasMaxValue |  $52\,772$ (.00)
vcard:latitude |  $49\,428$ (.00)
vcard:longitude |  $49\,428$ (.00)
gr:hasValue |  $25\,800$ (.00)
dv:count |  $24\,672$ (.00)
dv:price |  $23\,936$ (.00)

Embedded JSON-LD
---
Property | Occurrences (rel)
schema:position |  $893\,910\,601$ (.42)
schema:width |  $448\,036\,253$ (.21)
schema:height |  $446\,308\,779$ (.21)
schema:price |  $71\,045\,655$ (.03)
schema:commentCount |  $65\,723\,049$ (.03)
schema:ratingValue |  $26\,261\,677$ (.01)
schema:longitude |  $17\,096\,852$ (.01)
schema:latitude |  $17\,093\,196$ (.01)
schema:bestRating |  $16\,333\,042$ (.01)
schema:userInteractionCount |  $13\,347\,182$ (.01)

Overall, we processed $14\,778\,325\,375$ literals from embedded JSON-LD and
$4\,674\,734\,966$ literals from RDFa. Table 1 shows the number of occurrences
of the most frequent datatypes. Table 2 shows the most frequently used
properties that occurred with numerical datatypes from XSD or schema.org.
Although the use of the schema.org numeric datatypes instead of XSD numeric
datatypes is expected by the definition of many schema.org properties,
including widely used properties, like, for example, schema:position or
schema:price, we did find zero occurrences of schema.org numeric datatypes. In
contrast, the usage of schema.org temporal datatypes schema:Date and
schema:DateTime in JSON-LD exceeds the usage of XSD temporal datatypes by
orders of magnitude. The most probable reason for this is the existence of
shorthand syntaxes for XSD numeric datatypes. This emphasizes the importance
of shorthand syntaxes for the choice of datatypes.

As shown in Table 1, the occurrences of xsd:float in RDFa and xsd:double in
embedded JSON-LD surpass the occurrences of xsd:decimal by orders of
magnitude. Remarkably, we did find only one single
occurrence151515https://web.archive.org/web/20200919100939/https://open.nrw/dataset/telefonverzeichnis-
alphabetisch-oktober-2019-odp of xsd:decimal among $14\,778\,325\,375$
literals from valid triples in embedded JSON-LD sources in the whole Web Data
Commons September 2020 dataset. Table 3 shows properties that most frequently
occurred with xsd:float in RDFa and with xsd:double in embedded JSON-LD. Based
on these figures, at least $62\text{\,}\%$ for xsd:float in RDFa and
$54\text{\,}\%$ for xsd:double in embedded JSON-LD represent (monetary)
amounts, position numbers or single rating values, which are not initially
binary floating point values. At least $33\text{\,}\%$ for xsd:float in RDFa
and $35\text{\,}\%$ for xsd:double in embedded JSON-LD represent geolocation
values, arbitrary quantity values or aggregated values, which might but do not
need to origin from initially binary floating point values. rev:rating and
schema:ratingValue cannot be assigned unambiguously to these categories. This
shows, binary floating point numbers are regularly used for not initially
binary floating point values.

As expected, because embedded RDF is not the proper place for vocabulary
definitions, we found only few cases of property range definitions. They are
limited to 54 unique property-datatype-pairs with two to 153 occurrences and
for properties from only five different namespaces. This does not allow to
draw further conclusions.

Table 3: The number of property occurrences with xsd:float in RDFa and with
xsd:double in embedded JSON-LD in the Web Data Commons September 2020 dataset
in absolute numbers and relative to the total number of literals with the same
datatype in the same source type. Only the top 10 are shown.

xsd:float in RDFa
---
Property | Occurrences (rel)
gr:hasCurrencyValue |  $516\,256$ (.50)
gr:hasMinValue |  $134\,954$ (.13)
gr:amountOfThisGood |  $94\,978$ (.09)
gr:hasMaxValue |  $52\,772$ (.05)
vcard:latitude |  $49\,428$ (.05)
vcard:longitude |  $49\,428$ (.05)
gr:hasValue |  $25\,800$ (.03)
dv:price |  $23\,086$ (.02)
dv:average |  $21\,038$ (.02)
rev:rating |  $20\,970$ (.02)

xsd:double in Embedded JSON-LD
---
Property | Occurrences (rel)
schema:price |  $49\,740\,982$ (.49)
schema:longitude |  $17\,055\,600$ (.17)
schema:latitude |  $17\,053\,362$ (.17)
schema:ratingValue |  $9\,928\,412$ (.10)
schema:lowPrice |  $2\,240\,110$ (.02)
schema:highPrice |  $1\,840\,080$ (.02)
schema:value |  $1\,776\,255$ (.02)
schema:worstRating |  $311\,374$ (.00)
schema:position |  $240\,577$ (.00)
schema:minPrice |  $197\,850$ (.00)

Table 4: The number of numeric notations occurrences in the lexical
representation of literals per numeric datatype in the Web Data Commons
September 2020 dataset in absolute numbers and relative to the total number of
literals with the same datatype. The notation of xsd:double in embedded JSON-
LD was normalized during the dataset generation.

Embedded JSON-LD
---
| Notation
Datatype | Integer | Decimal | Exponential | Inf / NaN
xsd:decimal |  $0$ (.00) |  $1$ (.01) |  $0$ (.00) |  $0$ (.0)
xsd:double |  $0$ (.00) |  $0$ (.00) |  $101\,959\,382$ (.01) |  $24$ (.0)
xsd:float |  $35\,951$ (.40) |  $24\,837$ (.27) |  $4252$ (.05) |  $0$ (.0)
xsd:integer |  $2\,021\,243\,613$ (.01) |  $0$ (.00) |  $0$ (.00) |  $0$ (.0)
xsd:long |  $36$ (.01) |  $0$ (.00) |  $0$ (.00) |  $0$ (.0)

RDFa
---
| Notation
Datatype | Integer | Decimal | Exponential | Inf / NaN
xsd:decimal |  $89$ (.01) |  $7349$ (.89) |  $0$ (.00) |  $0$ (.0)
xsd:double |  $26$ (.11) |  $208$ (.89) |  $0$ (.00) |  $0$ (.0)
xsd:float |  $353\,851$ (.34) |  $643\,206$ (.63) |  $0$ (.00) |  $4$ (.0)
xsd:int |  $16\,751$ (.86) |  $0$ (.00) |  $0$ (.00) |  $0$ (.0)
xsd:integer |  $21\,507\,446$ (.01) |  $38$ (.00) |  $0$ (.00) |  $0$ (.0)
xsd:nonNegativeInteger |  $585$ (.01) |  $0$ (.00) |  $0$ (.00) |  $0$ (.0)
xsd:positiveInteger |  $6$ (.01) |  $0$ (.00) |  $0$ (.00) |  $0$ (.0)

Table 5: The number of lexical representation occurrences without exact representation in the value space of xsd:float and xsd:double per numeric datatype in the Web Data Commons September 2020 dataset in absolute numbers and relative to the total number of literals with the same datatype. The notation of xsd:double in embedded JSON-LD was normalized during the dataset generation. | Embedded JSON-LD | RDFa
---|---|---
| Unprecise In
Datatype | xsd:float | xsd:double | xsd:float | xsd:double
xsd:decimal |  $0$ (.00) |  $0$ (.00) |  $3087$ (.37) |  $3087$ (.37)
xsd:double |  $69\,648\,087$ (.68) |  $69\,646\,819$ (.68) |  $58$ (.25) |  $58$ (.25)
xsd:float |  $21\,750$ (.24) |  $21\,750$ (.24) |  $339\,583$ (.33) |  $338\,676$ (.33)
xsd:int | - | - |  $0$ (.00) |  $0$ (.00)
xsd:integer |  $7\,564\,635$ (.00) |  $996$ (.00) |  $1492$ (.00) |  $38$ (.00)
xsd:long |  $2$ (.06) |  $0$ (.00) | - | -
xsd:nonNegativeInteger | - | - |  $136$ (.23) |  $0$ (.00)
xsd:positiveInteger | - | - |  $0$ (.00) |  $0$ (.00)

Table 4 shows the number of occurrences of different notations. Except of
xsd:double in embedded JSON-LD, which is affected by normalization,
exponential notation is only little used in the binary floating point
datatypes. Special values occurred only in even more rare cases. From that, we
conclude, that the notation or needed special values are not the crucial
consideration behind using binary floating point datatypes.

Table 5 shows the number of lexical representations that are not precisely
representable in binary floating point datatypes. $33\text{\,}\%$ of the
represented xsd:float values in RDFa and $24\text{\,}\%$ in embedded JSON-LD
differ from lexical representations. In embedded JSON-LD the initial lexical
representation of $69\text{\,}\%$ of the xsd:double values must either have
contained more then 17 significant digits or already been differing from the
represented value. Referring to the most common properties used with
xsd:double in embedded JSON-LD, shown in Table 3, the frequent occurrence of
values with more then 17 significant digits is implausible. All together, this
shows that $29\text{\,}\%$–$68\text{\,}\%$ of the values with binary floating
point datatype in real web data are distorted due to the datatype.

##  7 Conclusion

Binary floating point numbers are meant to approximate decimal values to
reduce memory consumption and increase computation speed. However, in RDF,
decimals are used to approximate binary floating point numbers. This way, the
use of binary floating point datatypes in RDF produces ambiguity in
represented knowledge and restricts the choice of the arithmetic in standards
compliant implementations. Its use can systematically impair the quality of
data and falsify the results of data processing. This can cause serious
impacts in real world applications.

A radical solution to remove ambiguity and restrictions on the choice of the
arithmetic in standard compliant implementations, and that does not require to
update existing data, would be the deprecation and replacement of xsd:float
and xsd:double with an extended mandatory xsd:decimal datatype in RDF. The
extended xsd:decimal datatype should additionally permit exponential notation
and the special values positiveInfinity, negativeInfinity, and notANumber, to
cover the whole lexical space and value space of xsd:float and xsd:double. It
should also become the default datatype in the different serialization and
query languages for numbers in decimal and exponential notation and be used
for interpretation instead of the old deprecated datatypes, if these are used
in existing data. One or several additional new datatypes with hexadecimal
lexical representations should be used for the actual representation of binary
floating point values. However, this radical solution would once make a
decision for existing data in favor of the verbatim interpretation of the
lexical representation.

A more cautious mitigation of the problem should tackle the disadvantages of
xsd:decimal: It would be desirable to introduce in RDF mandatory support for
(a) an exponential notation for the decimal datatype, and (b) a decimal
datatype that supports infinite values, like precisionDecimal, to eliminate
these disadvantages. Further, binary floating point datatypes should only be
used for numeric values if (a) a representation of infinity is required, or
(b) the original source provides binary floating point values. In general,
xsd:decimal must become the first choice for the representation of numbers.
Semantic Web teaching materials should clearly name the disadvantages of the
binary floating point datatypes, shorthand syntaxes should in future
prioritize the decimal datatype, and Semantic Web tools should hint to use
xsd:decimal.

###  7.0.1 Acknowledgments.

Many thanks to Alsayed Algergawy, Sheeba Samuel, Sirko Schindler, Eberhard
Zehendner, and the first author’s supervisor Birgitta König-Ries, as well as 5
anonymous reviewers for very helpful comments on earlier drafts of this
manuscript.

###  7.0.2 Author Contributions.

Study conception and design, analysis and interpretation of results, and draft
manuscript preparation were performed by Jan Martin Keil. Data collection was
performed by Merle Gänßinger and Jan Martin Keil. All authors read and
approved the final manuscript.

## References

  * [1] “W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes”, 2012  URL: http://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/
  * [2] “RDF 1.1 Concepts and Abstract Syntax”, 2014  URL: http://www.w3.org/TR/2014/REC-rdf11-concepts-20140225/
  * [3] Natalya F. Noy and Deborah L. McGuinness  “Ontology Development 101: A Guide to Creating Your First Ontology”, 2001  URL: http://www.ksl.stanford.edu/people/dlm/papers/ontology-tutorial-noy-mcguinness-abstract.html
  * [4] “XML Schema Datatypes in RDF and OWL”, 2006  URL: https://www.w3.org/TR/2006/NOTE-swbp-xsch-datatypes-20060314/
  * [5] “Patriot Missile Defense: Software Problem Led to System Failure at Dhahran, Saudi Arabia”, 1992  URL: https://www.gao.gov/products/IMTEC-92-26
  * [6] IEEE  “IEEE 754-2008 Standard for Floating-Point Arithmetic”  IEEE, 2008  DOI: 10.1109/IEEESTD.2008.4610935
  * [7] David Beckett, Tim Berners-Lee, Eric Prud’hommeaux and Gavin Carothers  “RDF 1.1 Turtle: Terse RDF Triple Language”, 2014  URL: https://www.w3.org/TR/2014/REC-turtle-20140225/
  * [8] Chris Bizer and Richard Cyganiak  “RDF 1.1 TriG: RDF Dataset Language”, 2014  URL: https://www.w3.org/TR/2014/REC-trig-20140225/
  * [9] “SPARQL 1.1 Query Language”, 2013  URL: https://www.w3.org/TR/2013/REC-sparql11-query-20130321/
  * [10] Manu Sporny et al.  “JSON-LD 1.1: A JSON-based Serialization for Linked Data”, 2020  URL: https://www.w3.org/TR/2020/REC-json-ld11-20200716/
  * [11] “RDF 1.1 XML Syntax”, 2014  URL: https://www.w3.org/TR/2014/REC-rdf-syntax-grammar-20140225/
  * [12] David Beckett  “RDF 1.1 N-Triples: A line-based syntax for an RDF graph”, 2014  URL: https://www.w3.org/TR/2014/REC-n-triples-20140225/
  * [13] “RDF 1.1 N-Quads: A line-based syntax for RDF datasets”, 2014  URL: https://www.w3.org/TR/2014/REC-n-quads-20140225/
  * [14] “RDFa Core 1.1 - Third Edition: Syntax and processing rules for embedding RDF through attributes”, 2015  URL: https://www.w3.org/TR/2015/REC-rdfa-core-20150317/
  * [15] “An XSD datatype for IEEE floating-point decimal”, 2011  URL: https://www.w3.org/TR/2011/NOTE-xsd-precisionDecimal-20110609/
  * [16] W3C XML Schema Working Group  “RQ-28 Allow scientific notation for decimals (scientific-notn)”, 2006  URL: https://www.w3.org/Bugs/Public/show_bug.cgi?id=2853
  * [17] “W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes”, 2012  URL: https://www.w3.org/TR/2011/CR-xmlschema11-2-20110721/
  * [18] “International Vocabulary of Metrology”, 2012  Joint Committee for Guides in Metrology
  * [19] Arnold Neumaier  “Introduction to Numerical Analysis”  Cambridge University Press, 2012
  * [20] Marı́a Poveda-Villalón, Asunción Gómez-Pérez and Mari Carmen Suárez-Figueroa  “OOPS! (OntOlogy Pitfall Scanner!): An On-line Tool for Ontology Evaluation”  In _International Journal on Semantic Web and Information Systems_ 10.2 IGI Global, 2014, pp. 7–34  DOI: 10.4018/ijswis.2014040102
  * [21] Robert Meusel, Petar Petrovski and Christian Bizer  “The WebDataCommons Microdata, RDFa and Microformat Dataset Series”  In _The Semantic Web - ISWC 2014 - 13th International Semantic Web Conference, Riva del Garda, Italy, October 19-23, 2014. Proceedings, Part I_ 8796, Lecture Notes in Computer Science  Springer, 2014, pp. 277–292  DOI: 10.1007/978-3-319-11964-9˙18
  * [22] Merle Gänßinger and Jan Martin Keil  “RDF Property and Datatype Usage Scanner v1.0.0”, 2021  DOI: 10.5281/zenodo.6258887
  * [23] Jan Martin Keil and Merle Gänßinger  “Web Data Commons (December 2020) Property and Datatype Usage Dataset”, 2022  DOI: 10.5281/zenodo.6205111
  * [24] Jan Martin Keil  “Web Data Commons (December 2020) Property and Datatype Usage Analysis Scripts”, 2022  DOI: 10.5281/zenodo.6264286

  *[XSD]: XML Schema
  *[RDF]: Resource Description Framework
  *[W3C]: World Wide Web Consortium
  *[SPARQL]: SPARQL Protocol And RDF Query Language


# Infection dynamics of COVID-19 virus under lockdown and reopening

Jakub Svoboda  IST Austria, A-3400 Klosterneuburg, Austria  Josef Tkadlec
Department of Mathematics, Department of Organismic and Evolutionary Biology,
Harvard University, Cambridge, MA 02138, USA  Andreas Pavlogiannis  Department
of Computer Science, Aarhus University, Aabogade 34, 8200 Aarhus, Denmark
Krishnendu Chatterjee  IST Austria, A-3400 Klosterneuburg, Austria  Martin A.
Nowak  Department of Mathematics, Department of Organismic and Evolutionary
Biology, Harvard University, Cambridge, MA 02138, USA

###### Abstract

Motivated by COVID-19, we develop and analyze a simple stochastic model for a
disease spread in human population. We track how the number of infected and
critically ill people develops over time in order to estimate the demand that
is imposed on the hospital system. To keep this demand under control, we
consider a class of simple policies for slowing down and reopening the society
and we compare their efficiency in mitigating the spread of the virus from
several different points of view. We find that in order to avoid overwhelming
of the hospital system, a policy must impose a harsh lockdown or it must react
swiftly (or both). While reacting swiftly is universally beneficial, being
harsh pays off only when the country is patient about reopening and when the
neighboring countries coordinate their mitigation efforts. Our work highlights
the importance of acting decisively when closing down and the importance of
patience and coordination between neighboring countries when reopening.

##  1 Introduction

Severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2) is the virus that
causes the current pandemic of coronavirus disease 2019 (COVID-19). The
infection was first identified in December 2019 in Wuhan (China) and has since
spread globally. By the end of 2020 more than 80 million people have been
tested positive for the virus and more than 1.7 million people have died from
complications caused by the infection. The large majority of cases result in
recovery after mild or no symptoms. The coronavirus pandemic has led to an
unprecedented global response in quarantine measurements, social distancing,
travel restrictions and shutting down of economic activity.

The use of mathematics in the study of dynamics of infectious diseases has a
long tradition. [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] Mathematical
epidemiology was immediately applied to the coronavirus pandemic [14, 15, 16],
resulting in an immense amount of literature on the subject. As a quick
sample, there is ample work on understanding how the disease progresses within
an individual [17, 18, 19], how it spreads through the community [20, 21, 22,
23, 24, 25, 26], and on the effects of varisou non-pharmaceutical
interventions under varying circumstances [27, 28, 29, 30, 31, 32]. In
contrast, in this work we focus on a simple class of policies for closing down
and reopening the society throughout the course of a pandemic, thereby
complementing the rich literature on covid modelling.

We consider infection dynamics of coronavirus in a population of size $N$. The
population represents a community (city, state, or a country). Initially all
people are uninfected. Then we add one (or several) infected individuals and
follow the stochastic trajectories of viral spread. The process advances in
discrete time steps which represent days. Individuals are in different states
describing their status of being: susceptible (S), exposed/incubating (E),
mildly ill/infectious (I), critically ill (C), and recovered/removed (R), see
Figure 1a. We assume that critical cases are hospitalized. The infection
spreads whenever a susceptible person comes in contact with an infectious
person. In this case the infection is transmitted with probability $p$ (see
Figure 1b). We denote the number of daily contacts per person by $k_{0}$.

We assume that the community has a capacity $c$ of hospital beds to treat the
critical cases. When left unregulated, the disease would surge through the
community and exceed that capacity $c$ (see Figure 1c). A country can mitigate
the spread of the disease by introducing various non-pharmaceutical
interventions, such as enforcing social distancing or shutting down non-
essential businesses. We model such interventions by decreasing the number
$k_{0}$ of daily contacts of an individual to a value $k<k_{0}$. We call the
regime when the interventions are put in place a lockdown.

Here we study the key question of how quickly and how severely a community
should lock down, and how patient it should be before reopening again. To that
end, we consider a simple class of policies characterized by three parameters
$\tau$, $k$, $d$. The parameter $\tau$ is the number of critical cases that
triggers the community to enter the lockdown. It models the cautiousness or
agility of the policy. The parameter $k$ is the number of daily contacts per
person in a lockdown. It models the severity of the policy. Finally, the
parameter $d$ is the number of days the community needs to spend with critical
cases below the trigger threshold $\tau$ before the lockdown is lifted. It
models the patience of the policy. In other words, a policy $P(k,\tau,d)$
locks down to $k<k_{0}$ daily contacts per person once the number of
critically ill individuals exceeds a given trigger threshold $\tau$, and it
reopens to $k_{0}$ daily contacts once the number of critically ill
individuals remains under that threshold $\tau$ for $d$ consecutive days. We
evaluate the performance of such policies with respect to several measures.
For instance, we consider the peak load $C_{\textrm{max}}$, which is the
expected number of critical cases at its maximum, and the overflow probability
$p_{\text{fail}}$, which is the probability that the peak load
$C_{\textrm{max}}$ exceeds the hospital bed capacity $c$ available to treat
the critically ill cases.

We find that the best performing policies are those that quickly transition to
a severe lockdown and that are patient about reopening. However, when either
quick or severe action is not feasible, as is often the case, a country can
compensate by pressing more along the other dimension. This gives rise to a
spectrum of possible policies for closing down and reopening the society. At
one end of this spectrum, a moderate low-trigger policy ($P_{\mathit{ML}}$)
imposes a gentle lockdown at the first sign of the onset of the disease. At
the other end, a severe high-trigger policy ($P_{\mathit{SH}}$) remains open
till the latest moment possible and then imposes a harsh lockdown. We find
that, though comparable in some regards, those two policies are very different
in terms of their long-term behavior and in terms of their sensitivity to
policies employed by neighboring countries. Specifically, we argue that the
moderate low-trigger policies are preferable assuming that the countries are
able to coordinate and that an efficient vaccine is not distributed soon,
whereas the severe high-trigger policies are preferable otherwise.

##  2 Model

In order to describe the spread of COVID-19, we consider a stochastic,
discrete-time, individual-based SIR-like model.

Disease progression within an individual. Initially, a typical individual is
susceptible (S) and can contract the disease after contact with an infectious
individual (see Figure 1a). Immediately upon contracting the disease, an
individual becomes exposed/incubating (E) and does not yet spread it. Later
they become infectious (I) as they develop mild condition and then they either
recover (R) or become critically ill (C). Critical individuals are
hospitalized, isolated and they occupy part of the capacity $c$ of the health
system. Eventually they either recover or die (R). We assume that recovered
individuals acquire immunity. Upon contracting the disease, each transition
occurs after a number of days that is given by a corresponding random variable
$X_{E\to I}$, $X_{I\to R}$, $X_{I\to C}$, $X_{C\to R}$. For concreteness, we
set the values based on the data on COVID-19: [17, 18, 19, 20, 33, 34, 35] The
incubation period is $X_{E\to I}=2$ days and the individual recovers from a
mild condition upon $X_{I\to R}=10$ days. During each of those 10 days, an
individual might become critically ill with probability $1\,\%$ (hence
$X_{I\to C}$ is exponentially distributed with parameter $1\,\%$ and roughly
10 % of cases become critical). The critical cases recover (or die) after
$X_{C\to R}=10$ more days.

Disease spread through the population. We consider a population of $N$
individuals. Each day, each individual comes in contact with $k_{0}$ other
individuals (see Figure 1b). When a susceptible individual (S) meets an
infectious individual (I), he or she contracts the disease with transmission
probability $p$ and becomes incubating (E). We denote the number of critically
ill individuals at day $t$ by $C(t)$ and use analogous notation for other
conditions. For concreteness [36, 37, 38] we consider the population of
$N=20\,000$ individuals, the health system capacity of 2.8 beds per 1 000
individuals leading to $c=56$ beds in total, $k_{0}=15$ daily interactions per
person, and the transmission probability $p=2\,\%$. All in all, this gives the
epidemiological basic reproductive ratio $R_{0}$ equal to roughly
$R_{0}=k\cdot p\cdot X_{M\to R}=2.9.$

Policies. We consider a 3-parameter class of policies that a country can use
to mitigate the spread of the disease. The policies toggle between two regimes
– the default open regime and the temporary lockdown regime (see Figure 2a).
The policy $P(\tau,k,d)$ can be efficiently described using three parameters
$\tau$, $k$, $d$ that describe how soon and severely the policy locks down,
and how soon it reopens:

  1. 1.

Once the number $C(t)$ of critically ill cases exceeds the trigger threshold
$\tau$, the policy locks down by reducing the number of daily contacts per
person from $k_{0}$ to $k$.

  2. 2.

Once the number $C(t)$ of critically ill cases remains under the trigger
threshold $\tau$ for $d$ consecutive days, the policy reopens by resetting the
number of daily contacts per person back to $k_{0}$.

The three parameters $\tau$, $k$, $d$ thus model three natural features of the
policy: its “cautiousness”, that is, how easily it is triggered into a
lockdown; the “severity” of its lockdowns; and its “patience” when reopening,
respectively. We remark that we chose the number of critically ill people
$C(t)$ rather than the number of infectious people $I(t)$ since the latter is
not so easily accessible to policymakers.

Performance of the policy. In order to evaluate the performance of a policy,
we study the following quantities:

  1. 1.

The (expected) peak load $C_{\textrm{max}}$: That is, the expected number
$C_{\textrm{max}}=\mathbb{E}[\max\\{C(t)\mid t\geq 0\\}]$ of critically ill
people at their maximum, over the duration of the disease. This represents the
maximum demand on the health system (hospital beds).

  2. 2.

The overflow probability $p_{\text{fail}}$: That is, the probability
$p_{\text{fail}}=\Pr[C_{\textrm{max}}>c]$ of exceeding the available bed
capacity $c$ at some point throughout the course of the disease.

  3. 3.

The total load $C_{\textrm{all}}$: That is, the total cumulative number of
critical cases, over the duration of the disease. This can be used to estimate
the total number of deaths.

  4. 4.

The total (expected) duration $D$ of the lockdown: That is, the total expected
number of days spent in the lockdown regime until the disease is eradicated.

In all cases, the lower the quantity the better the policy. Hence we can think
of all the quantities as costs of the policy. We note that the first three
quantities can be viewed as costs related to health of the population. The
fourth quantity can be viewed as an economic cost of imposing a lockdown of a
given severity, since a lockdown reduces the economic activity of a community.

##  3 Results

We evaluate the performance of the above defined policies – first for a single
country, later for two neighboring countries. Recall that a policy
$P(\tau,k,d)$ is given by three parameters: The threshold number of critical
cases $\tau$ that triggers the policy to toggle to lockdown and back (“trigger
value”); the number $k$ of daily contacts per person during a lockdown
(“severity”); and the number $d$ of days required to remain below the trigger
threshold $\tau$ before the society can reopen (“patience”), see Figure 2a.

Four example policies. To illustrate the differences in performance of various
policies, we first consider four specific policies that all share the patience
parameter $d=10$ days and that differ in the trigger value $\tau$ and in the
severity $k$ (see Figure 2b). Specifically, in terms of the trigger value
$\tau$, we distinguish low-trigger policies ($\tau_{\operatorname{low}}=3$)
from high-trigger policies $(\tau_{\operatorname{high}}=12)$. Similarly, in
terms of the number $k$ of daily contacts in a lockdown, we distinguish severe
policies $(k_{\operatorname{low}}=1.25)$ from moderate policies
$(k_{\operatorname{high}}=6)$. All in all, this yields $2\times 2=4$
combinations $P_{\mathit{SL}}$ (severe, low-trigger), $P_{\mathit{SH}}$
(severe, high-trigger), $P_{\mathit{ML}}$ (moderate, low-trigger), and
$P_{\mathit{MH}}$ (moderate, high-trigger). We observe that the policies
substantially alter how the number of infected and critical cases evolves in
time (see Figure 2c).

To explain the difference, it is instructive to think in terms of the
epidemiological $R_{0}$ that determines whether the number of infected
individuals in a population is quickly surging ($R_{0}>1$), disappearing
($R_{0}<1$) or changing slowly ($R_{0}\approx 1$). Note that $R_{0}$ is not
constant in time – it crucially depends on the current number $k$ of daily
contacts ($R_{0}$ decreases as $k$ decreases) and also on the percentage $x$
of immune individuals ($R_{0}$ decreases as $x$ increases). In the open
society ($k$ large) and with no immune individuals ($x=0$) we have $R_{0}>1$,
hence the disease initially spreads quickly.

Severe policies. Under the two severe policies, the number of cases in time
follows the familiar spikes: Each lockdown is so harsh that as long as it is
in place, we have $R_{0}<1$ even when $x=0$. Therefore, a few days upon
imposing the lockdown (the incubation period) the infected cases rapidly drop,
then the critical cases drop too and the disease can possibly get eradicated
in some communities. This happens over a short period of time and only a few
people acquire immunity ($x\approx 0$). When the trigger
$\tau=\tau_{\operatorname{high}}$ is high, the patience of $d=10$ days is
insufficient to eradicate the disease completely, the lockdown is lifted too
early, a subsequent spike of similar shape is likely, and the whole cycle
repeats several times. When the trigger $\tau=\tau_{\operatorname{low}}$ is
low, waiting for $d=10$ days will typically suffice to eradicate the disease
completely and no subsequent spikes occur.

Moderate policies. Under the two moderate policies, the typical stochastic
trajectories are different. The lockdown is so gentle that when $x=0$, we have
$R_{0}\approx 1$. Hence upon imposing a moderate lockdown, the number of ill
individuals becomes roughly constant in time. But as time goes by and the
individuals progress through the disease stages and acquire immunity ($x>0$),
the value of $R_{0}$ decreases and the disease starts to die out ($R_{0}<1$).
Therefore, compared to the severe policies, the first peak is substantially
broader. (However, the taller it is, the less apparent this distinction is.)
Crucially, if the lockdown is lifted too soon and another outbreak occurs
later, once the same moderate lockdown is imposed again, the immune
subpopulation ($x>0$) causes the disease to die out right away – in fact, it
dies away faster and faster in every subsequent lockdown. Therefore while the
first outbreak might require a long lockdown phase, all subsequent outbreaks
are dealt with promptly. In a sense, when the moderate lockdown is lifted for
the first time, the population had already acquired herd immunity level for
the interaction rate $k$ of the moderate lockdown. This means that when the
lockdown is put in place, the disease does not spread. However, once the
lockdown is lifted and individuals start to interact more frequently, the
disease could start spreading again. For our parameters, when the trigger
$\tau=\tau_{\operatorname{high}}$ is high, the lockdown is not strong enough
and the bed capacity is (slightly) exceeded within the first peak. When the
trigger $\tau=\tau_{\operatorname{low}}$ is low, the critical cases stay
safely below the bed capacity. In both cases, the patience $d=10$ days is
insufficient to completely eradicate the disease and subsequent peaks occur –
all substantially smaller than the first one.

How parameters affect the performance. In order to understand the role of the
three parameters (trigger value $\tau$, severity $k$, patience $d$) on each of
the four performance measures (peak size $C_{\textrm{max}}$, overflow
probability $p_{\text{fail}}$, total number of critical cases
$C_{\textrm{all}}$, lockdown duration $D$), we run exhaustive computer
experiments.

In Figure 3, each row shows a different performance measure ($y$-axis) as a
function of the number $k$ of daily contacts in a lockdown ($x$-axis). The red
dotted vertical line marks the number $k^{\star}$ of daily contacts that
corresponds to $R_{0}=1$ (when there are no immune individuals, $x=0$). Within
each row, the left panel shows policies that have low patience ($d=7$ days)
and the right panel shows policies that have high patience ($d=70$ days).
Within each panel, the blue curve shows the low-trigger policies
($\tau_{\operatorname{low}}=3$) and the green curve shows the high-trigger
policies ($\tau_{\operatorname{high}}=12$).

Recall that for each performance measure, the lower the value, the better the
performance. The effect of the trigger value can be seen by comparing the blue
and the green curve: Since the blue curve is typically lower, low-trigger
policies are generally better than high-trigger policies. The effect of the
lockdown severity can be seen by looking at whether the curves go up or down:
Since they typically go up, severe policies are generally better than moderate
policies. The effect of the patience can be seen by comparing the left and the
right panel: Since the curves in the right panel are typically lower, patient
policies are generally better than impatient policies.

There are two exceptions to those rules, both concerning the lockdown duration
$D$: First, we observe that when $k$ becomes too large, the duration $D$
decreases. This is due to the fact that the lockdown becomes too weak and the
disease quickly sweeps through the whole population. Second, we observe that
when the patience is low and the lockdown is moderate, decreasing the trigger
value $\tau$ actually leads to more time spent in the lockdown.

Key parameters for different regimes. Next, for each performance measure, we
characterize which of the three parameters $\tau$, $k$, $d$ are key to
substantially improving the performance and which of them are marginal.

Let $k^{\star}$ be the number of daily contacts that corresponds to $R_{0}=1$
when there are no immune individuals ($x=0$). For our parameters, we have
$k^{\star}\doteq 5.3~{}$.

Peak size $C_{\textrm{max}}$. We observe that (see Figure 3a):

  1. $\tau$:

The low-trigger policies (blue curve) are consistently better than the high-
trigger policies (green curve).

  2. $k$:

For both trigger values, $C_{\textrm{max}}$ is roughly constant as long as
$k<k^{\star}$ but then it increases rapidly when $k>k^{\star}$.

  3. $d$:

The left and the right panel are comparable.

Hence the important insight is to have the severity below a threshold
($k<k^{\star}$) and to have the trigger $\tau$ low. The effects of the
patience $d$ and the severity $k$ (given that $k<k^{\star}$) are marginal.

The intuitive explanation is that when $k>k^{\star}$, the lockdown is so weak
that the disease still continues to spread, even when the lockdown is put in
place. Hence having $k<k^{\star}$ is key. On the other hand, given that
$k<k^{\star}$, the actual value of $k$ is not that important: When a lockdown
is put in place, the peak size (and the moment when the peak occurs) have
already been essentially determined, since most of the critical cases at the
peak are due to individuals who have already been infected when the lockdown
was put in place. Similarly, the patience $d$ is not that important as it
affects the number of peaks rather than their size. On the other hand, the
trigger value $\tau$ is key: The nature of the exponential growth and the
inherent delay due to incubation and non-critical infection translate the
difference in trigger value $\tau$ to a difference in peak size
$C_{\textrm{max}}$.

Overflow probability $p_{\text{fail}}$. We observe that (see Figure 3b):

  1. $\tau$:

The low-trigger policies (blue curve) are consistently better than the high-
trigger policies (green curve).

  2. $k$:

For low-trigger policies, $p_{\text{fail}}$ exhibits a threshold behavior with
respect to $k$. For high-trigger policies, $p_{\text{fail}}$ increases when
$k<k^{\star}$ and increases rapidly when $k>k^{\star}$.

  3. $d$:

For high-trigger policies (green curve), increasing the patience $d$ decreases
$p_{\text{fail}}$ (when $k<k^{\star}$).

Hence the important insight is, again, to have the severity below a threshold
($k$ below $k^{\star}$ or just very slightly above) and to have the trigger
$\tau$ low. When the trigger $\tau$ is high, both decreasing $k$ and
increasing $d$ help, but even the combined effect is negligible compared to
the effect of having $\tau$ low.

The intuitive explanation is that in large populations, most stochastic
trajectories are qualitatively similar. Hence even though the peak size is a
random variable, it is narrowly concentrated around its average value. Thus
whenever the average peak size $C_{\textrm{max}}$ slightly exceeds the
available bed capacity $c$, the overflow probability is almost 1. And, vice
versa, whenever the average peak size $C_{\textrm{max}}$ is slightly lower
than the available bed capacity $c$, the overflow probability is almost 0. In
a sense, the overflow probability exaggerates the difference between
$C_{\textrm{max}}$ and $c$.

Total critical cases $C_{\textrm{all}}$. We observe that (see Figure 3c):

  1. $\tau$:

When impatient (left panel), the low-trigger policies (blue curve) are
consistently better than the high-trigger policies (green curve).

  2. $k$:

For impatient high-trigger policies (green curve in the left panel),
$C_{\textrm{all}}$ is roughly constant unless $k$ is small.

  3. $d$:

Increasing the patience $d$ decreases $C_{\textrm{all}}$.

Hence the important insight is to have the patience $d$ high. In order to
achieve comparable results with low patience, one has to have a low trigger
$\tau$ and a very severe lockdown.

The intuitive explanation is that high patience $d$ is key because it
decreases the chance of a premature reopening and thereby reduces the number
of times a lockdown has to be put in place. With a sufficiently high patience,
the disease gets eradicated upon completing the first peak. With low patience
$d$ (and thus many peaks), the only way to avoid many critical cases is to
make sure each peak is small. This requires a low trigger value $\tau$ and
severe lockdown $k$ every time the trigger value is reached. As a final
remark, note that when impatient and high-trigger, the lockdowns have to be
extremely severe to help even a little: This is the only way to get at least
some hope that the disease gets eradicated by the short time the lockdown will
be lifted.

Total lockdown duration $D$. Since a severe lock down is very different from a
moderate lockdown, here we focus our comparison on only those lockdowns that
have the same severity. We observe that (see Figure 3d):

  1. $\tau$:

When impatient (left panel), low-trigger policies (blue curve) are better
assuming $k$ is small, otherwise high-trigger policies (green curve) are
better. When patient (right panel), low- and high- trigger policies are
comparable.

  2. $d$:

Increasing the patience $d$ decreases $D$.

Hence, for severe lockdowns ($k<k^{\star}$), the important insight is, again,
to have the patience $d$ high. In those cases, the effect of the trigger value
is marginal.

The intuitive explanation for severe lockdowns of fixed severity $k<k^{\star}$
is that the key to minimizing the total lockdown duration is to minimize the
probability $q$ of a subsequent outbreak (that would occur if the lockdown
were lifted too early). Since in a severe lockdown, the numbers of infected
and incubating individuals decay exponentially ($k<k^{\star}$), there are two
ways to decrease $q$ (and thereby $D$) by a constant factor: Either to
increase the patience by a constant number of days, or to decrease the trigger
value $\tau$ by a constant factor. The former is less costly, hence having
high patience is the single most important aspect.

Summary. Here we summarize three findings from the above paragraphs. First,
any successful policy must impose lockdowns such that restrict the number $k$
of daily contacts under the threshold $k^{\star}$. Second, in terms of
minimizing either the peak size $C_{\textrm{max}}$ or the overflow probability
$p_{\text{fail}}$, it is crucial to employ a policy with low trigger threshold
$\tau$. Third, in terms of minimizing either the total number
$C_{\textrm{all}}$ of critical cases or the lockdown duration $D$, it is
crucial to employ policies with high patience $d$. The precise optimal value
of patience depends on the severity of the lockdown and on the trigger
threshold $\tau$. Generally speaking, moderate policies
($k_{\operatorname{high}}=6$) benefit from patience as large as $d=56$ days (8
weeks). In contrast, for severe policies $(k_{\operatorname{low}}=1.25$), a
patience of 8 weeks gives comparable results to a patience of 4 weeks, see
Figure 4.

Two countries. Some interaction among communities is inevitable. While the
inter-community interaction can be limited by closing borders between
countries and imposing quarantine upon entry, it can not be completely
disregarded. We study how the policies perform in the environment where
different communities might employ different policies.

To model this, we consider two communities Country 1 and Country 2 that
experience the onset of the disease at the same time. Occasionally,
individuals from different countries meet. Namely, we assume that for each
individual, a small portion $q\in(0,1)$ of their interactions are with
individuals in the other country.

We consider two very different policies and study how their performance
depends on the policy employed by the neighboring country and on the
interaction rate $q$ between the two countries (see Figure 5).

Specifically, we consider s moderate low-trigger policy
$P_{\mathit{ML}}=P(\tau=3,k=6,d=54)$ and a severe high-trigger policy
$P_{\mathit{SH}}=P(\tau=12,k=1.25,d=27)$. The parameters $\tau$ and $k$ are
chosen such that both policies have the same probability $10\ \%$ of exceeding
the US hospital bed capacity within their first peak. The parameter $d$ is
chosen such that, on average, $90\ \%$ of the critical cases occur within the
first peak. In other words, the policy reopens when it expects that 90 % of
all the critical cases have already been hospitalized.

When both countries employ the same policy, the performance is essentially the
same as for a larger country employing that policy. Also, in the limit $q\to
0$ the two countries do not interact and the performance of a country is
independent of the policy of the neighbor (this remains true for $q<10^{-5}$).
However, when $q$ is non-negligible, one country uses $P_{\mathit{ML}}$
(“$P_{\mathit{ML}}$-country”) and the other one uses $P_{\mathit{SH}}$
(“$P_{\mathit{SH}}$-country”), the two policies clash. Specifically, we make
the following observations about the overflow probability $p_{\text{fail}}$
and the average peak size $C_{\textrm{max}}$ (see Figure 5):

  1. 1.

For $q$ small, the green curve goes up: Note that the infectious subpopulation
of the neighboring $P_{\mathit{ML}}$-country is non-negligible for an extended
period of time (at least throughout the first broad peak). Thus, as $q$
increases, the individuals in the $P_{\mathit{SH}}$-country get repeatedly
infected due to interactions with the $P_{\mathit{ML}}$-country. Most such new
infections cause a new spike for the $P_{\mathit{SH}}$-country. Each such
spike might exceed the previously largest peak and/or the available capacity.
(Moreover, each such spike leads to new critical cases and it has to be
contained by another lockdown phase so it is costly in terms of
$C_{\textrm{all}}$ and $D$ too.) This effect is visible for interaction rates
as small as $q=10^{-4}$.

  2. 2.

For $q$ large, the blue and green curve go down: Two countries employing
different policies typically reach their peaks at a different point in time.
Thus, when one country is peaking, the other country likely has fewer
infectious individuals and an interaction with that country will help
alleviate the size of the peak in the first country. This, in turn, decreases
the maximum peak load $C_{\textrm{max}}$ and the overflow probability
$p_{\text{fail}}$. This effect is visible roughly for $q>10^{-3}$ (blue
curve), resp. $q>10^{-1}$ (green curve).

  3. 3.

The yellow and the red curves are roughly constant, except that the yellow
curve goes down in terms of the overflow probability when $q$ is large: When
two neighboring countries employ the same policy, the extra occasional mixing
due to interacting individuals makes both countries behave in a slightly more
average way. This does not change the expected size of the peak, hence
$C_{\textrm{max}}$ is constant, regardless of the interaction rate $q$.
However, this process of “averaging out” does make the extreme behavior, such
as overflowing of the available hospital capacity, somewhat less likely. This
effect of diminished overflow probability is observed for two
$P_{\mathit{ML}}$ countries when $q>10^{-2}$.

This leads to an interesting phenomenon resembling a social dilemma. [39, 40]
Consider two countries with a non-negligible interaction rate $q>10^{-3}$.
First, if either of the two countries primarily cares about keeping the
overflow probability low then that country would employ the policy
$P_{\mathit{ML}}$ rather than the policy $P_{\mathit{SH}}$, no matter which
policy the other country is using (indeed blue is below red and yellow is
below green). Second, given that one country uses the policy
$P_{\mathit{ML}}$, the other country will use the policy $P_{\mathit{ML}}$ too
(yellow is below green). In terms of the overflow probability alone, this is
an acceptable outcome (red and yellow are comparable) but in terms of the
total number of critical cases $C_{\textrm{all}}$, this is undesirable: By
employing the policy $P_{\mathit{ML}}$ rather than $P_{\mathit{SH}}$, both
countries increase the total number of their critical cases (and thus,
possibly, deaths) by an order of magnitude.

##  4 Discussion

Motivated by the COVID-19, we studied a simple stochastic model of a disease
progression in a population of interacting individuals. We focused on a
3-parameter family of policies that can be used to mitigate the disease spread
and evaluated the performance of those policies with respect to several
measures, such as the number of critical cases at its maximum or the
probability that this number exceeds the available hospital bed capacity. The
three parameters describing the policies correspond to the agility when
closing down, the severity of the lockdown, and the patience when reopening,
We identified which parameters are important in which regime and explained why
some policies are performing better than others.

We highlight two different types of realistic policies, called moderate low-
trigger ($P_{\mathit{ML}}$) and severe high-trigger ($P_{\mathit{SH}}$). With
both policies, the probability $p_{\text{fail}}$ of ever exceeding the
available hospital beds is kept below a specified threshold (here arbitrarily
set to 10 %), but the two policies are very different: The $P_{\mathit{SH}}$
policy is characterized by imposing a harsh, short lockdown (“severe”) at the
last moment possible (“high-trigger”), whereas the $P_{\mathit{ML}}$ policy is
proactive and imposes gentle, longer lockdowns (“moderate”) at the first
signal of an approaching outbreak (“low-trigger”).

Due to the above differences, both policies have their advantages and
disadvantages. The $P_{\mathit{SH}}$ policy minimizes the total number of
critically ill cases and the total amount of time spent in lockdown. However,
the lockdowns are severe and the society is more susceptible to any subsequent
outbreaks. To avoid such recurring outbreaks, the authorities must be patient
when reopening and any neighboring countries must coordinate when releasing
their measures. The $P_{\mathit{ML}}$ policy maintains its moderate lockdown
for substantially longer but its performance is substantially more robust with
respect to how soon the society reopens and with respect to what policies are
employed by the neighboring countries. Moreover, upon completing the first
lockdown phase, all subsequent lockdowns (if any) are shorter and involve
substantially fewer critical cases than the first phase. Thus the
$P_{\mathit{ML}}$ policy can be seen as minimizing the long-term risks under
the pessimistic scenario that an ultimate long-term solution (such as a
majority of the population being vaccinated) is not achieved any time soon. On
the other hand, the $P_{\mathit{SH}}$ policy is optimistic about the future
and optimizes the short-term performance.

Our setup is intentionally simplified in many regards such as the disease
progression within an individual, the disease spread throughout the
population, and the class of policies we consider for closing down and
reopening. We highlight four possible extensions worth pursuing in subsequent
work: First, regarding the disease progression within an individual, one can
distinguish more types of individuals (e.g. those who require only hospital
beds and those who moreover require ventilation) and lift the assumption that
the individuals acquire lifelong immunity. Second, regarding the disease
spread in a population, one can consider a population structure, e.g.
described by a graph whose edge weights determine the daily pairwise
transmission probabilities. This would allow one to investigate the effects of
localized interventions such as contact tracing. Third, one can consider more
complicated policies, e.g. policies that allow for a gradual reopening or
policies that, when deciding whether and how much to reopen, take into account
additional information, such as the situation in the neighboring countries
and/or the outcomes of testing done earlier. Fourth, on top of considering the
health viewpoint, one can incorporate the economic viewpoint by introducing an
appropriate notion of economic cost of a lockdown of varying degree of
severity.

## References

  * [1] Bernoulli D.  Essai d’une nouvelle analyse de la mortalité causée par la petite vérole, et des avantages de l’inoculation pour la prévenir.  Histoire de l’Acad, Roy Sci(Paris) avec Mem. 1760;p. 1–45.
  * [2] Hamer WH.  Epidemic disease in England: the evidence of variability and of persistency of type.  Bedford Press; 1906.
  * [3] Kermack WO, McKendrick AG.  A contribution to the mathematical theory of epidemics.  Proceedings of the royal society of london Series A, Containing papers of a mathematical and physical character. 1927;115(772):700–721.
  * [4] Bailey NT, et al.  The mathematical theory of infectious diseases and its applications.  Charles Griffin & Company Ltd, 5a Crendon Street, High Wycombe, Bucks HP13 6LE.; 1975.
  * [5] Diekmann O, Heesterbeek JAP, Metz JA.  On the definition and the computation of the basic reproduction ratio R 0 in models for infectious diseases in heterogeneous populations.  Journal of mathematical biology. 1990;28(4):365–382.
  * [6] Anderson RM, May RM.  Infectious diseases of humans: dynamics and control.  Oxford university press; 1992.
  * [7] Dietz K.  The estimation of the basic reproduction number for infectious diseases.  Statistical methods in medical research. 1993;2(1):23–41.
  * [8] Nowak MA, May RM.  Superinfection and the evolution of parasite virulence.  Proceedings of the Royal Society of London Series B: Biological Sciences. 1994;255(1342):81–89.
  * [9] Nowak MA, Bangham CR.  Population dynamics of immune responses to persistent viruses.  Science. 1996;272(5258):74–79.
  * [10] Diekmann O, Heesterbeek JAP.  Mathematical epidemiology of infectious diseases: model building, analysis and interpretation.  Wiley series in mathematical and computational biology. United States: John Wiley and Sons; 2000.
  * [11] Nowak M, May RM.  Virus dynamics: mathematical principles of immunology and virology.  Oxford University Press, UK; 2000.
  * [12] Hethcote HW.  The mathematics of infectious diseases.  SIAM review. 2000;42(4):599–653.
  * [13] Brauer F, Castillo-Chavez C, Castillo-Chavez C.  Mathematical models in population biology and epidemiology. vol. 2.  Springer; 2012.
  * [14] Anderson RM, Heesterbeek H, Klinkenberg D, Hollingsworth TD.  How will country-based mitigation measures influence the course of the COVID-19 epidemic?  The Lancet. 2020;395(10228):931–934.
  * [15] Ferguson N, Laydon D, Nedjati Gilani G, Imai N, Ainslie K, Baguelin M, et al.  Report 9: Impact of non-pharmaceutical interventions (NPIs) to reduce COVID19 mortality and healthcare demand. 2020;.
  * [16] Fauci AS, Lane HC, Redfield RR. Covid-19—navigating the uncharted.  Mass Medical Soc; 2020.
  * [17] Guan Wj, Ni Zy, Hu Y, Liang Wh, Ou Cq, He Jx, et al.  Clinical characteristics of coronavirus disease 2019 in China.  New England journal of medicine. 2020;382(18):1708–1720.
  * [18] Zhou F, Yu T, Du R, Fan G, Liu Y, Liu Z, et al.  Clinical course and risk factors for mortality of adult inpatients with COVID-19 in Wuhan, China: a retrospective cohort study.  The lancet. 2020;.
  * [19] Grasselli G, Zangrillo A, Zanella A, Antonelli M, Cabrini L, Castelli A, et al.  Baseline characteristics and outcomes of 1591 patients infected with SARS-CoV-2 admitted to ICUs of the Lombardy Region, Italy.  Jama. 2020;323(16):1574–1581.
  * [20] Li Q, Guan X, Wu P, Wang X, Zhou L, Tong Y, et al.  Early transmission dynamics in Wuhan, China, of novel coronavirus–infected pneumonia.  New England Journal of Medicine. 2020;.
  * [21] Xu B, Gutierrez B, Mekaru S, Sewalk K, Goodwin L, Loskill A, et al.  Epidemiological data from the COVID-19 outbreak, real-time case information.  Scientific data. 2020;7(1):1–6.
  * [22] Wu JT, Leung K, Bushman M, Kishore N, Niehus R, de Salazar PM, et al.  Estimating clinical severity of COVID-19 from the transmission dynamics in Wuhan, China.  Nature Medicine. 2020;26(4):506–510.
  * [23] Kucharski AJ, Russell TW, Diamond C, Liu Y, Edmunds J, Funk S, et al.  Early dynamics of transmission and control of COVID-19: a mathematical modelling study.  The lancet infectious diseases. 2020;.
  * [24] Leung K, Wu JT, Liu D, Leung GM.  First-wave COVID-19 transmissibility and severity in China outside Hubei after control measures, and second-wave scenario planning: a modelling impact assessment.  The Lancet. 2020;.
  * [25] Zhang J, Litvinova M, Liang Y, Wang Y, Wang W, Zhao S, et al.  Changes in contact patterns shape the dynamics of the COVID-19 outbreak in China.  Science. 2020;.
  * [26] Rader B, Scarpino SV, Nande A, Hill AL, Adlam B, Reiner RC, et al.  Crowding and the shape of COVID-19 epidemics.  Nature medicine. 2020;p. 1–6.
  * [27] Kraemer MU, Yang CH, Gutierrez B, Wu CH, Klein B, Pigott DM, et al.  The effect of human mobility and control measures on the COVID-19 epidemic in China.  Science. 2020;368(6490):493–497.
  * [28] Tian H, Liu Y, Li Y, Wu CH, Chen B, Kraemer MU, et al.  An investigation of transmission control measures during the first 50 days of the COVID-19 epidemic in China.  Science. 2020;368(6491):638–642.
  * [29] Ferretti L, Wymant C, Kendall M, Zhao L, Nurtay A, Abeler-Dörner L, et al.  Quantifying SARS-CoV-2 transmission suggests epidemic control with digital contact tracing.  Science. 2020;368(6491).
  * [30] Flaxman S, Mishra S, Gandy A, Unwin HJT, Mellan TA, Coupland H, et al.  Estimating the effects of non-pharmaceutical interventions on COVID-19 in Europe.  Nature. 2020;584(7820):257–261.
  * [31] Kissler SM, Tedijanto C, Goldstein E, Grad YH, Lipsitch M.  Projecting the transmission dynamics of SARS-CoV-2 through the postpandemic period.  Science. 2020;368(6493):860–868.
  * [32] Walker PG, Whittaker C, Watson OJ, Baguelin M, Winskill P, Hamlet A, et al.  The impact of COVID-19 and strategies for mitigation and suppression in low-and middle-income countries.  Science. 2020;.
  * [33] Rajgor DD, Lee MH, Archuleta S, Bagdasarian N, Quek SC.  The many estimates of the COVID-19 case fatality rate.  The Lancet Infectious Diseases. 2020;20(7):776–777.
  * [34] Verity R, Okell LC, Dorigatti I, Winskill P, Whittaker C, Imai N, et al.  Estimates of the severity of coronavirus disease 2019: a model-based analysis.  The Lancet infectious diseases. 2020;.
  * [35] Ruan S.  Likelihood of survival of coronavirus disease 2019.  The Lancet Infectious Diseases. 2020;20(6):630–631.
  * [36] Rhodes A, Ferdinande P, Flaatten H, Guidet B, Metnitz P, Moreno R.  The variability of critical care bed numbers in Europe.  Intensive care medicine. 2012;38(10):1647–1653.
  * [37] Ma X, Vervoort D.  Critical care capacity during the COVID-19 pandemic: Global availability of intensive care beds.  Journal of Critical Care. 2020;58:96.
  * [38] Phua J, Weng L, Ling L, Egi M, Lim CM, Divatia JV, et al.  Intensive care management of coronavirus disease 2019 (COVID-19): challenges and recommendations.  The Lancet Respiratory Medicine. 2020;.
  * [39] Nowak MA.  Five rules for the evolution of cooperation.  science. 2006;314(5805):1560–1563.
  * [40] Sigmund K.  The calculus of selfishness.  Princeton University Press; 2016.

Figure 1:  The disease spread without an intervention. a, Upon contracting the
disease, the individual incubates for two days (E) and then becomes infectious
(I) as they develop mild condition. If a critical condition develops (C), the
individual is hospitalized and isolated. We assume that all surviving
individuals (R) acquire immunity. b, A population of $N$ individuals. Each
day, an individual meets $k$ other individuals. During a single meeting with
an infectious person, a susceptible individual contracts a disease with a
transmission probability $p$. c, Without intervention, the disease surges
through the community and the critical cases (curve) at its peak
$C_{\textrm{max}}$ exceed the available hospital bed capacity $c$ (dashed
lines [36, 37]). Here $N=1000$, $k=15$, $p=2\ \%$, thus the epidemiological
$R_{0}$ is roughly $R_{0}\doteq 2.9$.

Figure 2:  Basic policies. a, Under a policy $P(\tau,k,d)$, the country locks
down to $k<k_{0}$ daily contacts whenever the number $C(t)$ of critical cases
exceeds a trigger threshold $\tau$. It reopens (to $k_{0}$ daily contacts)
once the number of critical cases stays below $\tau$ for $d$ consecutive days.
b, Representative runs of four different policies given by a combination of a
trigger threshold ($\tau_{\operatorname{low}}=3$,
$\tau_{\operatorname{high}}=12$) and a lockdown severity
($k_{\operatorname{low}}=1.25$, $k_{\operatorname{high}}=6$), and common
patience $d=10$ days. While with
$P_{\mathit{SH}}=P(\tau_{\operatorname{high}},k_{\operatorname{low}},10)$ (top
left) all peaks are similar in shape, with
$P_{\mathit{ML}}=P(\tau_{\operatorname{low}},k_{\operatorname{high}},10)$
(bottom right) all subsequent peaks are much smaller than the first one. With
$P_{\mathit{MH}}=P(\tau_{\operatorname{high}},k_{\operatorname{high}},10)$
(top right), the capacity is exceeded and with
$P_{\mathit{SL}}=P(\tau_{\operatorname{low}},k_{\operatorname{low}},10)$
(bottom left), the disease is quickly eradicated.

Figure 3:  Performance of low-trigger and high-trigger policies. In each
panel, we vary the number $k$ of daily contacts ($x$-axis) and consider the
performance (cost) of the low-trigger policies ($\tau_{\operatorname{low}}=3$,
blue) and of the high-trigger policies ($\tau_{\operatorname{high}}=12$,
green), when the patience parameter is low ($d=7$ days, left column) and high
($d=70$, right column). The dotted red line shows the number $k^{\star}$ of
daily contacts that corresponds to the epidemiological $R_{0}$ equal to $1$
(when no individuals have yet recovered). Generally speaking, it is beneficial
to have the trigger value $\tau$ low (blue curves are below green ones), to
impose severe rather than moderate lockdown (all curves go up), and to be
patient (the curves in the right panels are lower). For $C_{\textrm{max}}$ and
$p_{\text{fail}}$, the key is to have the trigger value $\tau$ low. For
$C_{\textrm{all}}$ and $D$, the key is to have the patience $d$ high.

Figure 4:  Role of patience in $C_{\textrm{all}}$ and $D$. The patience
parameter $d$ is key in determining the total health damage (total number
$C_{\textrm{all}}$ of critical cases per 1000) and the total economic damage
(total duration $D$ of the lockdown, in days). The two panels are incomparable
(due to different lockdown severity). The low-trigger policies (blue) and the
high-trigger policies (green). The patience increases along the arrow.
Features: High patience always helps in $C_{\textrm{all}}$. High patience
helps in $D$, unless high-trigger and moderate (then it does not matter). In
the right panel, the diamond and the triangle marks coincide. The high-trigger
policy with low patience ($d=7$, green disk) is off the chard: It would yield
$D\doteq 270$ days and $C_{\textrm{all}}\doteq 30$ cases per 1000.

Figure 5:  Two countries. a, When two countries interact with a positive rate
$q$ they might reinfect each other. Here $q=5\cdot 10^{-4}$, and the countries
employ different policies: $P_{\mathit{ML}}$ (blue) and $P_{\mathit{SH}}$
(yellow). b, A $90\ \%$ percentile: On any given day, 90 % of the runs are
below the respective curves. c-f, The performance of a $P_{\mathit{ML}}$
policy against a $P_{\mathit{SH}}$ policy (blue), $P_{\mathit{SH}}$ vs.
$P_{\mathit{ML}}$ (green), $P_{\mathit{ML}}$ vs. $P_{\mathit{ML}}$ (yellow)
and $P_{\mathit{SH}}$ vs. $P_{\mathit{SH}}$ (red), averaged over $10^{4}$
runs. We vary the interaction rate $q$ on a log-scale and measure: c, the
collapse probability $p_{\text{fail}}$ (95 % confidence intervals are shaded);
d, the expected peak size $C_{\textrm{max}}$; e, the total number
$C_{\textrm{all}}$ of critical cases; and f, the lockdown duration $D$. A
country employing $P_{\mathit{SH}}$ does great when its neighbor employs
$P_{\mathit{SH}}$ (red) but bad when the neighbor employs $P_{\mathit{ML}}$
(green). A country employing $P_{\mathit{ML}}$ does comparably well,
regardless of whether the neighbor employs $P_{\mathit{ML}}$ (yellow) or
$P_{\mathit{SH}}$ (blue).