public code v1
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>flintstones.group</groupId>
|
||||
<artifactId>flintstones.bundles</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>flintstones.entity.sensitiveanalysismodel.ahp.mcm</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<name>[bundle] Most critical measure performance model</name>
|
||||
<organization>
|
||||
<name>Sinbad2</name>
|
||||
</organization>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>flintstones.entity.sensitiveanalysismodel.ahp.mcm</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>1779484362575</id>
|
||||
<name></name>
|
||||
<type>30</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
@@ -0,0 +1,16 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Most critical measure performance model
|
||||
Bundle-SymbolicName: flintstones.entity.sensitiveanalysismodel.ahp.mcm;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: Sinbad2
|
||||
Automatic-Module-Name: flintstones.entity.sensitiveanalysismodel.mcm.ahp
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Require-Bundle: flintstones.entity.sensitiveanalysismodel,
|
||||
flintstones.model.problemelement.service,
|
||||
flintstones.valuation.twoTuple,
|
||||
flintstones.valuation.numeric,
|
||||
javax.inject,
|
||||
org.eclipse.e4.core.di.annotations,
|
||||
flintstones.valuation.fuzzy
|
||||
Export-Package: flintstones.entity.sensitiveanalysismodel.ahp.mcm
|
||||
@@ -0,0 +1,5 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="flintstones.entity.sensitiveanalysismodel.extension">
|
||||
<model
|
||||
uid="flintstones.entity.sensitiveanalysismodel.mcm.ahp"
|
||||
implementation="flintstones.entity.sensitiveanalysismodel.ahp.mcm.AnalyticHierarchyProcessMCMTwoTuple"
|
||||
name="analytic hierarchy process">
|
||||
</model>
|
||||
<model
|
||||
implementation="flintstones.entity.sensitiveanalysismodel.ahp.mcm.AnalyticHierarchyProcessMCMNumeric"
|
||||
name="analytic hierarchy process"
|
||||
uid="flintstones.entity.sensitiveanalysismodel.mcm.ahp.numeric">
|
||||
</model>
|
||||
<model
|
||||
implementation="flintstones.entity.sensitiveanalysismodel.ahp.mcm.AnalyticHierarchyProcessMCMFuzzy"
|
||||
name="analytic hierarchy process"
|
||||
uid="flintstones.entity.sensitiveanalysismodel.mcm.ahp.fuzzy">
|
||||
</model>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
+360
@@ -0,0 +1,360 @@
|
||||
package flintstones.entity.sensitiveanalysismodel.ahp.mcm;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.Optional;
|
||||
|
||||
import flintstones.entity.problemelement.entities.Alternative;
|
||||
import flintstones.entity.problemelement.entities.Criterion;
|
||||
import flintstones.entity.problemelement.entities.ProblemElement;
|
||||
import flintstones.entity.sensitiveanalysismodel.SensitiveAnalysisModel;
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
import flintstones.helper.data.HashMatrix;
|
||||
import flintstones.model.problemelement.service.IProblemElementService;
|
||||
|
||||
public abstract class AnalyticHierarchyProcessMCM extends SensitiveAnalysisModel {
|
||||
|
||||
@Inject
|
||||
@Optional
|
||||
IProblemElementService problemService;
|
||||
|
||||
protected Double[] alternativesFinalPreferences;
|
||||
|
||||
protected Double[][][] absoluteThresholdValues;
|
||||
protected Double[][][] relativeThresholdValues;
|
||||
|
||||
protected List<Integer> absoluteTop;
|
||||
protected List<Integer> absoluteAny;
|
||||
protected List<Integer> relativeTop;
|
||||
protected List<Integer> relativeAny;
|
||||
|
||||
protected int numAlternatives;
|
||||
protected int numCriteria;
|
||||
|
||||
public AnalyticHierarchyProcessMCM() {}
|
||||
|
||||
public Map<ProblemElement, Double> getCriteriaWeights() {
|
||||
return criteriaWeights;
|
||||
}
|
||||
|
||||
public void setCriteriaWeights(Map<ProblemElement, Double> criteriaWeights) {
|
||||
this.criteriaWeights = criteriaWeights;
|
||||
}
|
||||
|
||||
public Double[] getAlternativesFinalPreferences() {
|
||||
return alternativesFinalPreferences;
|
||||
}
|
||||
|
||||
public void setAlternativesFinalPreferences(Double[] alternativesFinalPreferences) {
|
||||
this.alternativesFinalPreferences = alternativesFinalPreferences;
|
||||
}
|
||||
|
||||
public Double[][][] getAbsoluteThresholdValues() {
|
||||
return absoluteThresholdValues;
|
||||
}
|
||||
|
||||
public void setAbsoluteThresholdValues(Double[][][] absoluteThresholdValues) {
|
||||
this.absoluteThresholdValues = absoluteThresholdValues;
|
||||
}
|
||||
|
||||
public Double[][][] getRelativeThresholdValues() {
|
||||
return relativeThresholdValues;
|
||||
}
|
||||
|
||||
public void setRelativeThresholdValues(Double[][][] relativeThresholdValues) {
|
||||
this.relativeThresholdValues = relativeThresholdValues;
|
||||
}
|
||||
|
||||
public List<Integer> getAbsoluteTop() {
|
||||
return absoluteTop;
|
||||
}
|
||||
|
||||
public void setAbsoluteTop(List<Integer> absoluteTop) {
|
||||
this.absoluteTop = absoluteTop;
|
||||
}
|
||||
|
||||
public List<Integer> getAbsoluteAny() {
|
||||
return absoluteAny;
|
||||
}
|
||||
|
||||
public void setAbsoluteAny(List<Integer> absoluteAny) {
|
||||
this.absoluteAny = absoluteAny;
|
||||
}
|
||||
|
||||
public List<Integer> getRelativeTop() {
|
||||
return relativeTop;
|
||||
}
|
||||
|
||||
public void setRelativeTop(List<Integer> relativeTop) {
|
||||
this.relativeTop = relativeTop;
|
||||
}
|
||||
|
||||
public List<Integer> getRelativeAny() {
|
||||
return relativeAny;
|
||||
}
|
||||
|
||||
public void setRelativeAny(List<Integer> relativeAny) {
|
||||
this.relativeAny = relativeAny;
|
||||
}
|
||||
|
||||
/**
|
||||
* The most sensitive alternative is computed from the threshold values.
|
||||
*/
|
||||
@Override
|
||||
public void execute(HashMatrix<ProblemElement, ProblemElement, Valuation> decisionMatrix,
|
||||
Map<ProblemElement, Double> criteriaWeights) {
|
||||
numAlternatives = problemService.getAll(Alternative.Type).length;
|
||||
numCriteria = problemService.getMainElements(Criterion.Type).length;
|
||||
|
||||
//this.createExampleDecisionMatrix();
|
||||
//this.createExampleCriteriaWeights();
|
||||
|
||||
this.setCriteriaWeights(criteriaWeights);
|
||||
this.normalizeDecisionMatrix(decisionMatrix);
|
||||
this.computeFinalPreferences();
|
||||
this.computeRanking();
|
||||
this.computeAbsoluteThresholdValues();
|
||||
this.computeRelativeThresholdValues();
|
||||
this.computeAbsoluteTopCriticalAlternative();
|
||||
this.computeAbsoluteAnyCriticalAlternative();
|
||||
this.computeRelativeTopCriticalAlternative();
|
||||
this.computeRelativeAnyCriticalAlternative();
|
||||
}
|
||||
|
||||
public void createExampleDecisionMatrix() {
|
||||
decisionMatrix = new Double[problemService.getAll(Alternative.Type).length][problemService
|
||||
.getMainElements(Criterion.Type).length];
|
||||
decisionMatrix[0][0] = 0.3088;
|
||||
decisionMatrix[0][1] = 0.2897;
|
||||
decisionMatrix[0][2] = 0.3867;
|
||||
decisionMatrix[0][3] = 0.1922;
|
||||
|
||||
decisionMatrix[1][0] = 0.2163;
|
||||
decisionMatrix[1][1] = 0.3458;
|
||||
decisionMatrix[1][2] = 0.1755;
|
||||
decisionMatrix[1][3] = 0.6288;
|
||||
|
||||
decisionMatrix[2][0] = 0.4509;
|
||||
decisionMatrix[2][1] = 0.2473;
|
||||
decisionMatrix[2][2] = 0.1194;
|
||||
decisionMatrix[2][3] = 0.0575;
|
||||
|
||||
decisionMatrix[3][0] = 0.0240;
|
||||
decisionMatrix[3][1] = 0.1172;
|
||||
decisionMatrix[3][2] = 0.3184;
|
||||
decisionMatrix[3][3] = 0.1215;
|
||||
}
|
||||
|
||||
public void createExampleCriteriaWeights() {
|
||||
criteriaWeights = new HashMap<>();
|
||||
Criterion c1 = (Criterion) problemService.getById(Criterion.Type, "Criterion 1");
|
||||
criteriaWeights.put(c1, 0.3277);
|
||||
Criterion c2 = (Criterion) problemService.getById(Criterion.Type, "Criterion 2");
|
||||
criteriaWeights.put(c2, 0.3058);
|
||||
Criterion c3 = (Criterion) problemService.getById(Criterion.Type, "Criterion 3");
|
||||
criteriaWeights.put(c3, 0.2876);
|
||||
Criterion c4 = (Criterion) problemService.getById(Criterion.Type, "Criterion 4");
|
||||
criteriaWeights.put(c4, 0.0790);
|
||||
}
|
||||
|
||||
protected abstract void normalizeDecisionMatrix(HashMatrix<ProblemElement, ProblemElement, Valuation> decisionMatrixAggregation);
|
||||
|
||||
private void computeFinalPreferences() {
|
||||
alternativesFinalPreferences = new Double[numAlternatives];
|
||||
for (int alternative = 0; alternative < numAlternatives; alternative++) {
|
||||
alternativesFinalPreferences[alternative] = 0d;
|
||||
for (int criterion = 0; criterion < numCriteria; criterion++) {
|
||||
alternativesFinalPreferences[alternative] += decisionMatrix[alternative][criterion] *
|
||||
criteriaWeights.get(problemService.getMainElements(Criterion.Type)[criterion]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void computeRanking() {
|
||||
ranking = IntStream.range(0, alternativesFinalPreferences.length)
|
||||
.boxed().sorted((j, i) -> alternativesFinalPreferences[i].compareTo(alternativesFinalPreferences[j]))
|
||||
.mapToInt(ele -> ele).toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the indexes of the best alternatives
|
||||
* @return indexes of the best alternatives
|
||||
*/
|
||||
private List<Integer> getBestAlternatives() {
|
||||
List<Integer> bestAlternatives = new LinkedList<Integer>();
|
||||
for (int i = 0; i < numAlternatives; i++) {
|
||||
if (ranking[i] == 0)
|
||||
bestAlternatives.add(Integer.valueOf(i));
|
||||
}
|
||||
return bestAlternatives;
|
||||
}
|
||||
|
||||
private void computeAbsoluteThresholdValues() {
|
||||
absoluteThresholdValues = new Double[numAlternatives][numAlternatives][numCriteria];
|
||||
|
||||
double denominator;
|
||||
Criterion cr;
|
||||
for (int i = 0; i < numAlternatives; i++) {
|
||||
for (int j = 0; j < numAlternatives; j++) {
|
||||
for (int k = 0; k < numCriteria; k++) {
|
||||
cr = (Criterion) problemService.getMainElements(Criterion.Type)[k];
|
||||
if (i != j) {
|
||||
denominator = alternativesFinalPreferences[i] - alternativesFinalPreferences[j] + criteriaWeights.get(cr) *
|
||||
((Double) decisionMatrix[j][k] - (Double) decisionMatrix[i][k] + 1);
|
||||
if (denominator == 0)
|
||||
absoluteThresholdValues[i][j][k] = NON_FEASIBLE;
|
||||
else {
|
||||
absoluteThresholdValues[i][j][k] = (alternativesFinalPreferences[i] - alternativesFinalPreferences[j]) / denominator;
|
||||
if (absoluteThresholdValues[i][j][k] > criteriaWeights.get(cr))
|
||||
absoluteThresholdValues[i][j][k] = NON_FEASIBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void computeRelativeThresholdValues() {
|
||||
relativeThresholdValues = new Double[numAlternatives][numAlternatives][numCriteria];
|
||||
|
||||
for (int i = 0; i < numAlternatives; i++) {
|
||||
for (int j = 0; j < numAlternatives; j++) {
|
||||
for (int k = 0; k < numCriteria; k++) {
|
||||
if (absoluteThresholdValues[i][j][k] != NON_FEASIBLE) {
|
||||
if ((Double) decisionMatrix[i][k] == 0)
|
||||
relativeThresholdValues[i][j][k] = NON_FEASIBLE;
|
||||
else
|
||||
relativeThresholdValues[i][j][k] = absoluteThresholdValues[i][j][k] * (100d / (Double) decisionMatrix[i][k]);
|
||||
} else
|
||||
relativeThresholdValues[i][j][k] = NON_FEASIBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Look for the minimal change in absolute terms among the best alternative/s
|
||||
* and the rest of them
|
||||
*/
|
||||
private void computeAbsoluteTopCriticalAlternative() {
|
||||
List<Integer> bestAlternatives = getBestAlternatives();
|
||||
|
||||
absoluteTop = new LinkedList<Integer>();
|
||||
|
||||
Double minimum = Double.MAX_VALUE, change;
|
||||
for (int i = 0; i < bestAlternatives.size(); i++) {
|
||||
for (int j = 0; j < numAlternatives; j++) {
|
||||
for (int k = 0; k < numCriteria; k++) {
|
||||
change = absoluteThresholdValues[bestAlternatives.get(i)][j][k];
|
||||
if (change != NON_FEASIBLE) {
|
||||
change = Math.abs(change);
|
||||
if (change < minimum) {
|
||||
minimum = change;
|
||||
absoluteTop.clear();
|
||||
absoluteTop.add(Integer.valueOf(k));
|
||||
} else if (change == minimum)
|
||||
absoluteTop.add(Integer.valueOf(k));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Look for the minimal change in absolute terms among all the alternatives
|
||||
*/
|
||||
private void computeAbsoluteAnyCriticalAlternative() {
|
||||
|
||||
absoluteAny = new LinkedList<Integer>();
|
||||
|
||||
Double minimum = Double.MAX_VALUE, change;
|
||||
for (int i = 0; i < numAlternatives - 1; i++) {
|
||||
for (int j = i + 1; j < numAlternatives; j++) {
|
||||
for (int k = 0; k < numCriteria; k++) {
|
||||
change = absoluteThresholdValues[i][j][k];
|
||||
if (change != NON_FEASIBLE) {
|
||||
change = Math.abs(change);
|
||||
if (change < minimum) {
|
||||
minimum = change;
|
||||
absoluteAny.clear();
|
||||
absoluteAny.add(Integer.valueOf(k));
|
||||
} else if (change == minimum)
|
||||
absoluteAny.add(Integer.valueOf(k));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Look for the minimal change in relative terms among the best alternative/s
|
||||
* and the rest of them
|
||||
*/
|
||||
private void computeRelativeTopCriticalAlternative() {
|
||||
List<Integer> bestAlternatives = getBestAlternatives();
|
||||
|
||||
relativeTop = new LinkedList<Integer>();
|
||||
|
||||
Double minimum = Double.MAX_VALUE, change;
|
||||
for (int i = 0; i < bestAlternatives.size(); i++) {
|
||||
for (int j = 0; j < numAlternatives; j++) {
|
||||
for (int k = 0; k < numCriteria; k++) {
|
||||
change = relativeThresholdValues[bestAlternatives.get(i)][j][k];
|
||||
if (change != NON_FEASIBLE) {
|
||||
change = Math.abs(change);
|
||||
if (change < minimum) {
|
||||
minimum = change;
|
||||
relativeTop.clear();
|
||||
relativeTop.add(Integer.valueOf(k));
|
||||
} else if (change == minimum)
|
||||
relativeTop.add(Integer.valueOf(k));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Look for the minimal change in absolute terms among all the alternatives
|
||||
*/
|
||||
private void computeRelativeAnyCriticalAlternative() {
|
||||
|
||||
relativeAny = new LinkedList<Integer>();
|
||||
|
||||
Double minimum = Double.MAX_VALUE, change;
|
||||
for (int i = 0; i < numAlternatives - 1; i++) {
|
||||
for (int j = i + 1; j < numAlternatives; j++) {
|
||||
for (int k = 0; k < numCriteria; k++) {
|
||||
change = relativeThresholdValues[i][j][k];
|
||||
if (change != NON_FEASIBLE) {
|
||||
change = Math.abs(change);
|
||||
if (change < minimum) {
|
||||
minimum = change;
|
||||
relativeAny.clear();
|
||||
relativeAny.add(Integer.valueOf(k));
|
||||
} else if (change == minimum)
|
||||
relativeAny.add(Integer.valueOf(k));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double[][][] getChanges(FieldsChanges typeOfChange) {
|
||||
switch(typeOfChange) {
|
||||
case absolute:
|
||||
return absoluteThresholdValues;
|
||||
case relative:
|
||||
return relativeThresholdValues;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package flintstones.entity.sensitiveanalysismodel.ahp.mcm;
|
||||
|
||||
import flintstones.entity.problemelement.entities.Alternative;
|
||||
import flintstones.entity.problemelement.entities.Criterion;
|
||||
import flintstones.entity.problemelement.entities.ProblemElement;
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
import flintstones.helper.data.HashMatrix;
|
||||
import flintstones.valuation.fuzzy.FuzzyValuation;
|
||||
|
||||
public class AnalyticHierarchyProcessMCMFuzzy extends AnalyticHierarchyProcessMCM {
|
||||
|
||||
@Override
|
||||
protected void normalizeDecisionMatrix(HashMatrix<ProblemElement, ProblemElement, Valuation> decisionMatrixAggregation) {
|
||||
decisionMatrix = new Double[problemService.getAll(Alternative.Type).length][problemService.getMainElements(Criterion.Type).length];
|
||||
|
||||
int critPos = 0, altPos;
|
||||
for(ProblemElement crit: problemService.getMainElements(Criterion.Type)) {
|
||||
altPos = 0;
|
||||
for(ProblemElement alt: problemService.getAll(Alternative.Type)) {
|
||||
decisionMatrix[altPos][critPos] = ((FuzzyValuation) decisionMatrixAggregation.get(alt, crit)).getFuzzyNumber().getB();
|
||||
altPos++;
|
||||
}
|
||||
critPos++;
|
||||
}
|
||||
normalize();
|
||||
}
|
||||
|
||||
private Double[][] normalize() {
|
||||
double acum, noStandarizedValue;
|
||||
|
||||
for (int i = 0; i < numCriteria; ++i) {
|
||||
acum = sumCriteria(i);
|
||||
for (int j = 0; j < numAlternatives; ++j) {
|
||||
noStandarizedValue = (Double) decisionMatrix[j][i];
|
||||
decisionMatrix[j][i] = (double) Math.round((noStandarizedValue / acum) * 10000d) / 10000d;
|
||||
}
|
||||
}
|
||||
|
||||
return decisionMatrix;
|
||||
}
|
||||
|
||||
private double sumCriteria(int numCriterion) {
|
||||
double value = 0;
|
||||
for (int j = 0; j < numAlternatives; ++j) {
|
||||
value += Math.pow((Double) decisionMatrix[j][numCriterion], 2);
|
||||
}
|
||||
return Math.sqrt(value);
|
||||
}
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package flintstones.entity.sensitiveanalysismodel.ahp.mcm;
|
||||
|
||||
import flintstones.entity.problemelement.entities.Alternative;
|
||||
import flintstones.entity.problemelement.entities.Criterion;
|
||||
import flintstones.entity.problemelement.entities.ProblemElement;
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
import flintstones.helper.data.HashMatrix;
|
||||
import flintstones.valuation.numeric.NumericValuation;
|
||||
|
||||
public class AnalyticHierarchyProcessMCMNumeric extends AnalyticHierarchyProcessMCM {
|
||||
|
||||
@Override
|
||||
protected void normalizeDecisionMatrix(HashMatrix<ProblemElement, ProblemElement, Valuation> decisionMatrixAggregation) {
|
||||
decisionMatrix = new Double[problemService.getAll(Alternative.Type).length][problemService.getSubElements(Criterion.Type).length];
|
||||
|
||||
int critPos = 0, altPos;
|
||||
for(ProblemElement crit: problemService.getSubElements(Criterion.Type)) {
|
||||
altPos = 0;
|
||||
for(ProblemElement alt: problemService.getAll(Alternative.Type)) {
|
||||
decisionMatrix[altPos][critPos] = ((NumericValuation) decisionMatrixAggregation.get(alt, crit)).getValue();
|
||||
altPos++;
|
||||
}
|
||||
critPos++;
|
||||
}
|
||||
normalize();
|
||||
}
|
||||
|
||||
private Double[][] normalize() {
|
||||
double acum, noStandarizedValue;
|
||||
|
||||
for (int i = 0; i < numCriteria; ++i) {
|
||||
acum = sumCriteria(i);
|
||||
for (int j = 0; j < numAlternatives; ++j) {
|
||||
noStandarizedValue = (Double) decisionMatrix[j][i];
|
||||
decisionMatrix[j][i] = (double) Math.round((noStandarizedValue / acum) * 10000d) / 10000d;
|
||||
}
|
||||
}
|
||||
|
||||
return decisionMatrix;
|
||||
}
|
||||
|
||||
private double sumCriteria(int numCriterion) {
|
||||
double value = 0;
|
||||
for (int j = 0; j < numAlternatives; ++j) {
|
||||
value += Math.pow((Double) decisionMatrix[j][numCriterion], 2);
|
||||
}
|
||||
return Math.sqrt(value);
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package flintstones.entity.sensitiveanalysismodel.ahp.mcm;
|
||||
|
||||
import flintstones.entity.problemelement.entities.Alternative;
|
||||
import flintstones.entity.problemelement.entities.Criterion;
|
||||
import flintstones.entity.problemelement.entities.ProblemElement;
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
import flintstones.helper.data.HashMatrix;
|
||||
import flintstones.valuation.twoTuple.TwoTupleValuation;
|
||||
|
||||
public class AnalyticHierarchyProcessMCMTwoTuple extends AnalyticHierarchyProcessMCM {
|
||||
|
||||
@Override
|
||||
protected void normalizeDecisionMatrix(HashMatrix<ProblemElement, ProblemElement, Valuation> decisionMatrixAggregation) {
|
||||
decisionMatrix = new Double[problemService.getAll(Alternative.Type).length][problemService.getSubElements(Criterion.Type).length];
|
||||
|
||||
int critPos = 0, altPos;
|
||||
for(ProblemElement crit: problemService.getSubElements(Criterion.Type)) {
|
||||
altPos = 0;
|
||||
for(ProblemElement alt: problemService.getAll(Alternative.Type)) {
|
||||
decisionMatrix[altPos][critPos] = ((TwoTupleValuation) decisionMatrixAggregation.get(alt, crit)).calculateInverseDelta();
|
||||
altPos++;
|
||||
}
|
||||
critPos++;
|
||||
}
|
||||
normalize();
|
||||
}
|
||||
|
||||
private Double[][] normalize() {
|
||||
double acum, noStandarizedValue;
|
||||
|
||||
for (int i = 0; i < numCriteria; ++i) {
|
||||
acum = sumCriteria(i);
|
||||
for (int j = 0; j < numAlternatives; ++j) {
|
||||
noStandarizedValue = (Double) decisionMatrix[j][i];
|
||||
decisionMatrix[j][i] = (double) Math.round((noStandarizedValue / acum) * 10000d) / 10000d;
|
||||
}
|
||||
}
|
||||
|
||||
return decisionMatrix;
|
||||
}
|
||||
|
||||
private double sumCriteria(int numCriterion) {
|
||||
double value = 0;
|
||||
for (int j = 0; j < numAlternatives; ++j) {
|
||||
value += Math.pow((Double) decisionMatrix[j][numCriterion], 2);
|
||||
}
|
||||
return Math.sqrt(value);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user