Search code examples
anylogic

the method function(Patient) in the type Main is not applicable for the arguments () anylogic


I currently have a function being checked every so often by an event block. However, I keep receiving the error 'the method function(Patient) in the type Main is not applicable for the arguments ()' when I try to run the simulation.

enter image description here

enter image description here


Solution

  • If your method requires an argument myPatient of type Patient, you must provide that if you call the method.

    So you cannot call function(). You MUST call function(somePatient) where somePatient is an agent of type Patient. It is your responsibility to provide that.

    If you call the function from a flow-chart block and it should be used for some Patient flowing through the block, you may use function(agent), but only if this key-word agent is available and if the agent flowing through is of type Patient.

    Check the fundamentals of functions in the help, this is crucial in getting functions to work for you :)