CityScope / CS_Cooper-Hewitt

meta repo/sandbox repo for keeping everything related to the Cooper Hewitt exhibition
5 stars 2 forks source link

Potential Workflow to instantiate agent from SimPop.csv starting from the current iteration #42

Closed agrignard closed 5 years ago

agrignard commented 5 years ago

Right now this is the current way the model is initialize

in ABM there is

initModel();

this function simply call createAgents(nbAgent);where nbAgent is for now the number of car,bike, ped for each ABM.

This what this function is doing

  public void createAgents(int num) {
    for (int i = 0; i < num; i++){
      agents.add(new Agent(map,type));
    }
  }

So in order to start to instantiate those agent from a file let's start by creating the agent from the file having

initModelFromFile(String filename);

This function will then parse the file simPop.csv (that at the beginning might be copy/paste from the mobility repo) and for each line it will instantiate a new agent with a predefined source and destination (right now the concept of Residence and Office is a bit blurry as Agent are simply oscillating between src and dest but we can consider first that src is the residence and dest is the office)

Then we might need to have another constructor for Agent in order to be able to send the source and the dest.

Something like

Agent(RoadNetwork _map, String _type, Node src, Node dest);

And then this is where the real work starts, for instance how to we get a Node of the graph that corresponds to the buildings?

We are safe for this one as I just implemented this morning this function in RoadNetwork

and in Grid a function that returns you the position of a building according to its id

getBuildingCenterPosistionPerId(int id)

and then in RoadNetwork a function that returns the nodes that are present at this specific location + a certain buffer

getNodeInsideROI(PVector pos, int size)

However this function can only work if the graph have some node inside the building which is not already exactly the case. (see https://github.com/CityScope/CS_Cooper-Hewitt/issues/32)

So let's iterate on that, what is not clear for me is how the SimPop.csv too in account the repartition of the R,0 and A as described in blocks.csv to produce simPop.csv

aberke commented 5 years ago

Currently being handled in https://github.com/CityScope/CS_Cooper-Hewitt/pull/54