📄 beta2d.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.engine.jaba;
import Jama.Matrix;
import java.util.Vector;
/**
* Created by IntelliJ IDEA.
* User: PoliMi
* Date: 25-lug-2005
* Time: 10.48.18
* To change this template use File | Settings | File Templates.
*/
public class Beta2D {
double EPSYLON = 0.0001; //costante per le approssimazioni
/**
* Dati due punti p1 e p2 il metodo ritorna le beta del settore di saturazione
* attraverso la soluzione di un sistema lineare.
* @param p1
* @param p2
* @return un settore Sector2D con le coordinate nello spazio delle Beta e i Service
* Demands associati.
*/
public Sector2D BetaCalc2D(newPoint p1,newPoint p2)
{
double[][] arraya =
{
{1,1,0,0},
{0,0,1,1},
{-p2.getX(),0,p1.getX(),0},
{0,p2.getY(),0,-p1.getY()}
};
double[][] arrayb = {{1},{1},{0},{0}};
Matrix A = new Matrix(arraya);
Matrix b = new Matrix(arrayb);
Matrix x = A.solve(b);
// Creo un nuovo settore con le soluzioni e i punti associati
Sector2D out = new Sector2D(x.get(0,0),x.get(1,0),x.get(2,0),x.get(3,0),p1,p2);
return out;
}
/**
* Dato un vettore di vertici ritorna un vettore di double[] che rappresentano
* le beta e i punti del settore a cui
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -