Exemplo n.º 1
0
  flee.SimulationSettings.MaxWalkSpeed=5000.0

  end_time = 10
  e = flee.Ecosystem()

  l1 = e.addLocation("A", movechance=0.3)

  l2 = e.addLocation("B", movechance=0.0)
  l3 = e.addLocation("C", movechance=0.0)
  l4 = e.addLocation("D", movechance=0.0)

  e.linkUp("A","B","834.0")
  e.linkUp("A","C","1368.0")
  e.linkUp("A","D","536.0")

  d = handle_refugee_data.RefugeeTable(csvformat="generic", data_directory="test_data", start_date="2010-01-01", data_layout="data_layout.csv")

  for t in range(0,end_time):
    new_refs = d.get_new_refugees(t)

    # Insert refugee agents
    for i in range(0, new_refs):
      e.addAgent(location=l1)

    # Propagate the model by one time step.
    e.evolve()

    print(t, l1.numAgents+l2.numAgents+l3.numAgents+l4.numAgents, l1.numAgents, l2.numAgents, l3.numAgents, l4.numAgents)


  assert t==9
Exemplo n.º 2
0
                       movechance="camp",
                       capacity=4356,
                       foreign=True)
    # GPS 14.684030 1.882720
    n3 = e.addLocation("Niamey",
                       movechance="camp",
                       capacity=6327,
                       foreign=True)

    n4 = e.addLocation("Tabareybarey",
                       movechance="camp",
                       capacity=9189,
                       foreign=True)
    # GPS 14.754761 0.944773

    d = handle_refugee_data.RefugeeTable(
        csvformat="generic", data_directory="source_data/mali2012/")

    # Correcting for overestimations due to inaccurate level 1 registrations in five of the camps.
    # These errors led to a perceived large drop in refugee population in all of these camps.
    # We correct by linearly scaling the values down to make the last level 1 registration match the first level 2 registration value.
    # To our knowledge, all level 2 registration procedures were put in place by the end of 2012.
    d.correctLevel1Registrations("Mbera", "2012-12-31")
    m1.capacity = d.getMaxFromData("Mbera", last_physical_day)
    d.correctLevel1Registrations("Mentao", "2012-10-03")
    b1.capacity = d.getMaxFromData("Mentao", last_physical_day)
    d.correctLevel1Registrations("Abala", "2012-12-21")
    n1.capacity = d.getMaxFromData("Abala", last_physical_day)
    d.correctLevel1Registrations("Mangaize", "2012-12-21")
    n2.capacity = d.getMaxFromData("Mangaize", last_physical_day)
    d.correctLevel1Registrations("Tabareybarey", "2012-12-21")
    n4.capacity = d.getMaxFromData("Tabareybarey", last_physical_day)
Exemplo n.º 3
0
    ig = InputGeography.InputGeography()

    ig.ReadLocationsFromCSV("%s/locations.csv" % input_csv_directory)

    ig.ReadLinksFromCSV("%s/routes.csv" % input_csv_directory)

    ig.ReadClosuresFromCSV("%s/closures.csv" % input_csv_directory)

    e, lm = ig.StoreInputGeographyInEcosystem(e)

    #print("Network data loaded")

    d = handle_refugee_data.RefugeeTable(
        csvformat="generic",
        data_directory=validation_data_directory,
        start_date="2013-12-15",
        data_layout="data_layout.csv")

    d.correctLevel1Registrations("Tierkidi", "2014-08-08")
    d.correctLevel1Registrations("Pugnido", "2015-06-26")
    d.correctLevel1Registrations("Jewi", "2015-07-31")
    d.correctLevel1Registrations("Kule", "2014-09-12")
    d.correctLevel1Registrations("Kakuma", "2014-06-26")
    d.correctLevel1Registrations("Khartoum", "2014-04-27")
    d.correctLevel1Registrations("West_Kordofan", "2015-08-05")
    d.correctLevel1Registrations("Rhino", "2014-05-21")
    d.correctLevel1Registrations("Kiryandongo", "2014-05-27")

    output_header_string = "Day,"
Exemplo n.º 4
0
    #e.linkUp("N24","Bossobolo","23.0") #Bossobolo has been taken out (see above).
    e.linkUp("Bangui", "Mole", "42.0")
    e.linkUp("Mole", "Boyabu", "25.0")
    e.linkUp("Zemio", "Mboti", "174.0")
    e.linkUp("Mobaye", "Mboti", "662.0")
    e.linkUp("Gbadolite", "Inke", "42.0")
    e.linkUp("Mbaiki", "Betou", "148.0")
    e.linkUp("Nola", "Brazaville", "1300.0")

    #DEBUG: print graph and show it on an image.
    #vertices, edges = e.export_graph()
    #analyze_graph.print_graph_nx(vertices, edges, print_dist=True)
    #sys.exit()

    d = handle_refugee_data.RefugeeTable(csvformat="generic",
                                         data_directory="source_data/car2014/",
                                         start_date="2013-12-01")

    #Correcting for overestimations due to inaccurate level 1 registrations in five of the camps.
    #These errors led to a perceived large drop in refugee population in all of these camps.
    #We correct by linearly scaling the values down to make the last level 1 registration match the first level 2 registration value.
    #To our knowledge, all level 2 registration procedures were put in place by the end of 2016.
    d.correctLevel1Registrations("Amboko", "2015-09-30")
    d.correctLevel1Registrations("Belom", "2015-08-31")
    d.correctLevel1Registrations("Dosseye", "2015-09-30")
    d.correctLevel1Registrations("Gondje", "2015-09-30")
    lm["Moyo"].capacity *= d.correctLevel1Registrations(
        "Moyo", "2015-06-02")  #also "2014-05-11" and "2015-06-02"
    d.correctLevel1Registrations("East", "2014-09-28")
    d.correctLevel1Registrations("Adamaoua", "2014-10-19")
    #d.correctLevel1Registrations("Mole","2016-02-29") # no clear decrease visible.
Exemplo n.º 5
0
    e.linkUp("Gisuru", "Nduta", "60.0")
    e.linkUp("Commune of Mabanda", "Kagunga", "36.0")
    e.linkUp(
        "Commune of Mabanda", "Nyarugusu", "71.0"
    )  #Estimated distance, as exact location of Nyarugusu is uncertain.

    e.linkUp("Kagunga", "Nyarugusu", "91.0", forced_redirection=True
             )  #From Kagunga to Kigoma by ship (Kagunga=Kigoma)
    e.linkUp("Kirundo", "Nakivale", "318.0")
    e.linkUp("Kayanza", "Nakivale", "413.0")

    e.linkUp("Nduta", "Nyarugusu", "150.0",
             forced_redirection=True)  #distance needs to be checked.

    d = handle_refugee_data.RefugeeTable(
        csvformat="generic",
        data_directory="source_data/burundi2015",
        start_date="2015-05-01")

    # Correcting for overestimations due to inaccurate level 1 registrations in five of the camps.
    # These errors led to a perceived large drop in refugee population in all of these camps.
    # We correct by linearly scaling the values down to make the last level 1 registration match the first level 2 registration value.
    # To our knowledge, all level 2 registration procedures were put in place by the end of 2016.
    d.correctLevel1Registrations("Mahama", "2015-10-04")
    d.correctLevel1Registrations("Nduta", "2016-04-06")
    d.correctLevel1Registrations("Nyarugusu", "2015-11-10")
    d.correctLevel1Registrations("Nakivale", "2015-08-18")
    d.correctLevel1Registrations("Lusenda", "2015-09-30")

    locations[26].capacity = d.getMaxFromData("Mahama", last_physical_day)
    locations[27].capacity = d.getMaxFromData("Nduta", last_physical_day)
    locations[29].capacity = d.getMaxFromData("Nyarugusu", last_physical_day)
Exemplo n.º 6
0
    ig = InputGeography.InputGeography()

    ig.ReadLocationsFromCSV("examples/general_example/locations.csv")

    ig.ReadLinksFromCSV("examples/general_example/routes.csv")

    ig.ReadClosuresFromCSV("examples/general_example/closures.csv")

    e, lm = ig.StoreInputGeographyInEcosystem(e)

    # print("Network data loaded")

    d = handle_refugee_data.RefugeeTable(
        csvformat="generic",
        data_directory="examples/general_example/refugee_data/",
        start_date="2009-12-24",
        data_layout="data_layout.csv")

    refugee_debt = 0
    refugees_raw = 0  #raw (interpolated) data from TOTAL UNHCR refugee count only.

    # Visualization
    visoutput = visualization.vis.VisManager(
        flee.SimulationSettings.SimulationSettings.DefaultVisPath /
        "general.json")
    start_date = datetime(2009, 12, 24)
    current_date = datetime(2009, 12, 24)
    # Visualization end

    for t in range(0, end_time):