Ben
Ben

Reputation: 31

NetLogo: normal distribution

I have the variable "commitment" that manages across a slider but I want that the turtles take it so that the information is distributed by a normal distribution.

to uncouple
if coupled?
 [ if (couple-length > commitment ) or
     ([couple-length] of partner) > ([commitment] of partner)
    [ set coupled? false
      set couple-length 0
      ]
 end 

Upvotes: 0

Views: 513

Answers (1)

Alan
Alan

Reputation: 9620

It is hard to interpret your question, but probably you do not want a normal distribution. I suppose you are probably after something like the following, where p-breakup is the probability that a long-lived couple breaks up when this proc is called.

to-report expired?  ;; turtle proc
  report 
    coupled? and (
          (couple-length > commitment )
          or 
          ([couple-length] of partner > [commitment] of partner)
              )
end

to uncouple  ;; turtle proc
  if expired? [
    set coupled? (random-float 1 < p-breakup)
    if not coupled? [
      set couple-length 0
      ask partner [set couple-length 0]
    ]
  ] 
end

I'm assuming from your question that commitment is a global constant applying to all couples. (If not, there appears to be redundancy in your specification.) I will also note that there are better ways to handle stochastic break up. (Specifically, determine the termination date at couple formation, and keep a schedule, so that each tick you only have to work with couples whose time is up.)

Upvotes: 1

Related Questions