anyLogic root.?<PMLSettings>.i: Trying to schedule an event in the past. Negative timeout: -0.2926010883311392 - anylogic

when I run my model, sometimes the follow error occurred, it seems "Hold" process its unblock() methods
cause this.
Exception during discrete event execution:
root.?<PMLSettings>.i: Trying to schedule an event in the past. Negative timeout: -0.2926010883311392
java.lang.RuntimeException: root.?<PMLSettings>.i: Trying to schedule an event in the past. Negative timeout: -0.2926010883311392
at com.anylogic.engine.Engine.error(Unknown Source)
at com.anylogic.engine.EventOriginator.m(Unknown Source)
at com.anylogic.engine.DynamicEvent.<init>(Unknown Source)
at com.anylogic.engine.LibraryEventHandler$i.<init>(Unknown Source)
at com.anylogic.engine.LibraryEventHandler.m(Unknown Source)
at com.anylogic.engine.LibraryEventHandler.m(Unknown Source)
at com.anylogic.engine.LibraryEventHandler.c(Unknown Source)
at com.anylogic.engine.LibraryEventHandler.m(Unknown Source)
at com.anylogic.engine.LibraryEventHandler.addEvent(Unknown Source)
at com.anylogic.libraries.processmodeling.AsynchronousExecutor_xjal$a.<init>(Unknown Source)
at com.anylogic.libraries.processmodeling.AsynchronousExecutor_xjal.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock.notifyReady(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBuffer.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBuffer.take(Unknown Source)
at com.anylogic.libraries.processmodeling.Delay.stopDelay(Unknown Source)
at com.anylogic.libraries.processmodeling.MoveTo$a.onArrival(Unknown Source)
at com.anylogic.engine.l.a(Unknown Source)
at com.anylogic.engine.ca.m(Unknown Source)
at com.anylogic.engine.ca$m.execute(Unknown Source)
at com.anylogic.engine.Engine.f(Unknown Source)
at com.anylogic.engine.Engine.fn(Unknown Source)
at com.anylogic.engine.Engine$i.run(Unknown Source)
i try to set "Delay" sleep more times,but not helpanylogic

This is pretty simple and the error is telling you what you are doing wrong... You have something in your model (and it's not possible to see what it is through the error) that has a negative timeout
AnyLogic has many events happening all the time (events, dynamic events, transitions, etc) and each one of them requires a defined amount of time to be triggered.
We often use variables or functions to calculate what that timeout should be, and in your case, the calculation of that time turns out to be a negative value. You need to discover that on your own though since you don't give us enough information to tell you what it is.

Related

AnyLogic: Unreachable Target in Agent-Based-Simulation

I am building an airport model with passengers spawning, shopping/eating and departing.
Most passengers rush to their GateArea (Polygonal Node) and wait there until they feel it is appropriate to engage in discretionary activities. When they think about leaving the GateArea they generate a "Eat"- or "Shop"- Goal" and are transferred into a PedGoTo-Block that is linked to the according shop. At this point I sometimes get the error:
java.lang.RuntimeException: root.pGT_F_B2.pedGoToTarget:
Unreachable target: (599.37, 398.48) on level 'name: level' for pedestrian 'id: 46' located at: (467.15, 222.68) on level 'name: level'!
at com.anylogic.engine.Engine.error(Unknown Source)
at com.anylogic.engine.Agent.error(Unknown Source)
at com.anylogic.engine.Utilities.error(Unknown Source)
at com.anylogic.libraries.pedestrian.PedBlock_xjal.error(Unknown Source)
at com.anylogic.libraries.pedestrian.PedGoTo_xjal.d(Unknown Source)
at com.anylogic.libraries.pedestrian.PedGoTo_xjal.c(Unknown Source)
at com.anylogic.libraries.pedestrian.PedGoTo_xjal.g(Unknown Source)
at com.anylogic.libraries.pedestrian.PedGoTo_xjal.f(Unknown Source)
at com.anylogic.libraries.pedestrian.PedGoTo_xjal.d(Unknown Source)
at com.anylogic.libraries.pedestrian.PedGoTo_xjal.a(Unknown Source)
at com.anylogic.libraries.pedestrian.PedGoTo_xjal.a(Unknown Source)
at com.anylogic.libraries.pedestrian.PedGoTo_xjal$1.onEnter(Unknown Source)
at com.anylogic.libraries.processmodeling.Delay.b(Unknown Source)
at com.anylogic.libraries.processmodeling.Delay.b(Unknown Source)
at com.anylogic.libraries.processmodeling.Delay$9.onEnter(Unknown Source)
at com.anylogic.libraries.processmodeling.InputBlock$1.b(Unknown Source)
at com.anylogic.libraries.processmodeling.InPort.a(Unknown Source)
at com.anylogic.libraries.processmodeling.InPort.receiveImmediately(Unknown Source)
at com.anylogic.libraries.processmodeling.InputBlock$1.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.b(Unknown Source)
at com.anylogic.libraries.processmodeling.PlainTransfer$1.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.b(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock.forwardReadyEntityNotification(Unknown Source)
at com.anylogic.libraries.processmodeling.InputBlock$1.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.b(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock$2.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock$2.action(Unknown Source)
at com.anylogic.libraries.processmodeling.AsynchronousExecutor_xjal$a.execute(Unknown Source)
at com.anylogic.engine.LibraryEventHandler$b.execute(Unknown Source)
at com.anylogic.engine.Engine.c(Unknown Source)
at com.anylogic.engine.Engine.fi(Unknown Source)
at com.anylogic.engine.Engine.n(Unknown Source)
at com.anylogic.engine.Engine$b.run(Unknown Source)
As you can see in the picture, neither the gate nor the shop are blocked by some static obstacles. The problem seem to be between the passengers, since they seem to block each other. I tried using less passengers per flight, which delayed the problem (or even solved it when I used very small numbers). However, the passenger numbers causing the problem are realistic (around 100) and so is the sizing of the GateArea.
Is there a way to tell passengers to "push" other agents to create a pathway or another way to solve the problem without lowering the numbers (and therefore compromising the simulation quality)?
Crowded Gate with error indication
PS. This is my first question on StackOverflow, so feel free to advise me on how to improve the question. I am hoping to get enough reputation to upvote the answers at other AnyLogic questions, since they helped more than once to overcome some deadlocks.
Assuming that there really aren't any obstacles other than other pedestrians, then the parameter that can help improve your situation is the diameter of the pedestrian. Reducing it means that pedestrians can get closer to each other.
You can also change the diameter dynamically at any point of your simulation using ped.setDiameter( x ). So for example, you can set it to 0 at that specific point in time until the pedestrian leaves that area and change it back to 0.5.
Following the discussion in the comments, it appeared that the issue was not the diameter. Nonetheless, I am keeping it above as it might be the issue for someone facing a similar problem.
The real issue was that the modeler asking the question was making the agent leave the pedestrian flow chart using remove(agent). Once the agent is sent back to the flowchart using an Enter block, AnyLogic no longer recognizes that agent as a pedestrian present in the pedestrian network.
As such, instead of using Enter block, pedEnter should be used. The latter requires as input the location of the pedestrian's appearance. Since in your case the pedestrian is not really moving, just leaving the flowchart for modeling purposes, you can specify the location as the agent's current location as shown below.

capacity parameter must be greater than 0

I am trying to create an optimization experiment but when trying to run this error appears:
root.queue1:
capacity parameter must be greater than 0
java.lang.RuntimeException: root.queue1:
capacity parameter must be greater than 0
at com.anylogic.engine.Engine.error(Unknown Source)
at com.anylogic.engine.Agent.error(Unknown Source)
at com.anylogic.engine.Utilities.error(Unknown Source)
at com.anylogic.libraries.processmodeling.Queue.onCreate(Unknown Source)
at com.anylogic.engine.Agent.n(Unknown Source)
at com.anylogic.engine.Agent.n(Unknown Source)
at com.anylogic.engine.Agent.create(Unknown Source)
at com.anylogic.engine.Engine.start(Unknown Source)
at com.anylogic.engine.ExperimentOptimization$m.m(Unknown Source)
at com.anylogic.engine.j$c.run(Unknown Source)
the problem is that capacity of queue1 is greater than 0 by default, so i dont understand where i did a mistake =(
concept is i need to Implement an optimization experiment to determine the optimal number of fuel dispensers, at which the fueling profit during 10 days will be maximum.
model look like this:
You define the capacity wrong. Simply write queue_95 into the field, not queue1.capacity=queue_95.
Also, make sure that queue_95 never is 0 or lower, obviously. (Whatever queue_95 even is)

Add_people() function in Agent population and SD housing example of anylogic

I have tried to use add_people() in an event during running the Agent population and SD housing example of anylogic, in order to add more agents to the model during the simulation but I face this error.
How can I solve this problem?
[Exception during discrete event execution:
-1
java.lang.ArrayIndexOutOfBoundsException: -1
at com.anylogic.engine.Dimension.getIndexPosition(Unknown Source)
at com.anylogic.engine.HyperArray.getPosOf(Unknown Source)
at com.anylogic.engine.HyperArray.get(Unknown Source)
at agent_population_and_sd_housing.Person.makeDecision(Person.java:428)
at agent_population_and_sd_housing.Person.executeActionOf(Person.java:408)
at com.anylogic.engine.EventRate.execute(Unknown Source)
at com.anylogic.engine.Engine.m(Unknown Source)
at com.anylogic.engine.Engine.jd(Unknown Source)
at com.anylogic.engine.Engine.h(Unknown Source)
at com.anylogic.engine.Engine$g.run(Unknown Source)]
This is because in the Person agent, there is a variable called district that has an initial value of -1... (meaning that it doesn't have an assigned district).
To fix this, you need to assign a district to the new person you are creating:
This code:
Person p=add_people();
p.district=3;
Will create a person and assign a district equals to 3... I chose 3 arbitrarily and you have to figure out what district you want for that person in particular yourself.

Issue with iText when doing document.Close... Unbalanced Save Restore state operators

We have an application which was working fine as a monolith.
Now we are in the process of splitting the application
In this process, I am getting an error stating something as shown here below...
This happens only at the place of d.close()
Document d = new Document(PageSize.A4, 10, 10, 50, 50);
......
.....
finally{
if(d.isOpen()) {
d.close();
}
byteOutputStream.flush();
byteOutputStream.close();
pw.close();
return byteOutputStream.toByteArray();
}
(As a monolith the whole application was working fine)
(iText2.1.7 jar is used)
at com.ibm.CORBA.iiop.UtilDelegateImpl.mapSystemException(UtilDelegateImpl.java:241)
at javax.rmi.CORBA.Util.mapSystemException(Util.java:84)
at <<stub path>>.retrieve(_fileName1Remote_Stub.java:1)
at <<filePath>>.retrieve(fileName2.java:778)
at <<filePath>>.onCustomAction1(fileName3.java:403)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.apache.el.parser.AstValue.invoke(AstValue.java:266)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
at org.apache.myfaces.view.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:83)
at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:83)
... 43 more
Caused by: com.itextpdf.text.exceptions.IllegalPdfSyntaxException: Unbalanced save/restore state operators.
at com.itextpdf.text.pdf.PdfContentByte.sanityCheck(PdfContentByte.java:3171)
at com.itextpdf.text.pdf.PdfContentByte.toPdf(PdfContentByte.java:245)
at com.itextpdf.text.pdf.PdfFormXObject.(PdfFormXObject.java:88)
at com.itextpdf.text.pdf.PdfTemplate.getFormXObject(PdfTemplate.java:241)
at com.itextpdf.text.pdf.PdfWriter.addSharedObjectsToBody(PdfWriter.java:1257)
at com.itextpdf.text.pdf.PdfWriter.close(PdfWriter.java:1169)
at com.itextpdf.text.pdf.PdfDocument.close(PdfDocument.java:780)
at com.itextpdf.text.Document.close(Document.java:409)
at <>.createPDF(<>.java:135)
at <>.getPdfData(fileName1Bean.java:339)
at <>.retrieve(fileName1Bean.java:205)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5730)
at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:568)
at <>.retrieveIntercept(<>.java:43)
at sun.reflect.GeneratedMethodAccessor215.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:229)
at com.ibm.ejs.container.EJSContainer.invoke(EJSContainer.java:5621)
at <>_c01dfd09.retrieve(EJSRemote0SL<>Bean_c01dfd09.java)
at <>Bean_c01dfd09_Tie.retrieve(_<>Bean_c01dfd09_Tie.java:1)
at <>.invoke(<>_c01dfd09_Tie.java)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:669)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:523)
at com.ibm.rmi.iiop.ORB.process(ORB.java:523)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1575)
at com.ibm.rmi.iiop.Connection.doRequestWork(Connection.java:3039)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2922)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:64)
at com.ibm.ws.giop.threadpool.WorkQueueElement.dispatch(WorkQueueElement.java:165)
at com.ibm.ws.giop.filter.GiopFilterChain.processMessage(GiopFilterChain.java:203)
at com.ibm.ws.giop.threadpool.PooledThread.handleRequest(PooledThread.java:81)
at com.ibm.ws.giop.threadpool.PooledThread.run(PooledThread.java:102)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
So here it is...
First of all, I apologize if there was ambiguity in my question.
As said, version 2.1.7 is also used (thanks to the point made by Amedee). There is a 5.x version which I found in the shared libraries of the server.
Since the directory structure is totally different between the two versions, both the jars are maintained for a specific reason.
Also, I am new to this whole application myself and trying to get an understanding with people around in this project. When people who developed it may not be here, I thought a post may give me some idea. So, you are also partly correct Mr.Lowagie - I am ignorant on iText and doing my learning as well - I do not have a reason to Lie! :-).
Mkl, there is no exception in the try block. What eventually turned out was that the image was not getting generated or getting garbled for some other reasons. And it is being investigated. I have given this activity to a person who understands the system better than I do.
Thanks to all your mails and support my dear friends!

Processing P2D in eclipse noSuchMethodError glVertexAttribPointer(IIIZILjava/nio/Buffer;)

I'm trying to run a processing sketch in eclipse. I've been doing this for quite a while, but have only recently updated to 2.1.
The sketch runs fine when running the software mode. But when I try to use the P2D mode I get the error below.
I have included all the jogl jars from the processing folder. I'm not sure if I should add native libraries though, I can't seem to find them.
Exception in thread "Animation Thread" java.lang.RuntimeException: java.lang.NoSuchMethodError: javax.media.opengl.GL2ES2.glVertexAttribPointer(IIIZILjava/nio/Buffer;)V
at com.jogamp.common.util.awt.AWTEDTExecutor.invoke(AWTEDTExecutor.java:58)
at jogamp.opengl.awt.AWTThreadingPlugin.invokeOnOpenGLThread(AWTThreadingPlugin.java:103)
at jogamp.opengl.ThreadingImpl.invokeOnOpenGLThread(ThreadingImpl.java:206)
at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:172)
at javax.media.opengl.Threading.invoke(Threading.java:191)
at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:492)
at processing.opengl.PGL.requestDraw(PGL.java:1155)
at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:1602)
at processing.core.PApplet.run(PApplet.java:2141)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoSuchMethodError: javax.media.opengl.GL2ES2.glVertexAttribPointer(IIIZILjava/nio/Buffer;)V
at processing.opengl.PGL.vertexAttribPointer(PGL.java:3318)
at processing.opengl.PGL.drawTexture2D(PGL.java:1594)
at processing.opengl.PGL.drawTexture(PGL.java:1507)
at processing.opengl.PGL.endDraw(PGL.java:1110)
at processing.opengl.PGraphicsOpenGL.endOnscreenDraw(PGraphicsOpenGL.java:5974)
at processing.opengl.PGraphicsOpenGL.endDraw(PGraphicsOpenGL.java:1681)
at processing.core.PApplet.handleDraw(PApplet.java:2290)
at processing.opengl.PGL$PGLListener.display(PGL.java:2643)
at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:590)
at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:574)
at javax.media.opengl.awt.GLCanvas$9.run(GLCanvas.java:1218)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1036)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:911)
at javax.media.opengl.awt.GLCanvas$10.run(GLCanvas.java:1229)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
I can confirm that the GLES20 function glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, Buffer buf) is not available within JOGL's GL2ES2 API.
It has instead been replaced with glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, long ptr_buffer_offset).
The high level methodology associated with it's usage is as follows, after compiling and linking your attribute-dependent shaders within a program:
Load your vertices into a Vertex Buffer Object (VBO).
Instantiate a corresponding Index Buffer Object, used to inform OpenGL
of the order in which the VBO vertices need to be iterated through.
Bind to the VBO.
Define your call to glVertexAttribPointer, which informs OpenGL of the structure of your vertex data.
Enable the attribute using glEnableVertexAttribArray.
Bind to your Index Buffer Object.
Use glDrawElements to draw your VBO vertices in the order specified by your IBO.
Unbind from the IBO.
Disable the attribute.
Unbind from your VBO.
ptr_buffer_offset then references the internal offset within that bound buffer, therefore to read from the beginning of the buffer you can just specify 0L. The same goes for for your call to glDrawElements.