Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Help with Agent Problem...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99874] Help with Agent Problem...
  • From: Earl Mitchell <earl.j.mitchell at gmail.com>
  • Date: Mon, 18 May 2009 02:30:06 -0400 (EDT)

Code:


************

"Making a World of Agents and Stuff"


makeNewWorld[agents_]:=Apply[Join,Partition[Riffle[RandomReal[{-10,10},{agents,3}],RandomInteger[9,{agents,3}]],2],1]


makeNewStuff[resources_]:=RandomReal[{-10,10},{resources,3}]


agentlocations=makeNewWorld[10][[All,1;;3]];

stufflocations=makeNewStuff[5];



"The Problem of Movement"


"Agents search for nearest stuff and move along the vector between their
current position and that of the stuff."


Steplist=NestList[#+Sign[stufflocations[[Map[First[Ordering[#,1]]&,Outer[Norm[#1-#2]&,#,stufflocations,1]]]]-#]/10.&,agentlocations,2000];



Manipulate[ListPointPlot3D[{Steplist[[j]],stufflocations},PlotStyle->PointSize[Large]],{j,1,Length[Steplist],1}]
*************

How could I alter this code so that at each iteration an IF statement (or
multiple IF statements) is applied to the agents, allowing them to, say,
ignore stuff that's already found by another agent?

I've been trying to figure it out on my own for weeks... My idea's outpace
my intelligence...


  • Prev by Date: Followup quastion: Problem with parallel evaluation of integrals depending on a parameter
  • Next by Date: Re: saving initialization cells as a .m file
  • Previous by thread: Re: Followup quastion: Problem with parallel evaluation of integrals depending on a parameter
  • Next by thread: Re: Help with Agent Problem...