Search code examples
javaanylogic

Java Error: The constructor is undefined Anylogic Simulation Software


I can't solve this Error: Description: The constructor Request(int, Suppliers) is undefined. Location: testing/Suppliers/requestSupplier - Event

This is the Code:

Request request = new Request(uniform_discr(10,20), this);
Vehicle truck = getNearestAgentByRoute(filter(main.vehicles,
                v -> v.inState(Vehicle.AtFactory)));
if (truck != null)
send (request, truck);

Screenshot Error


Solution

  • You should not instantiate agents this way (like Java classes). Always add them to an agent population using add_MyRequestPopulation(...) where the args are your agent parameters

    So create an population of Requests and use the code above. Note that you need to specify all 4 parameters of your Request agent type