owned this note changed 5 years ago
Linked with GitHub

Article h24

Soumettre à Computers, Environment and Urban Systems

A faire

  • Explorer les nouvelles sorties OSE pour voir si on peut isoler un ou plusieurs régimes de fonctionnement du modèle. En fonction, A choisir un ou plusizeurs jeux de parametres sur le(s)quel(s) on fera tourner le modèle. A voir combien de jeux de paramètre on choisit de garder & si on choisit ces jeux de paramètres de facon aleatoire ou "experte" [tous] A faire dès que l'OSE sera terminé

  • En fonction du/des nouveaux jeux de parametres choisis, produire les nouvelles sorties (données + graphiques à bosses) pour les 5 scenarios [Romain].

  • En fonction du/des nouveaux jeux de parametres choisis, produire pour chacun des 5 scenarios une carte de la % d'healthy par cellule à l’initialisation, une carte de la % d'healthy par cellule à la fin du modèle, une carte sur le différentiel des deux cartes précédentes, soit 15 cartes en tout [Julien] Fait à refaire !

  • Décrire les sorties dans l'article [Julie]

  • Compter pour chaque scenario le number final d'agents healthy par catégorie sexe/age/éducation (médiane sur 1000 réplications) [Julien & Romain]

  • Calculer à l'initialisation les % d'agents with a ’day’ cell which differs from the ’night’ cell et les % d'agents with a ’eveing’ cell which differs from the ’night’ cell (cf.Annexe 9.1) (médiane sur 1000 réplications) [Julien]

  • Library H24 : Dockerization + reproductibilité scripts et papier [Sebastien]

  • Décrire dans l'article la libray H24 (voir en bas pour le détail) [Seb, Julien & Romain]

  • Mettre dans l'article un lien vers le depot github du modele de simu 5aday (mettre les workflows OpenMole dans le depot 5aday)

  • Décrire ce qu'est un OSE en deux phrases qualitatives Appendix 9.3 [Romain]

  • Mettre l'article au format de la revue Computers, Environment and Urban Systems [Julie]

A faire - Bonus

  • Si nécessaire inserer le graphique à bosses obtenu avec un second jeu de parametre dans l'Appendix 9.5 pour monter qu'on obtient les mêmes résultats

  • Faire des cartes pour visualiser la variation spatiale des valeurs (avec 100 réplications par exemple) ? [Julien]

Done

  • Faire tourner un nouvel OSE (suite aux modifs de nov 2019 ->fevrier 2020 et au nouveau calibrage de fevrier 2020 ) [Romain & Julien].

  • Refaire l'Appendix 9.3 [Clémentine]

  • Comprendre pourquoi la social ineq avait des valeurs bizarres sur les cartes envoyées par Julien en nov 2019 [Julien & Romain].

  • Library H24 : mettre au propre les scripts qui nous ont permis de traiter l'EGT + les données produites. Tout mettre le repo H24 [Julie puis Julien/Seb]

  • Library H24 : reprendre les scripts des EMD pour généraliser le process, en prenant l’exemple de Nantes/Loire-Atlantique où l'EMD est en open data [Julie]

  • Revoir figure 3 ? [Clémentine]

  • Simplifier équations dans texte et figures [Clémentine]

Abandon

Annexe diagramme séquence

Simulation need two preprocessed .bin data before running.

Step 1 Generating population

Initial distribution of population (population.bin) is generated using the h24.tools.PopulationGenerator tools object with correct input parameters/data :

  • c shape of Iris,
  • p & f population structure and education from census,
  • g population density in raster format,
  • s grid size for population projection.

Given population density we build a matrix of cells with

Next, the function generatePopulationRandomly use information about structure of population (age,sex,education) at the census block level (iris) to sample new population sized individuals using direct sampling algorithm.

We don't consider the census block geometries, so we attribute for each individual (IndividualFeature) a random cell in a matrix of same size of the population raster grid. This random cell is taken using a multinomial to respect density of population.

todo >> exemples simple_grid_5 et simple_grid_cells sont inversés, la population devrait se trouver au niveau dans des cases plus grosses

Finally, individuals (x,y) are translated/relocated to some new grid of cells function of the gridSize parameter.

Step 2 Move population

Using EGT and population previously generated, flows are precomputed as File (move.bin) before running simulation.

In generation.scala , in flowsFromEgt(...) the method readFlowsFromEGT() return an Array[Flow]

We build a MoveMatrix (in reality a Vector[TimeSlice, CellsMatrix]) where CellsMatrix is an Array[Array[Cell]] :

  • A Move is an object with an index and a ratio.
  • A Cell is a Map which associate an AggregatedCategory with an array of Move
  • An AggregatedCategory object take a category (ex.Education.SUP) as input and return the coresponding aggregated category (ex. HIGH)
  • A TimeSlice is a vector of TimeSlices (0-8,8-16,16-24) :
    • (0-8) - Empty Map for each Cell in Matrix
    • (8-16) - Empty Map for each Cell in Matrix
    • (16-24) - Empty Map for each Cell in Matrix

We first build a vector of MoveMatrix with empty array of Move for AggregatedCategory.

For each TimeSlice by reading flows from EGT file (Array[Flow]) and aggregate them by Cell (addFlowToCell function).

  for each nm in `Vector[TimeSlice, CellsMatrix]`  
   for each flow f in EGT  
     a) we get the Cell c at (x,y) of residence of current flow 
     b) we update these Cell c by calling addFlowToCell() function

The addFlowToCell() function add the contribution of a flow to Cell for a given timeslice by :

  • computing the length of intersection between first mn timeslice and f timeslice.
  • attributing an aggregated category cat to this flow.
  • calculating :
    • if intersection is 0, cell c is not updated
    • else we create or update the Array[Move] for this cat .
    • If a Move already exist for the activity location of this flow, we update this Move by adding our contribution.
  def addFlowToCell(c: Cell, flow: Flow, timeSlice: TimeSlice): Cell = {
    val intersection = overlap(flow.timeSlice, timeSlice).toDouble
    val cat = AggregatedSocialCategory(SocialCategory(age = flow.age, sex = flow.sex, education = flow.education))

    if(intersection <= 0.0) c
    else
      c.get(cat) match {
        case Some(moves) =>
          val index = moves.indexWhere { m => Move.location.get(m) == flow.activity }
          if (index == -1) c + (cat -> moves.:+ (Move(flow.activity, intersection.toFloat)))
          else {
            val v = MoveMatrix.Move.ratio.get(moves(index))
            c + (cat -> moves.updated(index, Move(flow.activity, v + intersection.toFloat)))
          }
        case None =>
          c + (cat -> Array(Move(flow.activity, intersection.toFloat)))
      }
  }

After that, MoveMatrix is interpolated (interpolate(...)) then normalized (normalizedFlows(...)).

Because EGT flows are a small parts of real flow, we scale MoveMatrix CellsMatrix build using EGT at IDF level by interpolating values to neighbors. Each CellsMatrix could be interpreted as a probability by category at individual level.

To normalize CellsMatrix, we use getMovesFromOppositeSex(...): in order to get more samples in areas where we have little information, we also use the information from samples in the area with the same categories but different sex

Step 2 Simulating

  • Chargement de results/population.bin (ageCategory, sexe, education ) dans un vecteur d' IndividualFeature
  • fct generateWorld :
    • IndividualFeature sont rewrappés dans des case class Age, Sexe, Education, Comportement, Lieu dans Individual
    • On filtre cette population en fonction du prédicat de la fonction included
    • Genere le monde World en fonction du vecteur Individual, fonction comportement de type Behaviour (double) et une graine aléatoire.
Select a repo