⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 memoryconstraints.java

📁 一个用于排队系统仿真的开源软件,有非常形象的图象仿真过程!
💻 JAVA
字号:
/**    
  * Copyright (C) 2006, Laboratorio di Valutazione delle Prestazioni - Politecnico di Milano

  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.

  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.

  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
  
package jmt.analytical;


//TODO: per il momento considero casi semplici (non vincoli innestati, stazioni soggette a vincoli sono LI)
/**
 * This class solves a system with a memory constraint.<br>
 * A memory constraint places an upper bound on the concurrent utilization of a
 * processing resource (therefore places an upper bound on the throughput of the system).
 * <br>
 * These memory constraints violate the conditions required for the separability of the queue
 * network: the approach to solve the system is based on the concepts of FESCs (Flow Equivalent
 * Service Centers) and hierarchical modelling.
 * <br>
 * Here we consider a system with C customer classes (c = 1, 2, ... C) having only a region
 * (one or more stations) subjected to independent memory constraints (that is, a constraint for
 * each different class).
 *
 * <br><br>
 * Warning: AT THE MOMENT THE ALGORITHM OF THIS SOLVER HASN'T BEEN COMPLETED YET!
 * Warning: AT THE MOMENT THIS CLASS IS NOT USED IN JAVA MODELLING TOOLS!
 *
 * @author Stefano
 * @version 24-giu-2004 8.40.30
 */
public class MemoryConstraints {

    public final boolean DEBUG = true;


    /*
    We initially have a non-separable network.

    We decompose the model into two parts:
    1) the central subsystem plus the memory queue
    2) the external environment (that may be a terminal with N customers or a
    transaction source with arrival rate lambda)

    Then we define a load dependent center that is flow equivalent to part 1) from
    the point of view of the external environment.

    At last we analyze a model made up by the FESC and the external environment, which
    can be easily solved an which will give nearly the same results of the original model.
    */



    /**
     * the model used to describe and solve the original system without constraints
     */
    protected SolverMultiMixed solver_not_constr = null;


    /**
     * indicate which stations are subjected to memory constraint
     * (true if the station is subjected to constraints, false otherwise)
     */
    protected boolean[] subjected_stations = null;

    /**
     * one memory constraint for each class (in fact we are considering independent
     * memory constraints): a memory constraint is the maximum number of customers that can be
     * served at the same time in the specified region.
     * (-1 if the corresponding class has no constraints)
     */
    protected int[] class_constraints = null;

    /**
     * Counter of the number of class which are subjected to memory constraints
     */
    protected int constrained_classes = 0;

    /**
     * Counter of the number of stations which are subjected to memory constraints
     * (i.e. the stations included in the region subjected to memory constraints)
     */
    protected int constrained_stations = 0;

    /**
     * The class must be reordered: constrained classes are put first,
     * not constrained ones are put after.
     * This array contains the original positions, which will be restored
     * after solving the system.
     */
    protected int[] position = null;

    /**
     * For each class, number of customers in the region with memory constraints.
     * (WARNING: the class order does not correspond to the original model order!)
     */
    private double[] subsystem_customers = null;

    //during the computation, the constrained classes will be transformed into
    //batch class with a new population equal to subsystem_customers (see step2)
    private int[] new_classTypes = null;
    private double[] new_popPar = null;


    /**---------------MODEL DEFINITION------------------------*/

	/** number of service centers */
    protected int stations = 0;

	/** number of classes  */
    protected int classes = 0;

	/** array of names of service centers*/
    protected String[] name;

	/** array of types of service centers */
    protected int[] type;

	/** service times for each service station, class, population<br>
     * [station] [class] [population] */
    protected double[][][] servTime;

	/** visits for each service station, class<br>
     * [station] [class] */
    protected double[][] visits;


    /** array with class types */
	int[] classType;

    /** array describing the classes: each element can be either an
     *  arrival rate (for open classes) or a population (for closed ones),
     *  according to the class type
     */
	double[] popPar;
    /**-----------END MODEL DEFINITION------------------------*/



    /**
     * Construction of the model with memory constraint: note that this method
     * changes the original order of the classes (and of the class dependent
     * parameters) in the model description .
     *
     * @param  n   array of names of service centers.
     * @param  t   array of the types (LD or LI) of service centers.
     * @param  s   matrix of service time of the service centers.
     * @param  v   matrix of visits to the service centers.
     * @param popParam array describing the classes: each element can be either an
     * arrival rate (for open classes) or a population (for closed ones),
     * according to the class type
     * @param clsType array of class types (open or closed)
     * @param subj_stat array which indicates if a station is comprised (true) or not (false)
     * in the network region which is subjected to memory constraints
     * @param class_constr memory constraints for each class (-1 if the corresponding
     * class has no constraints)
     */
    public MemoryConstraints(String[] n, int[] t, double[][][] s, double[][] v,
	                     double[] popParam, int[] clsType, boolean[] subj_stat, int[] class_constr){

        //model definition (parameters which are independent by the presence of constraints)
        //TODO: si pu

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -