Home Forums Urban Modeling and Simulation attractivity map – alternatives to roulette wheel

Viewing 4 reply threads
  • Author
    Posts
    • #9576
      Martina Benetollo
      Participant

      Hello,

      I’m looking for an alternative way to select slots to assign land uses to them, and I’d prefer if it looked at the nearest best placement, verify if it’s empty, and then assigned the land use to it. The main purpose of this would be to avoid getting empty areas between plots that have the same typology, but I don’t know what to replace the random roulette values with.

      Thank you!

    • #9578
      Reinhard Koenig
      Keymaster

      Dear Martina,

      for selecting the most attractive location (I assume that is meant with “nearest best placement”) you can use this code instead of the roulette wheel:

      // — select the location with the highest attractivity —
      double tempBest = 0;
      for(int k = 0; k < AttractPop.Count; k++)
      {
      tempBest = AttractPop.Max();
      slot = AttractPop.IndexOf(tempBest, 0);
      }

      The peaks in the plot show that the selection prefers for a while only one location.

      Best regards

      Reinhard

      • #9585
        Martina Benetollo
        Participant

        While with the roulette I had many colored units, now I only get the initial ones, as if the loop didn’t work. I’m working without a sumList so I’m using these conditions in the if loop to make sure that only one lad use is assigned to each unit, but I don’t know if that’s what is causing the problem now. I’m getting an error any time i try to add the land use to a unit

      • #9586
        Reinhard Koenig
        Keymaster

        Dear Martina,

        jep, something is wrong in your script… but from your screenshot, I cannot figure out the reason for your issue. Can you please send the GH definition as a zip file?

        Best regards

        Reinhard

    • #9579
      Reinhard Koenig
      Keymaster

      You can get a similar result if you add some code to make attractive locations more attractive (how much more depends on the poser variable):

      // — make attractive locations even more attractive —
      for(int i = 0; i < newPop; i++)
      {
      double power = 6;
      AttractPop[i] = Math.Pow((1+AttractPop[i]), power);
      }

      That’s probably the more elegent version.

      Best regards

      Reinhard

      • #9583
        Reinhard Koenig
        Keymaster

        Small update, this should be used for making attractive locations more attractive:

        // — make attractive locations even more attractive —
        for(int i = 0; i < newPop; i++)
        {
        double power = 6;
        if (AttractPop[i]>0)
        AttractPop[i] = Math.Pow((1+AttractPop[i]), power);
        }

    • #9600
      Reinhard Koenig
      Keymaster

      Dear Martina,

      I looked into your definition. I’m not sure what your aim is. But if you assign new elements to the most attractive location, the algorithm will always choose the same location until something changed. In your case, you always select the same location and restrict the assignment of new functions by the max density setting. That’s why you cannot add new functions. This was avoided by the randomness of the roulette wheel in before.

      To help you, you need to describe what you’d like to do and what the problem is in detail.

      Best regards

      Reinhard

      • #9602
        Martina Benetollo
        Participant

        my intention is to have a point on the map, and then the first residential unit of the settlement is near this point. From there, the other residential units find their best location (which should be around the existing residential unit since in the code I write that people want to live close to other people).
        Just now I recomputed the gh definition and it worked, but as soon as i touched the c# code again, it stopped visualizing any result, even if I went back to the version of the code that was giving me outputs…

    • #9601
      Reinhard Koenig
      Keymaster

      By the way, using a lot of panels with large data output makes you definition very slow.

Viewing 4 reply threads
  • You must be logged in to reply to this topic.