改变链接的值

  • 本文关键字:链接 改变 hyperlink
  • 更新时间 :
  • 英文 :


我尝试仅为指向特定代理的链接更改链接的值。因此,我想将自己与代理集relatedPersons中的每个代理的链接设置为0.6,并保持所有其他链接不变。我可以使用ask my-out-links实现这一点吗?我的代码是:

breed [ persons person ]
undirected-link-breed [ connections connection]
connections-own [ trust ]
to setup
clear-all 
create-persons 10
[
set grouped false
]
create-connections
reset-ticks
end
to create-connections
ask persons
[ setup-connection ]
end
to setup-connection
create-connections-with other persons  
[ set trust 0.4 ]
end
to increaseConnection
let alonePersons count persons with [grouped = false]
let relatedPersons n-of (random alonePersons) persons
ask relatedPersons [
ask my-out-links [ set trust 0.6 ]
]
end
to go
increaseConnection
tick
end

我认为这是你想要的行。这并不是非常有效,因为亲密度值是由一对中的两个成员设置的,但它是直观的,除非你有很多反对者,否则它应该不是一个问题。

ask my-out-links with [member? other-end NRelatedProtesters] [ set intimacy 0.8 ]

每个抗议者都在寻找其链接,其中另一端是nrelated抗议者组的成员。

实际上,为了与你的模型保持一致,它应该是

ask my-out-relationships with [member? other-end NRelatedProtesters] [ set intimacy 0.8 ]

请注意,您的代码是不完整的。如果有人想测试它,他们将不得不填补一些缺失的部分。

最新更新