NetLogo: Subtract One Patch-set From Another -
im trying create patch-set
without having define each patch in list individually. however, in order need subtract 1 patch-set
another. in model, patches own
o2. have few selected patches in value o2 should not change. create patch-set
patches pxcor = max-pxcor
exclude these patches should hold o2 constant. have tried subtracting patch-sets, got error message saying -expected input number, got patch agentset instead.
have tried setting patch-set lists, , using remove
command modify list. however, presents problem when ask
list perform something, error ask expected agent or agentset, got list instead
.
below relevant code try build patch-set:
set ns1 (patch-set patch -8 -5 6 patch -8 -5 -5 patch -8 6 6 patch -8 6 -5 patch 8 -5 6 patch 8 -5 -5 patch 8 6 6 patch 8 6 -5) set ns2 (patch-set patch -8 0 6 patch -8 0 -5 patch 8 0 6 patch 8 0 -5 ) set ns3 (patch-set patch -4 -5 6 patch -4 -5 -5 patch 4 -5 6 patch 4 -5 -5 patch -4 6 6 patch -4 6 -5 patch 4 6 6 patch 4 6 -5) set ns4 (patch-set patch -4 0 6 patch -4 0 -5 patch 4 0 6 patch 4 0 -5 ) set ns5 (patch-set patch -8 0 0 patch 8 0 0 ) set ns6 (patch-set patch -8 -5 0 patch -8 6 0 patch 8 -5 0 patch 8 6 0 ) set ns7 (patch-set patch -4 -5 0 patch -4 6 0 patch 4 -5 0 patch 4 6 0 ) set ns8 (patch-set patch 0 0 6 patch 0 0 -5 ) set ns9 (patch-set patch 0 -5 6 patch 0 -5 -5 patch 0 6 6 patch 0 6 -5) set ns10 (patch-set patch 0 -5 0 patch 0 6 0 ) set ns11 patch 0 0 0 set ns12 (patch-set patch -4 0 0 patch 4 0 0 ) set femnodes (sentence ns1 ns2 ns3 ns4 ns5 ns6 ns7 ns8 ns9 ns10 ns11 ns12) set xmaxmin (list (patch-set patches [ pxcor = min-pxcor] patches [ pxcor = max-pxcor])) set lateral remove femnodes xmaxmin set ymaxmin (list (patch-set patches [ pycor = min-pycor ] patches [ pycor = max-pycor ])) set fb remove femnodes ymaxmin set zmaxmin (list (patch-set patches [ pzcor = min-pzcor ] patches [ pzcor = max-pzcor ])) set tp remove femnodes zmaxmin
i assume femnodes
contains patches constant o2, correct? if so, can following:
patches [ pxcor = max-pxcor , not member? self femnodes ]
to patches pxcor = max-pxcor
not in femnodes
.
so, think want xmaxmin
defined follows:
set xmaxmin patches [ (pxcor = min-pxcor or pxcor = max-pxcor) , not member? self femnodes ]
for general patch-set difference, can use:
to-report patch-set-difference [ set1 set2 ] report set1 [ not member? self set2 ] end
but think definition of xmaxmin
gave more strategy you'll want use.
Comments
Post a Comment