public code v1

This commit is contained in:
2026-05-22 11:14:29 +02:00
parent 427197ec5a
commit b8141736eb
28859 changed files with 575079 additions and 0 deletions
@@ -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 @@
/bin/
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>afryca.consensusmodel.fen2015</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>
</projectDescription>
@@ -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
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
@@ -0,0 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: afryca.consensusmodel.fen2015;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: afryca.consensusmodel,
afryca.twotuple
Automatic-Module-Name: afryca.consensusmodel.fen2015
@@ -0,0 +1,10 @@
#Properties file for afryca.consensusmodel.fen2015
Bundle-Name = Fen2015
consensusmodel_name = F. Zou et al. (2015)
consensusmodel_information = Paper: F. Zou, L. Yi, Z. Pei, J. Liu, A consensus model for multiple criteria group decision making under linguistic environment. In Computer and Information Technology, Ubiquitous Computing and Communications, Dependable, Autonomic and Secure Computing, Pervasive Intelligence and Computing (CIT/IUCC/DASC/PICOM), IEEE International Conference on (pp. 1354-1359), 2015. IEEE\\n\\n This model deals with a linguistic environment in which the evaluation values of experts take the form of 2-tuple linguistic values.
consensusmodel_features = Linguistic environment\\n2-tuple representation\\nAlgorithm to convert unacceptable 2-tuple linguistic evaluation values into the acceptable 2-tuple linguistic evaluation values.
consensusmodel_observations = No observations.
consensusmodel.zita = Consensus threshold
consensusmodel.round = Maximal number of rounds
consensusmodel.degree = Change degree
consensusmodel.similarity = Threshold of similarity between experts
@@ -0,0 +1,10 @@
#Properties file for afryca.consensusmodel.fen2015
Bundle-Name = Fen2015
consensusmodel_name = F. Zou et al. (2015)
consensusmodel_information = Paper: F. Zou, L. Yi, Z. Pei, J. Liu, A consensus model for multiple criteria group decision making under linguistic environment. In Computer and Information Technology, Ubiquitous Computing and Communications, Dependable, Autonomic and Secure Computing, Pervasive Intelligence and Computing (CIT/IUCC/DASC/PICOM), IEEE International Conference on (pp. 1354-1359), 2015. IEEE\\n\\n Este modelo trabaja con información lingüística cuyas valoraciones son proporcionadas mediante una representación en 2-tuplas.
consensusmodel_features = Información lingüística\\nRepresentanción en 2-tuplas\\nAlgoritmo que convierta valoraciones 2-tuplas inaceptables en valoraciones 2-tuplas aceptables.
consensusmodel_observations = Sin observaciones.
consensusmodel.zita = Umbral de consenso
consensusmodel.round = Máximo número de rondas de consenso permitidas
consensusmodel.degree = Grado de cambio
consensusmodel.similarity = Umbral de similitud entre expertos
@@ -0,0 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="afryca.consensusmodel">
<ConsensusModel
ConsensusModel="afryca.consensusmodel.fen2015.Fen2015"
Information="%consensusmodel_information"
MainFeatures="%consensusmodel_features"
Multicriteria="true"
Name="%consensusmodel_name"
Observations="%consensusmodel_observations"
Structure="afryca.decisionmatrix"
WithFeedback="false"
id="Fen2015">
<Variable
default_value="Math.round((experts-1)/2)"
description="%consensusmodel.zita"
id="zita"
is_array="false"
is_internal="false"
type="Operation">
<Restriction
type="lower_limit"
value="1">
</Restriction>
</Variable>
<Variable
default_value="15"
description="%consensusmodel.round"
id="h_max"
is_array="false"
is_internal="false"
type="Integer">
<Restriction
type="lower_limit"
value="0">
</Restriction>
</Variable>
<Variable
default_value="0.5"
description="%consensusmodel.degree"
id="lambda"
is_array="false"
is_internal="false"
type="Float">
<Restriction
type="lower_limit"
value="0">
</Restriction>
<Restriction
type="upper_limit"
value="1">
</Restriction>
</Variable>
<Variable
default_value="0.5"
description="%consensusmodel.similarity"
id="alpha"
is_array="false"
is_internal="false"
type="Float">
</Variable>
</ConsensusModel>
</extension>
</plugin>
@@ -0,0 +1,319 @@
package afryca.consensusmodel.fen2015;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import afryca.ase.RunnableScript;
import afryca.consensumodel.addon.E4DIAddon;
import afryca.consensusmodel.ConsensusModelMulticriteria;
import afryca.consensusmodel.definition.EResultElements;
import afryca.decisionmatrix.DecisionMatrix;
import afryca.domain.fuzzyset.FuzzySet;
import afryca.structure.Structure;
import afryca.structure.pair.Pair;
import afryca.twotuple.TwoTuple;
public class Fen2015 extends ConsensusModelMulticriteria {
private static final String CONSENSUS_MODEL_NAME = "F. Zou et al. (2015)"; //$NON-NLS-1$
private static final String ZITA = "zita"; //$NON-NLS-1$ //
private static final String LAMBDA = "lambda"; //$NON-NLS-1$
private static final String MAX_ROUNDS = "h_max"; //$NON-NLS-1$
private static final String ALPHA = "alpha"; //$NON-NLS-1$
private Integer zita;
private Float lambda;
private Float alpha;
private Integer h_max;
private FuzzySet blts;
private Integer round;
private Integer currentConsensus;
private DecisionMatrix collective;
private ArrayList<Structure> twoTuplePreferencesDM;
private Map<Integer, List<Map<Pair<Integer, Integer>, Integer>>> betas;
private Structure[] preferencesArray;
@Override
protected void setModelConfiguration() {
}
@Override
protected void obtainConfigurationValues() {
zita = Math.round((Float) configuration.getValue(ZITA));
lambda = (Float) configuration.getValue(LAMBDA);
alpha = (Float) configuration.getValue(ALPHA);
h_max = (Integer) configuration.getValue(MAX_ROUNDS);
betas = new HashMap<>();
round = 0;
transformValuationToTwoTuple();
}
@SuppressWarnings("unchecked")
private void transformValuationToTwoTuple() {
List<Structure> preferencesDM = new ArrayList<Structure>();
for (int i = 0; i < numberOfCriteria * numberOfExperts; i++) {
preferencesDM.add(preferences[i]);
}
ArrayList<Structure> unifiedValuations = (ArrayList<Structure>) ((RunnableScript) E4DIAddon.aseService.createExecutionBuilder().setFunction("Unification")
.putVariable("preferences", preferencesDM).putVariable("blts", getBLTS(preferencesDM)).execute()).getResult();
twoTuplePreferencesDM = (ArrayList<Structure>) ((RunnableScript) E4DIAddon.aseService.createExecutionBuilder().setFunction("Disunification").putVariable("preferences", unifiedValuations)
.execute()).getResult();
}
private FuzzySet getBLTS(List<Structure> preferencesDM) {
return (FuzzySet) E4DIAddon.aseService
.createFragmentBuilder()
.putVariable("preferences", preferencesDM.toArray()) //$NON-NLS-1$
.setCode("unification.getBLTS(preferences)") //$NON-NLS-1$
.setOutputType(FuzzySet.class.getName())
.eval()
.getResult();
}
@Override
protected void preFirstSaveRoundResults() {
computeDistanceDegrees();
Integer currentConsensus = getMinimunDegreeOfSimilarity();
preSaveRoundResult(1, preferencesArray, obtainVisualizeValues(), (float) currentConsensus);
result.put(EResultElements.initial_consensus_degree, currentConsensus);
result.put(EResultElements.maxround, h_max);
result.put(EResultElements.consensus_threshold, zita);
result.put(EResultElements.consensus_model, CONSENSUS_MODEL_NAME);
}
@Override
protected void preSaveRoundResults() {
Integer currentConsensus = getMinimunDegreeOfSimilarity();
preSaveRoundResult(round + 1, preferencesArray, obtainVisualizeValues(), (float) currentConsensus);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
private void computeDistanceDegrees() {
DecisionMatrix dm1, dm2;
Integer beta;
Map<Pair<Integer, Integer>, Integer> bValue;
List<Map<Pair<Integer, Integer>, Integer>> b;
betas.clear();
for (int q = 0; q < numberOfExperts; ++q) {
for (int i = 0; i < numberOfCriteria; ++i) {
dm1 = (DecisionMatrix) twoTuplePreferencesDM.get(q * numberOfCriteria + i);
for (int j = 0; j < numberOfAlternatives; ++j) {
beta = 0;
for (int k = 0; k < numberOfExperts; ++k) {
dm2 = (DecisionMatrix) twoTuplePreferencesDM.get(k * numberOfCriteria + i);
beta += computeLambda((TwoTuple) dm1.getValue(0, j), (TwoTuple) dm2.getValue(0, j));
}
if (betas.get(q) != null) {
bValue = new HashMap<>();
bValue.put(new Pair(i, j), beta);
b = betas.get(q);
b.add(bValue);
} else {
bValue = new HashMap<>();
bValue.put(new Pair(i, j), beta);
b = new ArrayList<>();
b.add(bValue);
betas.put(q, b);
}
}
}
}
}
private Integer computeLambda(TwoTuple valuation1, TwoTuple valuation2) {
if (computeSimilarityDegrees(valuation1, valuation2) >= alpha) {
return 0;
} else {
return 1;
}
}
private Integer getMinimunDegreeOfSimilarity() {
Integer beta, betaMax = -1;
for (Integer expert : betas.keySet()) {
List<Map<Pair<Integer, Integer>, Integer>> bValues = betas.get(expert);
for (Map<Pair<Integer, Integer>, Integer> bValue : bValues) {
for (Pair<Integer, Integer> pair : bValue.keySet()) {
beta = bValue.get(pair);
if (beta > zita) {
if (beta > betaMax) {
betaMax = beta;
}
}
}
}
}
if (betaMax == -1) {
currentConsensus = zita.intValue();
betaMax = zita.intValue();
} else {
currentConsensus = betaMax;
}
return betaMax;
}
private DecisionMatrix computeAggregation() {
Structure[] preferecesAux = new Structure[preferences.length - 1];
List<Structure> preferencesDM = new ArrayList<Structure>();
for (int i = 0; i < preferecesAux.length; i++) {
try {
preferecesAux[i] = (Structure) preferences[i].clone();
preferencesDM.add((Structure) preferences[i].clone());
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
}
blts = getBLTS(preferencesDM);
Object[][] collective = (Object[][]) ((RunnableScript) E4DIAddon.aseService.createExecutionBuilder().setFunction("arithmeticAggregationLPR").putVariable("preferences", preferecesAux)
.putVariable("alternatives", numberOfAlternatives).putVariable("criteria", numberOfCriteria).putVariable("experts", numberOfExperts).execute()).getResult();
if ((collective != null)) {
DecisionMatrix result = new DecisionMatrix(numberOfCriteria, numberOfAlternatives);
for (int i = 0; i < numberOfCriteria; i++) {
for (int j = 0; j < numberOfAlternatives; j++) {
result.setDomain(i, j, blts);
}
}
result.prepareStructureForPreferences(collective);
return result;
}
return new DecisionMatrix(numberOfCriteria, numberOfAlternatives);
}
private Float computeSimilarityDegrees(TwoTuple valuation1, TwoTuple valuation2) {
return (float) valuation1.similarityMeasure(valuation2);
}
@Override
protected void consensusRound() {
computeDistanceDegrees();
Integer betaMax = getMinimunDegreeOfSimilarity();
if (betaMax > zita && round < h_max) {
Map<Integer, List<Pair<Integer, Integer>>> expertsToRecommend = getExpertsToRecommend(betaMax);
collective = computeAggregation();
Float delta1, delta2;
for (Integer expert : expertsToRecommend.keySet()) {
List<Pair<Integer, Integer>> pairsToChange = expertsToRecommend.get(expert);
for (Pair<Integer, Integer> pairToChange : pairsToChange) {
delta1 = (float) ((TwoTuple) twoTuplePreferencesDM.get(expert * numberOfCriteria + pairToChange.getLeft()).getValue(0, pairToChange.getRight())).calculateInverseDelta();
delta2 = (float) ((TwoTuple) collective.getValue(pairToChange.getLeft(), pairToChange.getRight())).calculateInverseDelta();
TwoTuple twoTupleModified = new TwoTuple(blts);
twoTupleModified.calculateDelta((float) (Math.pow(delta1, lambda) * Math.pow(delta2, 1 - lambda)));
((DecisionMatrix) twoTuplePreferencesDM.get(expert * numberOfCriteria + pairToChange.getLeft())).setValue(0, pairToChange.getRight(), twoTupleModified);
}
}
round++;
}
}
private Map<Integer, List<Pair<Integer, Integer>>> getExpertsToRecommend(Integer betaMax) {
Integer beta;
Map<Integer, List<Pair<Integer, Integer>>> result = new HashMap<>();
for (Integer expert : betas.keySet()) {
List<Map<Pair<Integer, Integer>, Integer>> bValues = betas.get(expert);
for (Map<Pair<Integer, Integer>, Integer> bValue : bValues) {
for (Pair<Integer, Integer> pair : bValue.keySet()) {
beta = bValue.get(pair);
if (beta == betaMax) {
if (result.get(expert) == null) {
List<Pair<Integer, Integer>> expertP = new ArrayList<>();
expertP.add(pair);
result.put(expert, expertP);
} else {
List<Pair<Integer, Integer>> expertP = result.get(expert);
expertP.add(pair);
}
}
}
}
}
return result;
}
@Override
protected void posSaveRoundResults() {
posSaveRoundResult(preferencesArray, obtainVisualizeValues(), (float) currentConsensus, null);
}
@Override
protected boolean mustBeCarriedOutAnotherRound() {
return (round < h_max) && (currentConsensus > zita);
}
@Override
protected void saveExecutionResults() {
this.configuration.setValue(PREFERENCES, preferencesArray);
result.put(EResultElements.number_of_rounds_required, round);
result.put(EResultElements.consensus_degree_achieved, (float) currentConsensus);
}
@Override
protected void groupPreferencesByCriteria() {
computeDistanceDegrees();
getMinimunDegreeOfSimilarity();
collective = computeAggregation();
preferencesArray = new Structure[numberOfExperts+1];
DecisionMatrix dmExpert, dmByCriterion;
for (int k = 0; k < numberOfExperts; ++k) {
dmExpert = new DecisionMatrix(numberOfCriteria, numberOfAlternatives);
for (int i = 0; i < numberOfCriteria; ++i) {
dmByCriterion = (DecisionMatrix) twoTuplePreferencesDM.get(k * numberOfCriteria + i);
for (int col = 0; col < numberOfAlternatives; ++col) {
dmExpert.setValue(i, col, dmByCriterion.getValue(0, col));
dmExpert.setDomain(i, col, dmByCriterion.getDomain(0, col));
}
}
preferencesArray[k]=dmExpert;
}
preferencesArray[numberOfExperts]=collective;
}
@Override
protected Float[][][] obtainVisualizeValues() {
Float[][][] preferencesGroupVisualization=new Float[preferencesArray.length][numberOfCriteria][numberOfAlternatives];
for (int k = 0; k < preferencesArray.length; k++) {
for (int i = 0; i < numberOfCriteria; i++) {
for (int j = 0; j < numberOfAlternatives; j++) {
preferencesGroupVisualization[k][i][j] = ((TwoTuple) preferencesArray[k].getValue(i,j)).calculateInverseDelta();
}
}
}
return preferencesGroupVisualization;
}
}
@@ -0,0 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: afryca.consensusmodel.fen2015;singleton:=true
Bundle-Version: 1.0.0.202101221157
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: afryca.consensusmodel,afryca.twotuple
Automatic-Module-Name: afryca.consensusmodel.fen2015
@@ -0,0 +1,4 @@
#Fri Jan 22 13:00:50 CET 2021
artifact.main=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.fen2015\\target\\afryca.consensusmodel.fen2015-1.0.0-SNAPSHOT.jar
artifact.attached.p2artifacts=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.fen2015\\target\\p2artifacts.xml
artifact.attached.p2metadata=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.fen2015\\target\\p2content.xml
@@ -0,0 +1,3 @@
artifactId=afryca.consensusmodel.fen2015
groupId=afryca.group
version=1.0.0-SNAPSHOT
@@ -0,0 +1,13 @@
<?xml version='1.0' encoding='UTF-8'?>
<?artifactRepository version='1.1.0'?>
<artifacts size='1'>
<artifact classifier='osgi.bundle' id='afryca.consensusmodel.fen2015' version='1.0.0.202101221157'>
<properties size='5'>
<property name='artifact.size' value='10235'/>
<property name='download.size' value='10235'/>
<property name='maven-groupId' value='afryca.group'/>
<property name='maven-artifactId' value='afryca.consensusmodel.fen2015'/>
<property name='maven-version' value='1.0.0-SNAPSHOT'/>
</properties>
</artifact>
</artifacts>
@@ -0,0 +1,46 @@
<?xml version='1.0' encoding='UTF-8'?>
<units size='1'>
<unit id='afryca.consensusmodel.fen2015' version='1.0.0.202101221157' generation='2'>
<update id='afryca.consensusmodel.fen2015' range='[0.0.0,1.0.0.202101221157)' severity='0'/>
<properties size='6'>
<property name='es.Bundle-Name' value='Fen2015'/>
<property name='df_LT.Bundle-Name' value='Fen2015'/>
<property name='org.eclipse.equinox.p2.name' value='%Bundle-Name'/>
<property name='maven-groupId' value='afryca.group'/>
<property name='maven-artifactId' value='afryca.consensusmodel.fen2015'/>
<property name='maven-version' value='1.0.0-SNAPSHOT'/>
</properties>
<provides size='6'>
<provided namespace='org.eclipse.equinox.p2.iu' name='afryca.consensusmodel.fen2015' version='1.0.0.202101221157'/>
<provided namespace='osgi.bundle' name='afryca.consensusmodel.fen2015' version='1.0.0.202101221157'/>
<provided namespace='osgi.identity' name='afryca.consensusmodel.fen2015' version='1.0.0.202101221157'>
<properties size='1'>
<property name='type' value='osgi.bundle'/>
</properties>
</provided>
<provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/>
<provided namespace='org.eclipse.equinox.p2.localization' name='es' version='1.0.0'/>
<provided namespace='org.eclipse.equinox.p2.localization' name='df_LT' version='1.0.0'/>
</provides>
<requires size='3'>
<required namespace='osgi.bundle' name='afryca.consensusmodel' range='0.0.0'/>
<required namespace='osgi.bundle' name='afryca.twotuple' range='0.0.0'/>
<requiredProperties namespace='osgi.ee' match='(&amp;(osgi.ee=JavaSE)(version=1.8))'>
<description>
afryca.consensusmodel.fen2015
</description>
</requiredProperties>
</requires>
<artifacts size='1'>
<artifact classifier='osgi.bundle' id='afryca.consensusmodel.fen2015' version='1.0.0.202101221157'/>
</artifacts>
<touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
<touchpointData size='1'>
<instructions size='1'>
<instruction key='manifest'>
Bundle-SymbolicName: afryca.consensusmodel.fen2015;singleton:=true&#xA;Bundle-Version: 1.0.0.202101221157&#xA;
</instruction>
</instructions>
</touchpointData>
</unit>
</units>