Package jmt.gui.common.distributions

Examples of jmt.gui.common.distributions.Distribution


        classTypes[i] = ExactConstants.CLASS_CLOSED;
        classData[i] = input.getClassPopulation(key).doubleValue();
      } else {
        // Open class parameters
        classTypes[i] = ExactConstants.CLASS_OPEN;
        Distribution d = (Distribution) input.getClassDistribution(key);
        if (d.hasMean()) {
          classData[i] = 1.0 / d.getMean();
        } else {
          classData[i] = 1;
          res.add(input.getClassName(key) + " arrival distribution does not have a valid mean value."
              + " Arrival rate for that class was set to default value 1");
        }
      }
    }
    // Sets extracted values to output
    output.setClassNames(classNames);
    output.setClassTypes(classTypes);
    output.setClassData(classData);
    classNames = null;
    classTypes = null;
    classData = null;

    // Exports station data
    double[][][] serviceTimes = new double[stationNum][classNum][];
    int[] stationTypes = new int[stationNum];
    String[] stationNames = new String[stationNum];
    int[] stationServers = new int[stationNum];
    for (int st = 0; st < stationNum; st++) {
      Object key = stationKeys.get(st);
      stationNames[st] = input.getStationName(key);
      Integer serverNum = input.getStationNumberOfServers(key);
      if (serverNum != null && serverNum.intValue() > 0) {
        stationServers[st] = serverNum.intValue();
      } else {
        stationServers[st] = 1;
      }
      if (input.getStationType(key).equals(CommonConstants.STATION_TYPE_DELAY)) {
        stationTypes[st] = ExactConstants.STATION_DELAY;
      } else {
        stationTypes[st] = ExactConstants.STATION_LI;
      }

      // Sets service time for each class
      for (int cl = 0; cl < classNum; cl++) {
        Object serv = input.getServiceTimeDistribution(key, classKeys.get(cl));
        if (serv instanceof Distribution) {
          Distribution d = (Distribution) serv;
          serviceTimes[st][cl] = new double[1]; // This is not load dependent
          if (d.hasMean()) {
            serviceTimes[st][cl][0] = d.getMean();
          } else {
            serviceTimes[st][cl][0] = 1;
            res.add(output.getStationNames()[st] + " service time distribution for " + output.getClassNames()[cl]
                + " does not have a valid mean value." + " Service time is set to default value 1");
          }
View Full Code Here


        boolean ok = true;
        for (int j = 0; j < classes.size(); j++) {
          Object thisClass = classes.get(j);
          Object service = station_def.getServiceTimeDistribution(thisServer, thisClass);
          if (service instanceof Distribution) {
            Distribution d = (Distribution) service;
            if (!d.getName().equals(CommonConstants.DISTRIBUTION_EXPONENTIAL)) {
              warnings[BCMP_FCFS_EXPONENTIAL_WARNING] = true;
              BCMPserversFCFSWithoutExponential.add(thisServer);
              break;
            }
          } else if (service instanceof LDStrategy) {
            LDStrategy ld = (LDStrategy) service;
            Object[] ranges = ld.getAllRanges();
            for (Object range : ranges) {
              Distribution d = ld.getRangeDistribution(range);
              if (!d.getName().equals(CommonConstants.DISTRIBUTION_EXPONENTIAL)) {
                warnings[BCMP_FCFS_EXPONENTIAL_WARNING] = true;
                BCMPserversFCFSWithoutExponential.add(thisServer);
                ok = false;
                break;
              }
View Full Code Here

          Object service = station_def.getServiceTimeDistribution(thisServer, classes.get(0));
          if (service instanceof Distribution) {
            double mean = ((Distribution) service).getMean();
            for (int j = 0; j < classes.size(); j++) {
              Object thisClass = classes.get(j);
              Distribution d = (Distribution) station_def.getServiceTimeDistribution(thisServer, thisClass);
              double thisMean = d.getMean();
              if (thisMean != mean) {
                warnings[BCMP_FCFS_DIFFERENT_SERVICE_TIMES_WARNING] = true;
                BCMPFcfsServersWithDifferentServiceTimes.add(thisServer);
                break;
              }
View Full Code Here

        Object thisDelay = delays.get(i);
        for (int j = 0; j < classes.size(); j++) {
          Object thisClass = classes.get(j);
          Object service = station_def.getServiceTimeDistribution(thisDelay, thisClass);
          if (service instanceof Distribution) {
            Distribution d = (Distribution) service;
            if (d.getName().equals(CommonConstants.DISTRIBUTION_PARETO)) {
              warnings[BCMP_DELAY_WARNING] = true;
              BCMPdelaysWithNonRationalServiceDistribution.add(thisDelay);
              break;
            }
          } else if (service instanceof LDStrategy) {
View Full Code Here

   * @param key search's key for this range
   * @param distribution distribution to set in this range
   */
  public synchronized void setRangeDistribution(Object key, Distribution distribution) {
    Range tmp = ranges.get(key);
    Distribution tmpdist = distribution.clone();
    // Preserve stored value of c, if applayable
    if (tmp.distribution.hasC() && distribution.hasC()) {
      double c = tmp.distribution.getC();
      tmpdist.setC(c);
    }
    tmpdist.setMean(tmp.distribution.getMean());
    // If old mean expression is not valid for new distribution, overwrites it
    if (tmpdist.getMean() - tmp.distribution.getMean() > 1e-5) {
      tmp.meanExpression = formatter.format(tmpdist.getMean());
    }
    tmp.distribution = tmpdist;
  }
View Full Code Here

      return;
    }
    if (values != null) {
      if (singleClass) {
        Double refAR = (Double) ((Vector) values).get(step);
        Distribution distr = (Distribution) classDef.getClassDistribution(classKey);
        distr.setMean(1 / (refAR.doubleValue()));
      } else {
        for (int i = 0; i < avaibleClasses.size(); i++) {
          Object thisClass = avaibleClasses.get(i);
          double refAR = ((ValuesTable) values).getValue(thisClass, step);
          Distribution distr = (Distribution) classDef.getClassDistribution(thisClass);
          distr.setMean(1 / refAR);
        }
      }
    }
  }
View Full Code Here

      avaibleClasses = new Vector<Object>(0, 1);
      for (int i = 0; i < allClasses.size(); i++) {
        Object thisClass = allClasses.get(i);
        Object temp = classDef.getClassDistribution(thisClass);
        if (temp instanceof Distribution) {
          Distribution distr = (Distribution) temp;
          if (distr.hasMean()) {
            avaibleClasses.add(thisClass);
          }
        }
      }
      values = new ValuesTable(classDef, avaibleClasses, numberOfSteps);
View Full Code Here

   */
  @Override
  public void restoreOriginalValues() {
    if (originalValues != null) {
      if (singleClass) {
        Distribution distr = (Distribution) classDef.getClassDistribution(classKey);
        Double rate = (Double) originalValues;
        distr.setMean(1 / (rate.doubleValue()));
      } else {
        Vector values = (Vector) originalValues;
        Vector avaibleClasses = classDef.getOpenClassKeys();
        for (int i = 0; i < avaibleClasses.size(); i++) {
          Object thisClass = avaibleClasses.get(i);
          Distribution distr = (Distribution) classDef.getClassDistribution(thisClass);
          Double thisRate = (Double) values.get(i);
          distr.setMean(1 / (thisRate.doubleValue()));
        }
      }
    }
  }
View Full Code Here

          min = Double.MAX_VALUE;
          int index = 0;

          for (int j = 0; j < classesReplication.size(); j++) {
            Object thisClass = classesReplication.get(j);
            Distribution temp = (Distribution) mediator.getClassDefinition().getClassParameter(thisClass,
                ClassDefinition.CLASS_DISTRIBUTION);
            if (temp.hasMean()) {
              mean = temp.getMean();
              if (mean < min) {
                index = j;
                min = mean;
              }
            }
View Full Code Here

    // Now scans all elements
    Element currclass;
    int type, priority;
    Integer customers;
    String name;
    Distribution defaultDistr = (Distribution) Defaults.getAsNewInstance("classDistribution");
    Object key;
    for (int i = 0; i < nodeclasses.getLength(); i++) {
      currclass = (Element) nodeclasses.item(i);
      name = currclass.getAttribute(XML_A_CLASS_NAME);
      type = currclass.getAttribute(XML_A_CLASS_TYPE).equals("closed") ? CLASS_TYPE_CLOSED : CLASS_TYPE_OPEN;
View Full Code Here

TOP

Related Classes of jmt.gui.common.distributions.Distribution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.