Search code examples
anylogicagent

AnyLogic - Creating new Agent remove _value


I want to create a new Agent out of a database. The agent should have several parameters like material type, length, ect. My Problem is, that i get a lot of errors, trying to define my agent with java code. I think the problem results out of line 868 and 869 in my main code. AnyLogic has a problem defining the VALUE of an agent trough a code block. So how can I "delete" or remove the Agent _value; _value = ?

Here's a picture: enter image description here

I have seen a program like mine in the past WITHOUT these two lines. So I know it's possible, but I don't know how. Can anyone please help me? Thanks in advance.


Solution

  • Do not instantiate agents using MyAgent newAgent = new MyAgent(...)

    Always instantiate agents into (empty) populations using add_MyAgentPopulation(...)