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.quesada2015</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,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
line.separator=\n
@@ -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,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: afryca.consensusmodel.quesada2015;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: afryca.consensusmodel
Automatic-Module-Name: afryca.consensusmodel.quesada2015
@@ -0,0 +1,16 @@
#Properties file for afryca.consensusmodel.quesada2015
Bundle-Vendor = Sinbad\u00B2
Bundle-Name = Quesada2015
afryca.consensusmodel.quesada2015.information = Paper: F.J. Quesada, I. Palomares, L. Mart\u00EDnez, Managing Experts Behavior in Large-Scale Consensus Reaching Processes with Uninorm Aggregation Operators. Applied Soft Computing, submitted\\n\\n This consensus model extends the one presented in Palomares et al. (FUZZ-IEEE 2014) by introducing an approach based on uninorm aggregation operators to manage the behavior of experts in the consensus process. Due to the full reinforcement property of uninorm operators, they allow to weight experts based not only on their behavior at the current round, but also on their previous behavior since the beginning of the discussion. Furthermore, this approach reinforces positively or negatively the weight of experts with a repeated good or bad behavior, respectively, in several consensus rounds.
afryca.consensusmodel.quesada2015.mainfeature = Fuzzy preference relations\\nComputation of weights for experts\\nUninorm aggregation operators\\nFeedback mechanism
afryca.consensusmodel.quesada2015.name = F. Quesada et al. (2015)
afryca.consensusmodel.quesada2015.observations = \u0020
afryca.consensusmodel.quesada2015.variable.mu.description = Consensus degree threshold
afryca.consensusmodel.quesada2015.variable.max_rounds.description = Maximum number of discussion rounds allowed
afryca.consensusmodel.quesada2015.variable.acceptability_threshold.description = Acceptability threshold
afryca.consensusmodel.quesada2015.variable.alpha.description = Lower parameter of the linguistic quantifier used to weight experts based on their cooperation coefficient (its value may increase as the consensus process goes on)
afryca.consensusmodel.quesada2015.variable.beta.description = Higher parameter of the linguistic quantifier used to weight experts based on their cooperation coefficient (its value may increase as the consensus process goes on)
afryca.consensusmodel.quesada2015.variable.increment.description = Increment of alpha and beta parameters in the quantifier
afryca.consensusmodel.quesada2015.variable.h_start.description = Consensus round from which the membership function parameters of the linguistic quantifier start increasing, thus becoming more strict with the meaning of cooperativeness
afryca.consensusmodel.quesada2015.variable.eta.description = Controls the degree of penalization when computing the cooperation coefficient
afryca.consensusmodel.quesada2015.variable.g.description = Neutral element of the uninorm operator used to weight experts based on their behavior
@@ -0,0 +1,16 @@
#Archivo de propiedades para afryca.consensusmodel.quesada2015
Bundle-Vendor = Sinbad\u00B2
Bundle-Name = Quesada2015
afryca.consensusmodel.quesada2015.information = Artículo: F.J. Quesada, I. Palomares, L. Mart\u00EDnez, Managing Experts Behavior in Large-Scale Consensus Reaching Processes with Uninorm Aggregation Operators. Applied Soft Computing, submitted\\n\\nEste modelo de consenso extiende el presentado por Palomares et al. (FUZZ-IEEE 2014) introduciendo un enfoque basado en operadores de agregación de uninorma para gestionar el comportamiento de los expertos en el proceso de consenso. Debido al refuerzo de los operadores uninorma, el peso de los expertos se basa no solo en su comportamiento en la ronda actual, sino en su comportamiento desde el comienzo de la discusión. Además, este enfoque refuerza positiva o negativamente el peso de los expertos con un comportamiento repetidamente bueno o malo en varios rondas de consenso.
afryca.consensusmodel.quesada2015.mainfeature = Relaciones de preferencia difusas\\nCálculo de los pesos de los expertos\\nOperador de agregación uninorma\\nMecanismo de feedback
afryca.consensusmodel.quesada2015.name = F. Quesada et al. (2015)
afryca.consensusmodel.quesada2015.observations = \u0020
afryca.consensusmodel.quesada2015.variable.mu.description = Umbral de consenso
afryca.consensusmodel.quesada2015.variable.max_rounds.description = Máximo número de rondas de discusión permitido
afryca.consensusmodel.quesada2015.variable.epsilon.description = Umbral de aceptabilidad
afryca.consensusmodel.quesada2015.variable.alpha.description = Mínimo parámetro del cuantificador lingüístico usado para los pesos de los expertos en base a su coeficiente de cooperación (su valor se incrementará a medida que avance el proceso de consenso)
afryca.consensusmodel.quesada2015.variable.beta.description = Máximo parámetro del cuantificador lingüístico usado para los pesos de los expertos en base a su coeficiente de cooperación (su valor se incrementará a medida que avance el proceso de consenso)
afryca.consensusmodel.quesada2015.variable.increment.description = Incremento de los parámetros alpha y beta en el cuantificador
afryca.consensusmodel.quesada2015.variable.h_start.description = Rondas de consenso desde las cuales los parámetros de la función de pertenencia del cuantificador lingüístico comienzan a incrementarse para hacer más estricto el sentido de la cooperación
afryca.consensusmodel.quesada2015.variable.eta.description = Controla el grado de penalización cuando se calcula el coeficiente de cooperación
afryca.consensusmodel.quesada2015.variable.g.description = Elemento neutral del operador de univorma usado para controlar el peso de los expertos en base a su comportamiento
@@ -0,0 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
OSGI-INF/
@@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="afryca.consensusmodel">
<ConsensusModel
ConsensusModel="afryca.consensusmodel.Quesada2015"
Information="%afryca.consensusmodel.quesada2015.information"
MainFeatures="%afryca.consensusmodel.quesada2015.mainfeature"
Multicriteria="false"
Name="%afryca.consensusmodel.quesada2015.name"
Observations="%afryca.consensusmodel.quesada2015.observations"
Structure="afryca.fpr"
WithFeedback="true"
id="Quesada2015">
<Variable
default_value="0.85"
description="%afryca.consensusmodel.quesada2015.variable.mu.description"
id="mu"
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="15"
description="%afryca.consensusmodel.quesada2015.variable.max_rounds.description"
id="max_rounds"
is_array="false"
is_internal="false"
type="Integer">
<Restriction
type="lower_limit"
value="1">
</Restriction>
</Variable>
<Variable
default_value="0.05"
description="%afryca.consensusmodel.quesada2015.variable.acceptability_threshold.description"
id="epsilon"
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.2"
description="%afryca.consensusmodel.quesada2015.variable.alpha.description"
id="alpha"
is_array="false"
is_internal="false"
type="Float">
<Restriction
type="lower_limit"
value="0">
</Restriction>
<Restriction
type="upper_limit"
value="0.9">
</Restriction>
<Relation
type="lower_than"
variable="beta">
</Relation>
</Variable>
<Variable
default_value="0.6"
description="%afryca.consensusmodel.quesada2015.variable.beta.description"
id="beta"
is_array="false"
is_internal="false"
type="Float">
<Restriction
type="lower_limit"
value="0.1">
</Restriction>
<Restriction
type="upper_limit"
value="1">
</Restriction>
<Relation
type="greater_than"
variable="alpha">
</Relation>
</Variable>
<Variable
default_value="0.1"
description="%afryca.consensusmodel.quesada2015.variable.increment.description"
id="increment"
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="4"
description="%afryca.consensusmodel.quesada2015.variable.h_start.description"
id="h_start"
is_array="false"
is_internal="false"
type="Integer">
<Restriction
type="lower_limit"
value="2">
</Restriction>
<Relation
type="lower_than"
variable="max_rounds">
</Relation>
</Variable>
<Variable
default_value="0.5"
description="%afryca.consensusmodel.quesada2015.variable.eta.description"
id="eta"
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="%afryca.consensusmodel.quesada2015.variable.g.description"
id="g"
is_array="false"
is_internal="false"
type="Float">
<Restriction
type="lower_limit"
value="0.1">
</Restriction>
<Restriction
type="upper_limit"
value="0.99">
</Restriction>
</Variable>
</ConsensusModel>
</extension>
</plugin>
@@ -0,0 +1,483 @@
package afryca.consensusmodel;
import java.util.HashSet;
import java.util.Set;
import afryca.cm.CM;
import afryca.consensusmodel.definition.EResultElements;
import afryca.fpr.FPR;
import afryca.structure.Structure;
/**
* Quesada2015 consensus model
*
* @author Sinbad²
* @version 3.0
*/
public class Quesada2015 extends ConsensusModel {
private static final String CONSENSUS_MODEL_NAME = "F. Quesada et al. (2015)"; //$NON-NLS-1$
private static final String MU = "mu"; //$NON-NLS-1$
private static final String MAX_ROUNDS = "max_rounds"; //$NON-NLS-1$
private static final String EPSILON = "epsilon"; //$NON-NLS-1$
private static final String ALPHA = "alpha"; //$NON-NLS-1$
private static final String BETA = "beta"; //$NON-NLS-1$
private static final String INCREMENT = "increment"; //$NON-NLS-1$
private static final String H_START = "h_start"; //$NON-NLS-1$
private static final String ETA = "eta"; //$NON-NLS-1$
private static final String G = "g"; //$NON-NLS-1$
private Float mu;
private Integer maxrounds;
private Float epsilon;
private Float alpha;
private Float beta;
private Float increment;
private Integer h_start;
private Float eta;
private Float g;
private Float[] weights;
private Float[] normalizedWeights;
private Integer[][] behaviorsOfExperts;
private float[] ccs;
private float[] cdt;
private int h;
private Float cr;
private int[] advises;
private Set<Integer> expertsWithoutWeight;
@Override
protected void setModelConfiguration() {
}
@Override
protected void obtainConfigurationValues() {
mu = (Float) configuration.getValue(MU);
maxrounds = (Integer) configuration.getValue(MAX_ROUNDS);
epsilon = (Float) configuration.getValue(EPSILON);
alpha = (Float) configuration.getValue(ALPHA);
beta = (Float) configuration.getValue(BETA);
increment = (Float) configuration.getValue(INCREMENT);
h_start = (Integer) configuration.getValue(H_START);
eta = (Float) configuration.getValue(ETA);
g = (Float) configuration.getValue(G);
weights = new Float[numberOfExperts];
normalizedWeights = new Float[numberOfExperts];
float w = 1f / (float) numberOfExperts;
for (int i = 0; i < numberOfExperts; i++) {
weights[i] = g;
normalizedWeights[i] = w;
}
behaviorsOfExperts = null;
ccs = new float[numberOfExperts];
cdt = new float[numberOfExperts];
h = 0;
cr = 0f;
advises = null;
expertsWithoutWeight = new HashSet<Integer>();
}
@Override
protected Float[][][] obtainVisualizeValues() {
Structure[] auxPreferences = (Structure[]) clonePreferencesUnion(preferences, ConsensusEngine.groupPreferences(numberOfExperts, numberOfAlternatives, preferences, normalizedWeights));
Float[][][] preferencesGroupVisualization = new Float[numberOfExperts + 1][numberOfAlternatives][numberOfAlternatives];
for (int k = 0; k < numberOfExperts+1; k++) {
preferencesGroupVisualization[k] = auxPreferences[k].obtainVisualizeValues();
}
return preferencesGroupVisualization;
}
@Override
protected void preFirstSaveRoundResults() {
int round = 1;
Structure[] auxPreferences = (Structure[]) clonePreferencesUnion(preferences, ConsensusEngine.groupPreferences(numberOfExperts, numberOfAlternatives, preferences, normalizedWeights));
CM[][] sm_matrices = ConsensusEngine.similarityMatrices(numberOfExperts, numberOfAlternatives, auxPreferences);
CM cm = ConsensusEngine.consensusMatrixBasedOnSimilarityBetweenFPRs(numberOfExperts, numberOfAlternatives, sm_matrices, weights);
Float[] ac = ConsensusEngine.computeAlternativesConsensus(numberOfAlternatives, cm);
Float consensusDegreeAchieved = ConsensusEngine.consensusBasedOnAlternativesConsensus(numberOfAlternatives, ac);
preSaveRoundResult(round, auxPreferences,obtainVisualizeValues(), consensusDegreeAchieved);
result.put(EResultElements.initial_consensus_degree, consensusDegreeAchieved);
result.put(EResultElements.maxround, maxrounds);
result.put(EResultElements.consensus_threshold, mu);
result.put(EResultElements.consensus_model, CONSENSUS_MODEL_NAME);
}
@Override
protected void preSaveRoundResults() {
preSaveRoundResult(h + 1, preferences,obtainVisualizeValues(), cr);
}
@Override
protected void consensusRound() {
computeCollective();
CM[] proximityMatrices = ConsensusEngine.similarityMatricesRespectCollective(numberOfExperts, numberOfAlternatives, preferences, (FPR) preferences[numberOfExperts]);
CM[][] sm_matrices = ConsensusEngine.similarityMatrices(numberOfExperts, numberOfAlternatives, preferences);
eliminateExpertsSimilarityMatrices(sm_matrices);
CM cm = ConsensusEngine.consensusMatrixBasedOnSimilarityBetweenFPRs(numberOfExperts, numberOfAlternatives, sm_matrices, weights);
Float[] ac = ConsensusEngine.computeAlternativesConsensus(numberOfAlternatives, cm);
computeConsensusDegree(ac);
setLinguisticQuantifierValues();
advises = null;
if (cr < mu) {
eliminateExpertsProximityMatrices(proximityMatrices);
CM proximityAverageMatrix = ConsensusEngine.similarityAverageMatrix(numberOfExperts, numberOfAlternatives, proximityMatrices);
Boolean[][] pairsOfAlternativesToChange = identifyPairsOfAlternativesToChange(numberOfAlternatives, ac, cr, cm);
Boolean[][][] changePairsOfAlternativesByExperts = identifyChangePairsOfAlternativesByExperts(numberOfExperts, numberOfAlternatives, pairsOfAlternativesToChange, proximityMatrices, proximityAverageMatrix);
EChangeType[][][] changes = calculeChanges(numberOfExperts, numberOfAlternatives, changePairsOfAlternativesByExperts, (Structure[]) preferences, epsilon);
behaviorsOfExperts = makeChanges(numberOfExperts, numberOfAlternatives, (Structure[]) preferences, changes);
advises = new int[numberOfExperts];
for (int expert = 0; expert < numberOfExperts; expert++) {
advises[expert] = 0;
for (int a1 = 0; a1 < numberOfAlternatives; a1++) {
for (int a2 = 0; a2 < numberOfAlternatives; a2++) {
if (changes[expert][a1][a2] != EChangeType.NotChange) {
advises[expert] = advises[expert] + 1;
}
}
}
}
h++;
}
}
private void computeCollective(){
preferences[numberOfExperts] = ConsensusEngine.groupPreferences(numberOfExperts, numberOfAlternatives, preferences, normalizedWeights);
}
private void computeConsensusDegree(Float[] consensusOnAlternatives){
cr = ConsensusEngine.consensusBasedOnAlternativesConsensus(numberOfAlternatives, consensusOnAlternatives);
}
/**
* Eliminate experts' similarity matrices whose weight is equal to 0
* @param sm_matrices
* Similarity matrices
*/
private void eliminateExpertsSimilarityMatrices(CM[][] sm_matrices) {
for(int k = 0; k < numberOfExperts - 1; ++k) {
for(int l = k + 1; l < numberOfExperts; ++l) {
if(weights[k] == 0) {
sm_matrices[k][l] = null;
expertsWithoutWeight.add(k);
} else if(weights[l] == 0) {
sm_matrices[k][l] = null;
expertsWithoutWeight.add(l);
}
}
}
}
/**
* Eliminate experts' proximity matrices whose weight is equal to 0
* @param proximityMatrices
* Proximity matrices
*/
private void eliminateExpertsProximityMatrices(CM[] proximityMatrices) {
for(int i = 0; i < proximityMatrices.length; ++i) {
if(expertsWithoutWeight.contains(i)) {
proximityMatrices[i] = null;
}
}
}
@Override
protected void posSaveRoundResults() {
computeCollective();
CM[][] sm_matrices = ConsensusEngine.similarityMatrices(numberOfExperts, numberOfAlternatives, preferences);
eliminateExpertsSimilarityMatrices(sm_matrices);
CM cm = ConsensusEngine.consensusMatrixBasedOnSimilarityBetweenFPRs(numberOfExperts, numberOfAlternatives, sm_matrices, weights);
Float[] ac = ConsensusEngine.computeAlternativesConsensus(numberOfAlternatives, cm);
computeConsensusDegree(ac);
posSaveRoundResult(preferences,obtainVisualizeValues(), cr, advises, preferences[numberOfExperts]);
}
@Override
protected boolean mustBeCarriedOutAnotherRound() {
return (cr < mu) && (h < maxrounds);
}
@Override
protected void saveExecutionResults() {
this.configuration.setValue(PREFERENCES, preferences);
result.put(EResultElements.number_of_rounds_required, h);
result.put(EResultElements.consensus_degree_achieved, cr);
}
private void setLinguisticQuantifierValues() {
if (h >= (h_start - 1)) {
if (alpha < 0.9f) {
if ((alpha + increment) < 0.9f) {
alpha += increment;
} else {
alpha = 0.9f;
}
}
if (beta < 1f) {
if ((beta + increment) < 1f) {
beta += increment;
} else {
beta = 1f;
}
}
}
// Behavior management
if (h > 0) {
float leftPart;
float ratioAdvices;
float rightPart;
float eta2 = 1f - eta;
float differenceAdvices;
float totalNumberOfAssesments = ((float) numberOfAlternatives) * (((float) numberOfAlternatives) - 1f);
for (int i = 0; i < numberOfExperts; i++) {
if (behaviorsOfExperts[i][0] == 0) {
if(weights[i] != 0) {
ccs[i] = 1f;
}
} else {
ratioAdvices = ((float) behaviorsOfExperts[i][1]) / ((float) behaviorsOfExperts[i][0]);
leftPart = eta * ratioAdvices;
differenceAdvices = ((float) behaviorsOfExperts[i][0]) - ((float) behaviorsOfExperts[i][1]);
rightPart = eta2 * (1f - (differenceAdvices / totalNumberOfAssesments));
ccs[i] = leftPart + rightPart;
}
}
// cdt
for (int i = 0; i < numberOfExperts; i++) {
if (ccs[i] < alpha) {
cdt[i] = 0f;
} else if (ccs[i] < beta) {
cdt[i] = (ccs[i] - alpha) / (beta - alpha);
} else {
cdt[i] = 1f;
}
}
// Weights
for (int i = 0; i < numberOfExperts; i++) {
if ((weights[i] <= g) && (cdt[i] <= g)) {
weights[i] = (weights[i] * cdt[i]) / g;
} else if ((weights[i] >= g) && (cdt[i] >= g)) {
weights[i] = (weights[i] + cdt[i] - (weights[i] * cdt[i]) - g) / (1 - g);
} else {
weights[i] = (weights[i] + cdt[i]) / 2f;
}
}
normalizedWeights = ConsensusEngine.normalize(weights);
}
}
/**
* Identify pairs of alternatives to change
*
* @param alternatives
* Number of alternatives
* @param ac
* Alternatives consensus
* @param cr
* Overall consensus degree
* @param cm
* Consensus matrix
* @return Pairs of alternatives to change
*/
private static Boolean[][] identifyPairsOfAlternativesToChange(Integer alternatives, Float[] ac, Float cr, CM cm) {
Boolean[][] result = new Boolean[alternatives][alternatives];
Boolean change;
for (int i = 0; i < alternatives; i++) {
for (int j = 0; j < alternatives; j++) {
change = false;
if (i != j) {
if (ac[i] < cr) {
if ((float) cm.getValue(i, j) < cr) {
change = true;
}
}
}
result[i][j] = change;
}
}
return result;
}
/**
* Identify change in pairs of alternatives by experts
*
* @param experts
* Number of experts
* @param alternatives
* Number of alternatives
* @param pairsOfAlternativesToChange
* Pairs of alternatives to change
* @param proximityMatrices
* Proximity matrices
* @param proximityAverageMatrix
* Proximity average matrix
* @return Change in pairs of alternatives by experts
*/
private static Boolean[][][] identifyChangePairsOfAlternativesByExperts(Integer experts, Integer alternatives,
Boolean[][] pairsOfAlternativesToChange, CM[] proximityMatrices, CM proximityAverageMatrix) {
Boolean[][][] result = new Boolean[experts][alternatives][alternatives];
Boolean change;
for (int expert = 0; expert < experts; expert++) {
for (int i = 0; i < alternatives; i++) {
for (int j = 0; j < alternatives; j++) {
change = false;
if (pairsOfAlternativesToChange[i][j] && proximityMatrices[expert] != null) {
if ((float) proximityMatrices[expert].getValue(i, j) < (float) proximityAverageMatrix.getValue(i, j)) {
change = true;
}
}
result[expert][i][j] = change;
}
}
}
return result;
}
/**
* Calcule changes to make
*
* @param experts
* Number of experts
* @param alternatives
* Number of alternatives
* @param changePairsOfAlternativesByExperts
* Change in pairs of alternatives by experts
* @param preferences
* All FPR.
* @param epsilon
* Acceptability threshold
* @return Changes to make
*/
private static EChangeType[][][] calculeChanges(Integer experts, Integer alternatives,
Boolean[][][] changePairsOfAlternativesByExperts, Structure[] preferences, Float epsilon) {
EChangeType[][][] result = new EChangeType[experts][alternatives][alternatives];
Float difference;
for (int expert = 0; expert < experts; expert++) {
for (int i = 0; i < alternatives; i++) {
for (int j = 0; j < alternatives; j++) {
if (changePairsOfAlternativesByExperts[expert][i][j]) {
difference = (Float) preferences[expert].getValue(i, j) - (Float) preferences[experts].getValue(i, j);
if (difference < (-epsilon)) {
result[expert][i][j] = EChangeType.Increase;
} else if (difference > epsilon) {
result[expert][i][j] = EChangeType.Decrease;
} else {
result[expert][i][j] = EChangeType.NotChange;
}
} else {
result[expert][i][j] = EChangeType.NotChange;
}
}
}
}
return result;
}
/**
* Make preferences changes
*
* @param experts
* Number of experts
* @param alternatives
* Number of alternatives
* @param preferences
* All FPR
* @param changes
* Changes to make
*
* @return Behaviors of experts as Integer[number of experts][2 = {0 -
* number of advises, 1 - number of accepted advises}].
*/
private Integer[][] makeChanges(Integer experts, Integer alternatives, Structure[] preferences,
EChangeType[][][] changes) {
Integer[][] behaviorOfExperts = new Integer[experts][2];
float value;
EChangeType change;
double[] eChanges;
int n;
double changeMeasure;
for (int expert = 0; expert < experts; expert++) {
behaviorOfExperts[expert][0] = 0;
behaviorOfExperts[expert][1] = 0;
n = 0;
for (int i = 0; i < alternatives; i++) {
for (int j = 0; j < alternatives; j++) {
if (changes[expert][i][j] != EChangeType.NotChange) {
behaviorOfExperts[expert][0] = behaviorOfExperts[expert][0] + 1;
}
}
}
eChanges = getNChanges(behaviorOfExperts[expert][0]);
for (int i = 0; i < alternatives; i++) {
for (int j = 0; j < alternatives; j++) {
change = changes[expert][i][j];
if (change != EChangeType.NotChange) {
changeMeasure = eChanges[n++];
if (changeMeasure != 0f) {
behaviorOfExperts[expert][1] = behaviorOfExperts[expert][1] + 1;
value = (Float) preferences[expert].getValue(i, j);
if (change == EChangeType.Increase) {
value += changeMeasure;
} else if (change == EChangeType.Decrease) {
value -= changeMeasure;
}
if (value > 1f) {
value = 1f;
} else if (value < 0f) {
value = 0f;
}
((FPR) preferences[expert]).setValueSymmetrically(i, j, value);
}
}
}
}
}
return behaviorOfExperts;
}
}
@@ -0,0 +1,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: afryca.consensusmodel.quesada2015;singleton:=true
Bundle-Version: 1.0.0.202101221157
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: afryca.consensusmodel
Automatic-Module-Name: afryca.consensusmodel.quesada2015
@@ -0,0 +1,4 @@
#Fri Jan 22 13:01:36 CET 2021
artifact.main=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.quesada2015\\target\\afryca.consensusmodel.quesada2015-1.0.0-SNAPSHOT.jar
artifact.attached.p2artifacts=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.quesada2015\\target\\p2artifacts.xml
artifact.attached.p2metadata=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.quesada2015\\target\\p2content.xml
@@ -0,0 +1,3 @@
artifactId=afryca.consensusmodel.quesada2015
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.quesada2015' version='1.0.0.202101221157'>
<properties size='5'>
<property name='artifact.size' value='11063'/>
<property name='download.size' value='11063'/>
<property name='maven-groupId' value='afryca.group'/>
<property name='maven-artifactId' value='afryca.consensusmodel.quesada2015'/>
<property name='maven-version' value='1.0.0-SNAPSHOT'/>
</properties>
</artifact>
</artifacts>
@@ -0,0 +1,48 @@
<?xml version='1.0' encoding='UTF-8'?>
<units size='1'>
<unit id='afryca.consensusmodel.quesada2015' version='1.0.0.202101221157' generation='2'>
<update id='afryca.consensusmodel.quesada2015' range='[0.0.0,1.0.0.202101221157)' severity='0'/>
<properties size='9'>
<property name='es.Bundle-Name' value='Quesada2015'/>
<property name='es.Bundle-Vendor' value='Sinbad²'/>
<property name='df_LT.Bundle-Name' value='Quesada2015'/>
<property name='df_LT.Bundle-Vendor' value='Sinbad²'/>
<property name='org.eclipse.equinox.p2.name' value='%Bundle-Name'/>
<property name='org.eclipse.equinox.p2.provider' value='%Bundle-Vendor'/>
<property name='maven-groupId' value='afryca.group'/>
<property name='maven-artifactId' value='afryca.consensusmodel.quesada2015'/>
<property name='maven-version' value='1.0.0-SNAPSHOT'/>
</properties>
<provides size='6'>
<provided namespace='org.eclipse.equinox.p2.iu' name='afryca.consensusmodel.quesada2015' version='1.0.0.202101221157'/>
<provided namespace='osgi.bundle' name='afryca.consensusmodel.quesada2015' version='1.0.0.202101221157'/>
<provided namespace='osgi.identity' name='afryca.consensusmodel.quesada2015' 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='2'>
<required namespace='osgi.bundle' name='afryca.consensusmodel' range='0.0.0'/>
<requiredProperties namespace='osgi.ee' match='(&amp;(osgi.ee=JavaSE)(version=1.8))'>
<description>
afryca.consensusmodel.quesada2015
</description>
</requiredProperties>
</requires>
<artifacts size='1'>
<artifact classifier='osgi.bundle' id='afryca.consensusmodel.quesada2015' 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.quesada2015;singleton:=true&#xA;Bundle-Version: 1.0.0.202101221157&#xA;
</instruction>
</instructions>
</touchpointData>
</unit>
</units>