Class AnimationSolver

java.lang.Object
jmt.jmch.animation.solver.AnimationSolver
Direct Known Subclasses:
GeneralSolver, PSSolver

public abstract class AnimationSolver extends Object
This is the superclass for solving the model using the Animation. Since the timer of the animation is effected by some errors (like fps...), this is a workouround to calculate the indices of the simulation. The indices are calculated based just on the arrival time and the service time of each job. The animation is used to generate the events (and also to schedule correclty the jobs, to route them to the correct station...) and then based on these events the solver calculates the indices. For single queue and router the logic is quite the same, when a job arrives, the solver checks if it is dropped or not. When a job exits the queue, the solver calculates the response time based on the time at which the previous job ended its service. For PS the situation is a little bit more complex. The solver cannot calculate the response time just based on the arrival time, the service time of this job and the completion time of the previous job. It needs also to store (or retrieve the list of the jobs from the station), and when a job enters the queue, add to each job in the queue the velocityOfProcessor * (entrance - last entrance), by doing that in the end we know quite correclty how much time every job passed in the queue. Of course for both the situation, the solver is still a little bit not totally synchronized with the animation. This because in the solver we are considering that arrival time = time at which it enters in the queue, while in the animation, the time needed to run along the first edge is not 0!
Author:
Lorenzo Torri Date: 13-may-2025 Time: 20.01
  • Field Details

    • animation

      protected AnimationClass animation
    • nQueues

      protected int nQueues
    • T

      protected double T
    • generatedJobs

      protected int generatedJobs
    • completedJobs

      protected int completedJobs
    • globalArrivalTime

      protected double globalArrivalTime
  • Constructor Details

    • AnimationSolver

      public AnimationSolver(AnimationClass animation, int nQueues)
  • Method Details

    • init

      public void init()
      Init variables, but it's also a way to reset all of them when the stop button is pressed
    • jobEntrance

      public abstract double jobEntrance(double randomArrival)
    • jobExit

      public abstract void jobExit(Job job, int index)
    • updateMeasures

      protected void updateMeasures(double responseTime, double serviceTime)
      Update the measures when a job is processed
      Parameters:
      responseTime -
    • getMeasures

      public double[] getMeasures()