Skip to main content

Intermediate

[Texte] Calculs de viability-theory.org dans ViabLab en anglais

Niveau de difficulté
Thématique
Présentation formation

Reproduire les calculs des exemples de viability-theory.org :

Aller sur la page du cas d'usage choisi, par exemple l'exemple de Julia, et télécharger les deux fichiers .h et .json associés à l'implémentation dans Viablab.

Copier le fichier .json dans le répertoire ~/ViabLabGui/bin/VIABLAB/INPUT et le fichier .h dans le répertoire  ~/ViabLabGui/bin/VIABLAB/source/data/ 

Editer le fichier ~/ViabLabGui/bin/VIABLAB/source/data/ModelDataInclusion.h

Remplacer la ligne qui commence par string paramsFile avec le nom du fichier .json que vous venez de copier. Par exemple, si ce fichier s'appelle toto .json, il faut écrire écrire :

string paramsFile = "toto.json";

Remplacer dans la ligne qui commence par #include, le nom du fichier .h par celui du fichier que vous venez de copier : si ce fichier se nomme data_toto.h, écrire

#include  "../data//data_toto.h"

Enregistrer le fichier ModelDataInclusion.h

Retourner dans le répertoire ~/ViabLabGui/bin/VIABLAB/build :

 

Pour Linux : 

make

pour créer le fichier exécutable viabLabExe, puis, pour l'exécuter :

./viabLabExe

 

Pour MacOS : 

Générer avec make (en utilisant tous les CPU du Mac pour accélérer la compilation)

make -j$(sysctl -n hw.logicalcpu)

Pour exécuter viabLabExe

 ./viabLabExe 

 

 

Vous venez de lancer le calcul de noyau de viabilité identique à celui du site !

 

Modeling Viability under Uncertainty

Type de document
Revue
Natural Resources Modeling
Volume
31: e12186
Année de publication
2018
Sous titre
An Illustration from Farming Systems
Auteur(s)
Bates, Samuel; Angeon, Valérie; Désilles, Anna; Saint-Pierre, Patrick
Niveau de difficulté
Thématique

Uncertainty occupies a major place in the literature, both when it is being defined and when it is being measured. The mathematical viability framework provides useful concepts to go beyond the probabilistic views of uncertainty that are not able to capture all forms of uncertainty, particularly in the absence of statistical regularities. Bounded-set uncertainty can help to analyze changes in the evolutionary conditions that affect ecological and social systems with probabilistic or nonprobabilistic distributions. This paper introduces uncertainty into a viability model by associating stochastic and bounded-set uncertainty related to sales price as a driver of economic uncertainty. Based on an illustration of agroecosystems, the model identifies decision rules that guarantee viability. The larger the initial crop portfolio for sequential diversification is, the lower the costs to belong to the viability kernels will be, regardless of economic and environmental constraints. The diversification of farming systems transforms their complexity into an advantage against uncertainty, which opens up numerous viability trajectories.

Julia Sets

Niveau de difficulté
Domaine
Problèmes mathématiques
Contenu

Let us consider complex quadratic polynomials that can be expressed as 

$$\phi_c(z)=z^2+c.$$

The filled Julia set gathers $z$ such that the sequence of their iterates by $\phi_c$ is bounded. 

Fix some $R>0$ large enough that $R^2-R\geq |c|$, the filled Julia set for this system is the subset of the complex plane given by

$$K(\phi_c)=\{z\in C\; :\; \forall n \in N, \;|\phi_c^n(z)|\leq R\},$$ 

where $\phi_c^n(z)$ is the nth iterate of $\phi_c(z)$. The Julia set $J(\phi_c)$ of this function is the boundary of $K(\phi_c)$.

In 1982, a deep theorem by Adrien Douady and Hubbard states that Julia sets are path-connected if and only if the sequence of the iterates of $0$ is bounded. 

Moreover, $K(\phi_c)$ and $J(\phi_c)$ are either path-connected (there is a path within the set that connects any two given points in the set) or path-disconnected (for any two given points in the set, it is impossible to find a path within the set that connects the pair). The set of complex numbers $c$ that can form a path-connected Julia set is called the Mandelbrot set. It is defined in the complex plane as the complex numbers $c$ for which the function $\phi_c$ does not diverge to infinity when iterated starting at $z=0$.

The set Mandelbrot set is bounded, included in $B(0,2)$. Different components of the Mandelbrot set correspond to different dynamical behaviors of the corresponding filled Julia sets.

 

From

Aubin, J.-P., Bayen, A., & Saint-Pierre, P. Viability Theory: New Directions. Springer. 2011.

  • Obviously, the subset $K_c:=Viab_{\phi_c}(B(0,2))$ is the filled Julia set for the function $\phi_c$ whenever $|c|\leq 2$ (which is true when $c$ belongs to the Mandelbrot set) and its boundary $J_u:=\partial K_c$ is the Julia set.

We can approximate these Julia sets thanks to the Viability Algorithm.

Dynamics Constraints Target Viability Concept

Discrete Time

Continous 2-dimensional space

$\phi(x,y):=(x^2-y^2+a,2xy+b)$

Parameters : $a$, $b$ 

B(0,2) None Viability Kernel

Two famous Julia sets : 

  • Douady Rabbit when $c$ is a complex root of $c^3+2c^2+c+$,  $c\approx -0.123 \pm 0.745i $ which implies that the orbit of 0 is periodic with period 3. Douady Rabbit is then connected. See below an approximation obtained by the ViabLab software :

 

You can see below an approximation of the filled Julia and the Julia set for $c=???$ obtained using the VIABLAB software:.

 

Commentaires

To compute apporximations of these viability kernels, simply place the .cpp file in ViabLab's /source directory and the .json file in the /INPUT directory.
Then, run ViabLab ; the output files will be placed in the /OUTPUT directory.
To visualize the viability kernel and its boundary, place the .py file in the /OUTPUT directory and run it.

For assistance, consult the training materials.

Interaction model of a farmer and a restaurant

Niveau de difficulté
Domaine
Problèmes mathématiques
Contenu

This system describes a farm and a restaurant belonging to a same project. Consequently, they function in full cooperation.

Description of the system : 

de Lapparent, A., Martin, S. & Sabatier, R. Using System Modularity to Simplify Viability Studies: An Application to a Farm-Restaurant Interaction. Environ Model Assess (2024). https://doi.org/10.1007/s10666-024-10014-w

The object computed is a viability kernel. The model is discrete in states, controls and time.

The computation takes a moment (4088s on my computer), be patient...

 

Model

States and controls

State variables

Notation Description Number of points Maximal value Minimal value
$x_1$ Cumulative cash flow (€) 41 100 000 0
$x_2$ Restaurant attractivity coefficient (no unit) 31 1 0
$x_3$ General Index for Soil Quality 51 1 0

upper limit of $x_1$ can be relaxed.


Control variables

Notation Description Number of points Maximal value Minimal value
$u_1$ Choice of N-crops rotation 126 126 1
$u_2$ Surface dedicated to market gardening (in ha) 21 2 0.05
$u_3$ Price of a meal (in €) 21 15 2

Dynamics

Overall dynamics are:

\begin{equation}
   \mathcal{S}_U
   \begin{cases}
   x_{1}^{t+1} = x_{1}^t + G(x_{2}^t,u_{3}^t,R(x_3^t,u_1^t,u_2^t)) - E(u_{1}^t,u_{2}^t)\\
   x_{2}^{t+1} = \alpha(x_{2}^t,u_{3}^t,R(x_3^t,u_1^t,u_2^t))\\
   x_{3}^{t+1} = \Phi (x_{3}^t ,u_{1}^t,u_{2}^t) \\
   \end{cases}
\end{equation}

 

with the following functions:

Notation

Description

$R(x_3,u_1,u_2)$ Agricultural production
$G(x_2,u_3,R(x_3,u_1,u_2))$ Restaurant economic outcome
$\alpha(x_2,u_3,R(x_3,u_1,u_2))$ Transition function for the restaurant attractivity
$\Phi(x_3,u_1,u_2)$ Transition function for the GISQ
$E(u_1,u_2)$ Cost of agricultural production

Some dynamics require to use grid parameters. Consequently, a function has been implemented into the source file to get these values.

 

Constraints

There are two cconstraints in this system: the global system has to be profitable and a minimal soil quality has to be preserved in order to address sustainability concerns. These constraints take the form of thresholds on the cumulative cash flow ($x_{1} \geq x_{1min}$) and on soil quality ($x_3 \geq x_{3min}$), respectively. In other words, $(x_1^t,x_2^t,x_3^t)$ must remain in $K$ for all $t\in \mathbb{N}$ with : 
\begin{equation}
K:=\{(x_1,x_2,x_3)\in \mathbb{R}^+\times [0;1]^2 \; |\; x_1\geq x_{1min} \text{ and }x_3\geq x_{3min}\}.
\end{equation}

 

 

Implementation parameters

Time horizon

The time horizon (for trajectory computations) is 20 years.


Algorithm parameters

Default parameters are used.


System parameters

We used the parameters for a low-hypotheses computation.

   "SYSTEM_PARAMETERS": {
       "DYNAMICS_TYPE": 2,
       "DYN_BOUND": 1,
       "DYN_BOUND_COMPUTE_METHOD": 2,
       "IS_TIMESTEP_GLOBAL": 0,
       "LIPSCHITZ_CONSTANT": 1,
       "LIPSCHITZ_CONSTANT_COMPUTE_METHOD": 2,
       "TIME_DISCRETIZATION_SCHEME": 4
   }

 

Viability kernel computed using ViabLab

Multi-species transhumant systems in Mongolia

Niveau de difficulté
Domaine
Contenu

This model represents the effect of grazing multi-species herds on feed resources, as well as its effects on farmers' income and self-sufficiency. Due to the highly extensive nature of the herds considered, only culling allows for herd management (no breeding or supplemental feeding is practiced).

These pastoral systems are particularly susceptible to extreme bioclimatic hazards known as Dzuds, which will be central to the modeling approach we will undertake.

Dzuds are episodes of sudden and massive mortality in herds, generally occurring at the end of winter when stocking rates are too high relative to forage resources and climatic conditions are particularly harsh. This binary phenomenon therefore depends on both farmers' practices and climatic conditions, as it is the combination of these two factors that triggers it.

The model we have developed links the dynamics of herds of 5 herbivore species (cattle, sheep, goats, horses and camels) to the dynamics of the forage resource and posits the Dzud as a central mechanism in the dynamics of the system.

 

Methodologically, this case study allowed us to evaluate the three properties of robustness, adaptability, and resilience within a single case.

Applied to practical application, the long-term work we conducted on this case study enabled us to gain a detailed understanding of the system's dynamics. We were thus able to distinguish two viable operating regimes for the system: small herds that prevent the onset of Dzuds by preserving resources, and very large herds that can withstand Dzuds when they occur.

The detailed model can be found in the following article:
Rodolphe Sabatier, Frédéric Joly, Bernard Hubert. Assessing both ecological and engineering resilience of a steppe agroecosystem using the viability theory. Agricultural Systems, Elsevier Masson, 2017, 157, pp.146-156. ⟨10.1016/j.agsy.2017.07.009⟩. ⟨hal-02627849⟩

Collective management of an eutrophication problem

Niveau de difficulté
Contenu

Introduction $k$

Le problème d'eutrophisation du lac décrit comme le problème de viabilité du lac et des exploitations riveraines est traité à un niveau global et suppose un décideur unique. Dans le présent exemple les parties prenantes sont réunies dans un comité, et les membres du comité (appelés individus dans la suite) ne sont pas nécessairement d'accord sur la dynamique du lac. Cet exemple illustre les cas où la gestion est collective et où il n'y a pas de consensus sur la dynamique. Ce problème est un problème de viabilité garantie.

Ce problème est décrit en détail dans :

Alvarez, I., Zaleski, L., Briot, J.-P., Irving, M. de A. (2023). Collective management of environmental commons with multiple usages: A guaranteed viability approach. Ecological Modelling, 475, Article 110186

Version auteur disponible ici

 

Les caractéristiques 

Les caractéristiques du problème modélisé sont les suivantes :  

  1.  $N$ individus utilisent les même variables pour décrire le système. Dans cet exemple du lac, ce sont les mêmes variables $L$ (apports de phosphore) et $P$ (concentration totale de phosphore) que dans le cas du décideur unique.
  2. Les contrôles admissibles retenus dans les modèles sont communs à tous les individus. On garde donc la même variable de contrôle et les mêmes bornes : $u\in U=[u_{min},u_{max}]$.
  3. Tous les individus $i$ peuvent définir un ensemble d'états souhaitables $K_i$ dont l'intersection est non vide. On garde donc un ensemble de contraintes similaires au cas du décideur unique :  $x=\left(L(t),P(t)\right) \in K=[L_{min}, +\infty[ \times [0,P_{max}]$
  4. La dynamique du système est modélisée pour chaque individu par un ensemble d'équations (ou d'inclusion différentielles) $S_i$
  5. L'objectif de chaque individu est de maintenir le système modélisé par leur dynamique $S_i$ dans leur ensemble d'états souhaitables $K_i$
  6. Les individus acceptent de partager leurs informations personnelles avec un tiers de confiance.

    Dans cet exemple, on considère $N=4$ individus. Trois d'entre eux ($i\in\{1,2,3\}$) adoptent la dynamique classique, mais avec des paramètres différents :

    \begin{equation}
    (P_i \text{ modèle 1})\left\{
    \begin{array}{l}
    \frac{dL}{dt}=u\in U=\left[ u_{min},u_{max}\right] \\
    \frac{dP}{dt}=-b_i P(t) + L(t) +r_i\frac{P(t)^{q_i}}{m_i^{q_i} + P(t)^{q_i}} \\
    \left(L(t),P(t)\right) \in K=[L_{min}, +\infty[ \times [0,P_{max}]
    \end{array}
    \right.
    \end{equation}

    Un individu ($i=4$) considère que le processus de relargage peut se produire différemment, et utilise une formule différente pour la pseudo-sygmoïde :

    \begin{equation}
    (S' \text{ modèle 0}) \quad \frac{dP}{dt}=-b_i P(t) + L(t) + r_i \frac{P(t)}{P(t) + m_i e^{(-\lambda_i(P(t)-m_i)) }}
    \end{equation}

    Les valeurs numériques pour les calculs sont les suivantes : $u_{min}=-u_{max}/2$ ; $u_{max}\approx 3,15\; \mu g.l^{-1}.\text{an}^{-1}$, $L_{min}\approx6,94 \; \mu g.l^{-1}$,  $P_{max}=24.76 \; \mu g.l^{-1}$, 

Le  tableau suivant rassemble les valeurs des paramètres pour chaque individu (b,r,m sont en $\mu g.l^{-1}$).

Paramètres $b_i$   $r_i$   $m_i$   Modèle   $q_i$   $\lambda_i$
  perte   taux   valeur de P   choix du   pente du   pente du
      max.   pour $r_i/2$   modèle   modèle 1   modèle 0
Individu 1 2,2676   101,96   26,90   1   2,222   -
Individu 2 2,2676   101,96   26,90   1   [2,2;2,3]   -
Individu 3 [2,2;2,3]   101,96   26,90   1   2,222   -
Individu 4 2,2676   101,96   26,90   0   -   [1/19;1/16]

Les incertitudes sont traitées comme des variables prenant leur valeur dans des ensembles. Le problème est un problème de viabilité garantie, dans lequel le vecteur $v$ des "tyches" regroupent les paramètres incertains : $v_1$ représente le paramètre $b_i$, $v_2$ : $\alpha_i$, $v_3$ : $q_i$ et $v_4$ représente $\lambda_i$. La dynamique du modèle avec incertitudes devient :

\begin{equation}
f_v(x=(L,P),u,v)=\left( 
\begin{array}{l}
u\\
- v_1 P + L +  r \left( (1-v_2) \frac{P^{v_3}}{m^{v_3} + P^{v_3}} + v_2 \frac{P}{P + m e^{(-v_4(P-m)) }}\right)  \;
\end{array}
\right)
\end{equation}

 

Problèmes

Le problème de viabilité garantie qui doit être résolu est le suivant :

\begin{equation}
(P_v)\left\{
\begin{array}{lcl}
(L,P)'(t)&=&f_B((L,P)(t),u(t),v(t))\\
u(t)&\in& U=\left[ u_{min},u_{max}\right] \\
v(t)&\in & V=[2.2,2.3]\times[0,1]\times[2.2,2.3]\times[1/19,1/18]\\
(L,P)(t) &\in& K \; 
\end{array}
\right.
\end{equation}

Le noyau garanti peut être approximé avec ViabLab (version 2.2). Le code correspondant est ici : https://forgemia.inra.fr/isabelle.alvarez/emlake