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-11"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?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.method.vikorFuzzy.phase.result</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<name>[bundle] Bundle-name</name>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>flintstones.method.vikorFuzzy.phase.result</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>1779484362709</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
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
@@ -0,0 +1,14 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-name
|
||||
Bundle-SymbolicName: flintstones.method.vikorFuzzy.phase.result;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.method.vikorFuzzy.phase.result
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Require-Bundle: flintstones.entity.method.phase,
|
||||
flintstones.helper.data,
|
||||
flintstones.entity.problemelement,
|
||||
flintstones.domain.fuzzyset,
|
||||
flintstones.model.problemelement.service
|
||||
Export-Package: flintstones.method.vikorFuzzy.phase.result
|
||||
Import-Package: javax.inject
|
||||
@@ -0,0 +1,5 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="flintstones.phasemethod.extensionpoint">
|
||||
<phase
|
||||
implementation="flintstones.method.vikorFuzzy.phase.result.FuzzyVikorResult"
|
||||
uid="flintstones.method.vikorFuzzy.phase.result">
|
||||
</phase>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
+497
@@ -0,0 +1,497 @@
|
||||
package flintstones.method.vikorFuzzy.phase.result;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.services.nls.Translation;
|
||||
|
||||
import flintstones.domain.fuzzyset.function.types.TrapezoidalFunction;
|
||||
import flintstones.entity.method.phase.PhaseMethod;
|
||||
import flintstones.entity.problemelement.entities.Alternative;
|
||||
import flintstones.entity.problemelement.entities.Criterion;
|
||||
import flintstones.entity.problemelement.entities.ProblemElement;
|
||||
import flintstones.entity.problemelement.entities.ProblemElementHelper;
|
||||
import flintstones.helper.data.HashMatrix;
|
||||
import flintstones.method.vikorFuzzy.phase.result.messages.Messages;
|
||||
import flintstones.model.problemelement.service.IProblemElementService;
|
||||
|
||||
/**
|
||||
* Ranking for Fuzzy Vikor
|
||||
*
|
||||
* @author jcfp
|
||||
*
|
||||
*/
|
||||
public class FuzzyVikorResult extends PhaseMethod {
|
||||
|
||||
@Inject
|
||||
IProblemElementService problemService;
|
||||
|
||||
@Inject
|
||||
@Translation
|
||||
Messages msg;
|
||||
|
||||
/**
|
||||
* Aggregated criteria weights
|
||||
*/
|
||||
ArrayList<TrapezoidalFunction> aggCriWeights;
|
||||
|
||||
/**
|
||||
* Aggregated valuations
|
||||
*/
|
||||
HashMatrix<ProblemElement, ProblemElement, TrapezoidalFunction> aggregatedValues;
|
||||
|
||||
/**
|
||||
* All the alternatives
|
||||
*/
|
||||
Alternative[] allAlternatives;
|
||||
|
||||
/**
|
||||
* All the criteria
|
||||
*/
|
||||
Criterion[] allCriteria;
|
||||
|
||||
/**
|
||||
* Value v for rankings
|
||||
*/
|
||||
double vValue;
|
||||
|
||||
/**
|
||||
* Best values for each criterion
|
||||
*/
|
||||
TrapezoidalFunction[] bestValues;
|
||||
|
||||
/**
|
||||
* Worst values for each criterion
|
||||
*/
|
||||
TrapezoidalFunction[] worstValues;
|
||||
|
||||
/**
|
||||
* Normalized matrix
|
||||
*/
|
||||
TrapezoidalFunction[][] normalizedDifference;
|
||||
|
||||
/**
|
||||
* Parameters
|
||||
*/
|
||||
public TrapezoidalFunction[] Sj;
|
||||
public TrapezoidalFunction[] Rj;
|
||||
public double Sor;
|
||||
public double Ror;
|
||||
public TrapezoidalFunction Sstar;
|
||||
public TrapezoidalFunction Rstar;
|
||||
public TrapezoidalFunction[] Qj;
|
||||
|
||||
/**
|
||||
* Central ranking
|
||||
*/
|
||||
public ArrayList<Integer> coreRanking;
|
||||
|
||||
/**
|
||||
* Core ranking
|
||||
*/
|
||||
public ArrayList<Boolean> fuzzyRanking;
|
||||
|
||||
/**
|
||||
* Defuzzification
|
||||
*/
|
||||
public double[] crispS;
|
||||
public double[] crispR;
|
||||
public double[] crispQ;
|
||||
|
||||
/**
|
||||
* Rankings defuzzification
|
||||
*/
|
||||
public ArrayList<Integer> rankCrispS;
|
||||
public ArrayList<Integer> rankCrispR;
|
||||
public ArrayList<Integer> rankCrispQ;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return msg.phase_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return All the criteria
|
||||
*/
|
||||
public Criterion[] getCriteria() {
|
||||
return allCriteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return All the alternatives
|
||||
*/
|
||||
public Alternative[] getAlternatives() {
|
||||
return allAlternatives;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data from previous phases
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void loadData() {
|
||||
aggCriWeights = (ArrayList<TrapezoidalFunction>) importData("aggregatedWeights");
|
||||
aggregatedValues = (HashMatrix<ProblemElement, ProblemElement, TrapezoidalFunction>) importData(
|
||||
"aggregatedValues");
|
||||
|
||||
allAlternatives = ProblemElementHelper.asAlternatives(problemService.getAll(Alternative.Type));
|
||||
allCriteria = ProblemElementHelper.asCriterions(problemService.getAll(Criterion.Type));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value for parameter v
|
||||
* @param v New value
|
||||
*/
|
||||
public void setVValue(double v) {
|
||||
vValue = v;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param a Alternative
|
||||
* @param c Criterion
|
||||
* @return Aggregated fuzzy valuation
|
||||
*/
|
||||
public TrapezoidalFunction getInitialValuation(Alternative a, Criterion c) {
|
||||
return aggregatedValues.get(a, c);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Best fuzzy values
|
||||
*/
|
||||
public TrapezoidalFunction[] getBestValues() {
|
||||
return bestValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Worst fuzzy values
|
||||
*/
|
||||
public TrapezoidalFunction[] getWorstValues() {
|
||||
return worstValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param a index of alternative
|
||||
* @param c index of criterion
|
||||
* @return Associated normalized fuzzy number
|
||||
*/
|
||||
public TrapezoidalFunction getDifference(int a, int c) {
|
||||
return normalizedDifference[a][c];
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute best and worst values for each criterion
|
||||
*/
|
||||
public void calculateBestWorst() {
|
||||
bestValues = new TrapezoidalFunction[allCriteria.length];
|
||||
worstValues = new TrapezoidalFunction[allCriteria.length];
|
||||
|
||||
TrapezoidalFunction currentTPF;
|
||||
ArrayList<Double> fuzzy_a = new ArrayList<Double>();
|
||||
ArrayList<Double> fuzzy_b = new ArrayList<Double>();
|
||||
ArrayList<Double> fuzzy_d = new ArrayList<Double>();
|
||||
|
||||
for (int c = 0; c < allCriteria.length; c++) {
|
||||
// Reset local best/worst
|
||||
fuzzy_a.clear();
|
||||
fuzzy_b.clear();
|
||||
fuzzy_d.clear();
|
||||
|
||||
for (int a = 0; a < allAlternatives.length; a++) {
|
||||
|
||||
currentTPF = aggregatedValues.get(allAlternatives[a], allCriteria[c]);
|
||||
|
||||
fuzzy_a.add(currentTPF.getA());
|
||||
fuzzy_b.add(currentTPF.getB());
|
||||
fuzzy_d.add(currentTPF.getD());
|
||||
}
|
||||
|
||||
|
||||
if (allCriteria[c].isCost()) { // Mejor = Menor
|
||||
bestValues[c] = new TrapezoidalFunction(Collections.min(fuzzy_a), Collections.min(fuzzy_b), Collections.min(fuzzy_b), Collections.min(fuzzy_d));
|
||||
worstValues[c] = new TrapezoidalFunction(Collections.max(fuzzy_a), Collections.max(fuzzy_b), Collections.max(fuzzy_b), Collections.max(fuzzy_d));
|
||||
} else { // Mejor = Mayor
|
||||
bestValues[c] = new TrapezoidalFunction(Collections.max(fuzzy_a), Collections.max(fuzzy_b), Collections.max(fuzzy_b), Collections.max(fuzzy_d));
|
||||
worstValues[c] = new TrapezoidalFunction(Collections.min(fuzzy_a), Collections.min(fuzzy_b), Collections.min(fuzzy_b), Collections.min(fuzzy_d));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute normalized decision matrix
|
||||
*/
|
||||
public void calculateDifference() {
|
||||
normalizedDifference = new TrapezoidalFunction[allAlternatives.length][allCriteria.length];
|
||||
|
||||
TrapezoidalFunction tpf;
|
||||
double n_a, n_b, n_d;
|
||||
for (int a = 0; a < normalizedDifference.length; a++) {
|
||||
for (int c = 0; c < normalizedDifference[a].length; c++) {
|
||||
|
||||
tpf = aggregatedValues.get(allAlternatives[a], allCriteria[c]);
|
||||
|
||||
if (allCriteria[c].isCost()) {
|
||||
n_a = (tpf.getA() - bestValues[c].getD()) / (worstValues[c].getD() - bestValues[c].getA());
|
||||
n_b = (tpf.getB() - bestValues[c].getB()) / (worstValues[c].getD() - bestValues[c].getA());
|
||||
n_d = (tpf.getD() - bestValues[c].getA()) / (worstValues[c].getD() - bestValues[c].getA());
|
||||
} else {
|
||||
n_a = (bestValues[c].getA() - tpf.getD()) / (bestValues[c].getD() - worstValues[c].getA());
|
||||
n_b = (bestValues[c].getB() - tpf.getB()) / (bestValues[c].getD() - worstValues[c].getA());
|
||||
n_d = (bestValues[c].getD() - tpf.getA()) / (bestValues[c].getD() - worstValues[c].getA());
|
||||
}
|
||||
|
||||
normalizedDifference[a][c] = new TrapezoidalFunction(n_a, n_b, n_b, n_d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute Sj, Rj y Qj values for each alternative and the values Sor and Ror
|
||||
*/
|
||||
public void calculateSRQ() {
|
||||
Sj = new TrapezoidalFunction[allAlternatives.length];
|
||||
Rj = new TrapezoidalFunction[allAlternatives.length];
|
||||
|
||||
TrapezoidalFunction temp, critW;
|
||||
|
||||
ArrayList<Double> s_j_a_values = new ArrayList<Double>(),
|
||||
s_j_b_values = new ArrayList<Double>(),
|
||||
s_j_d_values = new ArrayList<Double>();
|
||||
|
||||
ArrayList<Double> s_j_star_a_values = new ArrayList<Double>(),
|
||||
s_j_star_b_values = new ArrayList<Double>(),
|
||||
s_j_star_d_values = new ArrayList<Double>();
|
||||
|
||||
ArrayList<Double> r_j_a_values = new ArrayList<Double>(),
|
||||
r_j_b_values = new ArrayList<Double>(),
|
||||
r_j_d_values = new ArrayList<Double>();
|
||||
|
||||
double sum_a, sum_b, sum_d;
|
||||
|
||||
for (int a = 0; a < allAlternatives.length; a++) {
|
||||
|
||||
s_j_a_values.clear();
|
||||
s_j_b_values.clear();
|
||||
s_j_d_values.clear();
|
||||
|
||||
for (int c = 0; c < allCriteria.length; c++) {
|
||||
|
||||
critW = aggCriWeights.get(c);
|
||||
temp = normalizedDifference[a][c];
|
||||
|
||||
s_j_a_values.add(critW.getA() * temp.getA());
|
||||
s_j_b_values.add(critW.getB() * temp.getB());
|
||||
s_j_d_values.add(critW.getD() * temp.getD());
|
||||
}
|
||||
|
||||
sum_a = s_j_a_values.stream().mapToDouble(Double::doubleValue).sum();
|
||||
sum_b = s_j_b_values.stream().mapToDouble(Double::doubleValue).sum();
|
||||
sum_d = s_j_d_values.stream().mapToDouble(Double::doubleValue).sum();
|
||||
|
||||
Sj[a] = new TrapezoidalFunction(sum_a, sum_b, sum_b, sum_d);
|
||||
|
||||
s_j_star_a_values.add(sum_a);
|
||||
s_j_star_b_values.add(sum_b);
|
||||
s_j_star_d_values.add(sum_d);
|
||||
|
||||
Rj[a] = new TrapezoidalFunction(Collections.max(s_j_a_values), Collections.max(s_j_b_values),
|
||||
Collections.max(s_j_b_values), Collections.max(s_j_d_values));
|
||||
|
||||
r_j_a_values.add(Rj[a].getA());
|
||||
r_j_b_values.add(Rj[a].getB());
|
||||
r_j_d_values.add(Rj[a].getD());
|
||||
}
|
||||
|
||||
Sstar = new TrapezoidalFunction(Collections.min(s_j_star_a_values), Collections.min(s_j_star_b_values),
|
||||
Collections.min(s_j_star_b_values), Collections.min(s_j_star_d_values));
|
||||
|
||||
Rstar = new TrapezoidalFunction(Collections.min(r_j_a_values), Collections.min(r_j_b_values),
|
||||
Collections.min(r_j_b_values), Collections.min(r_j_d_values));
|
||||
|
||||
Sor = Collections.max(s_j_star_d_values);
|
||||
Ror = Collections.max(r_j_d_values);
|
||||
|
||||
computeQj();
|
||||
}
|
||||
|
||||
private void computeQj() {
|
||||
Qj = new TrapezoidalFunction[allAlternatives.length];
|
||||
|
||||
double q_a, q_b, q_d;
|
||||
for (int a = 0; a < allAlternatives.length; a++) {
|
||||
q_a = vValue * (Sj[a].getA() - Sstar.getD()) / (Sor - Sstar.getA()) + ((1 - vValue) * (Rj[a].getA() - Rstar.getD()) / (Ror - Rstar.getA()));
|
||||
q_b = vValue * (Sj[a].getB() - Sstar.getB()) / (Sor - Sstar.getA()) + ((1 - vValue) * (Rj[a].getB() - Rstar.getB()) / (Ror - Rstar.getA()));
|
||||
q_d = vValue * (Sj[a].getD() - Sstar.getA()) / (Sor - Sstar.getA()) + ((1 - vValue) * (Rj[a].getD() - Rstar.getA()) / (Ror - Rstar.getA()));
|
||||
|
||||
Qj[a] = new TrapezoidalFunction(q_a, q_b, q_b, q_d);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute rankings
|
||||
*/
|
||||
public void computeRankings() {
|
||||
computeCoreRanking();
|
||||
computeFuzzyRanking();
|
||||
computeRankingCrispS();
|
||||
computeRankingCrispR();
|
||||
computeRankingCrispQ();
|
||||
}
|
||||
|
||||
private void computeCoreRanking() {
|
||||
coreRanking = new ArrayList<>();
|
||||
|
||||
int i;
|
||||
boolean assigned;
|
||||
for (int a = 0; a < allAlternatives.length; a++) {
|
||||
|
||||
i = 0;
|
||||
assigned = false;
|
||||
|
||||
while (i < coreRanking.size() && !assigned) {
|
||||
if (Qj[a].getB() < Qj[coreRanking.get(i)].getB()) {
|
||||
coreRanking.add(i, a);
|
||||
assigned = true;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if (!assigned)
|
||||
coreRanking.add(a);
|
||||
}
|
||||
}
|
||||
|
||||
private void computeFuzzyRanking() {
|
||||
fuzzyRanking = new ArrayList<>();
|
||||
|
||||
boolean confirmed;
|
||||
int j;
|
||||
for (int i = 0; i < coreRanking.size(); i++) {
|
||||
|
||||
confirmed = true;
|
||||
j = i + 1;
|
||||
|
||||
while (j < coreRanking.size() && confirmed) {
|
||||
// Si no es el mínimo en los 3 valores, no se garantiza
|
||||
if (Qj[coreRanking.get(i)].getA() > Qj[coreRanking.get(j)].getA()
|
||||
|| Qj[coreRanking.get(i)].getB() >= Qj[coreRanking.get(j)].getB()
|
||||
|| Qj[coreRanking.get(i)].getD() > Qj[coreRanking.get(j)].getD()) {
|
||||
confirmed = false;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
fuzzyRanking.add(confirmed);
|
||||
}
|
||||
}
|
||||
|
||||
private void computeRankingCrispS() {
|
||||
TrapezoidalFunction temp;
|
||||
|
||||
crispS = new double[Sj.length];
|
||||
rankCrispS = new ArrayList<>();
|
||||
|
||||
int i;
|
||||
boolean asigned;
|
||||
for (int s = 0; s < crispS.length; s++) {
|
||||
temp = Sj[s];
|
||||
crispS[s] = (2 * temp.getB() + temp.getA() + temp.getD()) / 4;
|
||||
|
||||
i = 0;
|
||||
asigned = false;
|
||||
|
||||
while(i < rankCrispS.size() && !asigned) {
|
||||
if(crispS[s] < crispS[rankCrispS.get(i)]) {
|
||||
rankCrispS.add(i, s);
|
||||
asigned = true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if(!asigned)
|
||||
rankCrispS.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
private void computeRankingCrispR() {
|
||||
TrapezoidalFunction temp;
|
||||
|
||||
crispR = new double[Rj.length];
|
||||
rankCrispR = new ArrayList<>();
|
||||
|
||||
int i;
|
||||
boolean assigned;
|
||||
for (int r = 0; r < crispR.length; r++) {
|
||||
|
||||
temp = Rj[r];
|
||||
crispR[r] = (2d * temp.getB() + temp.getA() + temp.getD()) / 4d;
|
||||
|
||||
i = 0;
|
||||
assigned = false;
|
||||
|
||||
while(i < rankCrispR.size() && !assigned) {
|
||||
if(crispR[r] < crispR[rankCrispR.get(i)]) {
|
||||
rankCrispR.add(i, r);
|
||||
assigned = true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if(!assigned)
|
||||
rankCrispR.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
private void computeRankingCrispQ() {
|
||||
TrapezoidalFunction temp;
|
||||
|
||||
crispQ = new double[Qj.length];
|
||||
rankCrispQ = new ArrayList<>();
|
||||
|
||||
int i;
|
||||
boolean assigned;
|
||||
for (int q = 0; q < crispQ.length; q++) {
|
||||
temp = Qj[q];
|
||||
crispQ[q] = (2d * temp.getB() + temp.getA() + temp.getD()) / 4d;
|
||||
|
||||
i = 0;
|
||||
assigned = false;
|
||||
|
||||
while(i < rankCrispQ.size() && !assigned) {
|
||||
if(crispQ[q] < crispQ[rankCrispQ.get(i)]) {
|
||||
rankCrispQ.add(i, q);
|
||||
assigned = true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if(!assigned)
|
||||
rankCrispQ.add(q);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute alternative that belong to the solution set
|
||||
* @return Last alternative in the set. -1 if all of them are included
|
||||
*/
|
||||
public int calculateSolution() {
|
||||
double DQ = 1.0 / (allAlternatives.length - 1);
|
||||
|
||||
// Comprobar ventaja de la mejor crispQ (C1)
|
||||
if(crispQ[rankCrispQ.get(1)] - crispQ[rankCrispQ.get(0)] >= DQ) {
|
||||
// Comprobar estabilidad respecto crispS o crispR (C2)
|
||||
if(rankCrispQ.get(0) == rankCrispS.get(0) || rankCrispQ.get(0) == rankCrispR.get(0)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Si no se cumplen C1, conjunto de soluciones
|
||||
for(int i = 1; i < rankCrispQ.size(); i++) {
|
||||
if(crispQ[rankCrispQ.get(i)] - crispQ[rankCrispQ.get(0)] >= DQ) {
|
||||
return i-1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package flintstones.method.vikorFuzzy.phase.result.messages;
|
||||
|
||||
import org.eclipse.e4.core.services.nls.Message;
|
||||
|
||||
@Message
|
||||
public class Messages {
|
||||
public String phase_name;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
phase_name=VIKOR Results
|
||||
+1
@@ -0,0 +1 @@
|
||||
phase_name=Resultados VIKOR
|
||||
Reference in New Issue
Block a user