//error: population or rate not greater than 0.0
//prepare message according to model type (mixed, open or closed)
if (model.isMixed()) {
//mixed model -> populations or rates
throw new InputDataException("Populations and arrival rates must be greater than zero");
} else if (model.isOpen()) {
//open model -> rates
throw new InputDataException("Arrival rates must be greater than zero");
} else {
//closed model -> populations
throw new InputDataException("Populations must be greater than zero");
}
}
}
/* init */
try {
if (model.isOpen()) {
/** Edited by Abhimanyu Chugh **/
algorithmType = SolverAlgorithm.EXACT;
/** End **/
solver = new SolverMultiOpen(classes, stations, model.getClassData(), model.getStationServers());
if (!solver.input(stationNames, stationTypes, serviceTimes, visits)) {
fail("Error initializing SolverMultiOpen", null);
}
} else {
if (model.isClosed()) {
/** Edited by Abhimanyu Chugh **/
if (SolverAlgorithm.EXACT.equals(algorithmType)) {
SolverMultiClosedMVA closedsolver = new SolverMultiClosedMVA(classes, stations);
if (!closedsolver.input(stationNames, stationTypes, serviceTimes, visits, classPop)) {
fail("Error initializing MVAMultiSolver", null);
}
solver = closedsolver;
} else if (SolverAlgorithm.RECAL.equals(algorithmType)) {
int nThreads = 1;
SolverMultiClosedRECAL closedSolver = new SolverMultiClosedRECAL(classes, stations, classPop);
if (!closedSolver.input(stationTypes, serviceTimes, visits, nThreads)) {
fail("Error initializing RECALMultiSolver", null);
}
solver = closedSolver;
} else if (SolverAlgorithm.MOM.equals(algorithmType)) {
int nThreads = 1;
SolverMultiClosedMoM closedSolver = new SolverMultiClosedMoM(classes, stations, classPop);
if (!closedSolver.input(stationTypes, serviceTimes, visits, nThreads)) {
fail("Error initializing MoMMultiSolver", null);
}
solver = closedSolver;
} else if (SolverAlgorithm.COMOM.equals(algorithmType)) {
int nThreads = 1;
SolverMultiClosedCoMoM closedSolver = new SolverMultiClosedCoMoM(classes, stations, classPop);
if (!closedSolver.input(stationTypes, serviceTimes, visits, nThreads)) {
fail("Error initializing CoMoMMultiSolver", null);
}
solver = closedSolver;
} else {
double tolerance = model.getTolerance();
SolverMultiClosedAMVA closerSolver = null;
if (SolverAlgorithm.CHOW.equals(algorithmType)) {
closerSolver = new SolverMultiClosedChow(classes, stations, classPop);
} else if (SolverAlgorithm.BARD_SCHWEITZER.equals(algorithmType)) {
closerSolver = new SolverMultiClosedBardSchweitzer(classes, stations, classPop);
} else if (SolverAlgorithm.AQL.equals(algorithmType)) {
closerSolver = new SolverMultiClosedAQL(classes, stations, classPop);
} else {
closerSolver = new SolverMultiClosedLinearizer(classes, stations, classPop, SolverAlgorithm.DESOUZA_MUNTZ_LINEARIZER.equals(algorithmType));
}
((SolverMultiClosedAMVA)closerSolver).setTolerance(tolerance);
if (!closerSolver.input(stationNames, stationTypes, serviceTimes, visits)) {
String algName = algorithmType.toString().replace(" ", "").replace("-", "");
fail("Error initializing " + algName + "MultiSolver", null);
}
solver = closerSolver;
}
/** End **/
} else {
//model is multiclass mixed
/** Edited by Abhimanyu Chugh **/
algorithmType = SolverAlgorithm.EXACT;
/** End **/
int[] classTypes = mapClassTypes(model.getClassTypes());
SolverMultiMixed mixedsolver = new SolverMultiMixed(classes, stations);
if (!mixedsolver.input(stationNames, stationTypes, serviceTimes, visits, classData, classTypes)) {
fail("Error initializing SolverMultiMixed", null);
}
solver = mixedsolver;
}
}
} catch (Exception e) {
fail("Error initializing Multiclass solver", e);
}
if (!solver.hasSufficientProcessingCapacity()) {
throw new InputDataException("One or more resources are in saturation. Decrease arrival rates or service demands.");
}
long start = System.currentTimeMillis();
/* solution */