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

📄 solverdispatcher.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.gui.jaba.link;

import jmt.common.exception.InputDataException;
import jmt.common.exception.SolverException;
import jmt.engine.jaba.Calc;
import jmt.engine.jaba.Hull.ConvexHullException;
import jmt.engine.jaba.Hull.Vertex;
import jmt.engine.jaba.newPoint;
import jmt.gui.jaba.JabaConstants;
import jmt.gui.jaba.JabaModel;
import jmt.gui.jaba.JabaResults;

import java.util.Vector;


/**
 * Server side of the solver interface.<br>
 * This object takes a model, instantiates the correct solver, and solves it.<br>
 * Should probably be rewritten using a different data structure to hold model information

 * Debugged by Bertoli Marco: now uses visits correctly (31-jan-2006)

 */
public class SolverDispatcher {

	private static final boolean DEBUG = false;

	public SolverDispatcher() {
	}

	public Vector solve(JabaModel model) throws SolverException, InputDataException {

		/* disable all change-checking */
		model.discardResults();
		model.setChanged();

        Vector res = new Vector();

		try {
			if (model.getClasses()==2) {
				res=solve2classes(model);
			} else if (model.getClasses()==3) {
				res=solve3classes(model);
			}
		} catch (InputDataException rse) {
            throw rse;
        } catch (SolverException se) {
			throw se;
		} catch (Exception e) {
			fail("Unhandled exception", e);
		}

        return res;
	}

	private void fail(String message, Throwable t) throws SolverException {
		if (DEBUG) t.printStackTrace();
		StringBuffer s = new StringBuffer(message);
		if (t != null) {
			s.append("\n");
			s.append(t.toString());
		}

		throw new SolverException(s.toString(), t);
	}

    private Vector solve2classes(JabaModel model)throws Exception {
        //Solve two class models
        int stations = model.getStations();
        //Solver solver = null;
        String[] stationNames = model.getStationNames();
        String[] classNames = model.getClassNames();
        double[][][] serviceTimes = model.getServiceTimes();
        double[][] visits = model.getVisits();
        Vector vertices = new Vector();


        double prop;
        prop=100;
        

        for (int i=0;i<stations;i++)
        {
            // Crea il vettore da passare a Calc2D
            //System.out.println(i);
            // il giusto sarebbe moltiplicare per 1000000, ma d

⌨️ 快捷键说明

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