2017-12-14 22 views
1

을 요청하고, 인수 :Netlogo :에-보고서 중첩, 최근에 나는 Netlogo V6 코드를 작성했습니다

  • 이 또래의 영향의 총을 기준으로 특정 행동 에이전트의 영향을 변경하는 피어의 명성
  • 을에 의해 가중되는 피어의 명성은 그들의 협력 행동과 회의
  • 이제

의 가시성을 기반으로, 나는에-보고서에 대해 많이 배우고있다 그리고 나는 그것이 나에게 많은 도움이 찾을 수 내 코드를 구조화 할 때, 나는 꽤 많이 사용하고있다.

그러나, 나는 오류의 다음과 같은 유형을 얻고 유지하는 것 :

this code can't be run by a turtle, only a link error while link 14 9 running CALCULATE_CURRENT_REPUTATION called by procedure CALCULATE_REPUTATION called by procedure HORIZONTAL_INTERACT called by procedure GO_TO_MEETING called by procedure GO called by Button 'go'

누군가가 뭐가 잘못 볼 수 있는지 궁금 해서요?

나는 문제가 신고 대상인지 여부를 확인하려고 노력했지만 문제는 아닌 것으로 보입니다. 왜냐하면 모든 보고서를 단일 기능으로 결합 할 때 비슷한 링크/거북이 요청 문제가 발생하기 때문입니다.

내 직감은 내가 어떻게 든 제대로 물어 보지 않았다는 사실에 달려있다. 그런데 어떻게 변경해야 하는가?

받는-보고서 버전의 코드 : link_at_meeting의

to go_to_meeting 
    ask members [ 

    ; if go_to_meeting and meeting_organised both report true, the member goes to the meeting (which is on the belowmentioned patch-set) 
    if go_to_meeting? and meeting_organised? [ 
     move-to one-of (patch-set patch 0 0 ([neighbors] of patch 0 0)) 
     set meetings_attended meetings_attended + 1] 

    ; the members at the meeting check whether their links are also there, if so, they interact with them 
    ask members-on one-of (patch-set patch 0 0 ([neighbors] of patch 0 0)) [ 
    if link_at_meeting? [horizontal_interact] 
    ] 
    ] 
end 

[관련이없는 코드? 그리고 meeting_organised? ommitted한다]

;;;;;;;;;;;;;;AT THE MEETING;;;;;;;;;;;;;; 

to horizontal_interact 
    set subjective_norm_list [] 
    set links_at_meeting my-out-links with [[patch-here] of other-end = (one-of (patch-set patch 0 0 ([neighbors] of patch 0 0)))] 
    if any? links_at_meeting [ 
    repeat number_of_interactions_per_meeting [ 
     ask one-of links_at_meeting [ 
     set influence_given (calculate_reputation end2 end1) * [attitude] of end2 * [intrinsic_trust] of end1 
     set number_of_encounters number_of_encounters + 1 
     ask myself [set subjective_norm_list lput [influence_given] of myself subjective_norm_list] 
     ] 
    ] 
    set subjective_norm sum subjective_norm_list 
    print subjective_norm_list 
    print subjective_norm 
    ] 
end 

; a = end 2 
; b = end 1 
to-report calculate_reputation[a b] 
set reputation_now calculate_current_reputation 
    ;reputation history is the cooperative behavior and visibility history of the link 
    set reputation_h lput reputation_now reputation_h 

    ifelse length reputation_h < ([memory] of b) 
    ;if the links have encountered less than a member's memory, that is, the member recounts every memory, take the link's reputation to be the mean of every coop_b in the reputation history 
    [let reputations sum reputation_h 
    set reputation_total (reputations/(length reputation_h))] 

    ;else, go so far as memory stretches and take the mean cooperative behavior in the reputation history as the link's reputation 
    [let reputations sum sublist reputation_h (length reputation_h - ([memory] of b)) (length reputation_h) 
     set reputation_total (reputations/([memory] of b))] 

    report reputation_total 
end 

to-report calculate_current_reputation 
    report ((100 - behavioral_transparency)/100 * calculate_visibility + behavioral_transparency * calculate_coop_b) 
end 


to-report calculate_visibility 
    report number_of_encounters/([meetings_attended] of end1) 
end 

to-report calculate_coop_b 
    ask end1 [ 
    set shares_bought_total sum [shares_bought] of my-out-links 
    set energy_gap_total (sum [energy_consumed] of my-out-links - sum [energy_generated] of my-out-links) 
    ] 
    report ([shares_bought] of end2/[shares_bought_total] of end1 + [energy_gap] of end2/[energy_gap_total] of end1) 
end 

답변

1

나는, 그래서 여기에 문제가 자신에 오는 해결책과 문제가 유사한 문제를 가진 사람들을 위해 설명했습니다

그것은 함수 calculate_coop_b에 구문 문제가 있었다. 문제는 내가 아웃 - 링크의 변수를 [주식을 샀다] 물었다. 그러나 실제로 나는 아웃 - 링크 - 이웃의 주식을 물어볼 생각이었다.

이 기능에 대한 올바른 코드 :

to-report calculate_coop_b 
    ask end1 [ 
    set shares_bought_total sum [shares_bought] of out-link-neighbors 
    set energy_gap_total (sum [energy_consumed] of out-link-neighbors - sum [energy_generated] of out-link-neighbors) 
    ] 
    report ([shares_bought] of end2/[shares_bought_total] of end1 + [energy_gap] of end2/[energy_gap_total] of end1) 
end 

나는이 판명되지 않은 문제의 원인이 될 수에도 불구하고,이 페이지는 여전히 중첩에-보고서 기능을 사용할 수있는 방법을 다른 사람에게 보여 희망 결국 나를 위해.

읽어 주셔서 감사합니다, bye!