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.kacprzyk2010</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,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: afryca.consensusmodel.kacprzyk2010;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: afryca.consensusmodel
Automatic-Module-Name: afryca.consensusmodel.kacprzyk2010
@@ -0,0 +1,11 @@
#Properties file for afryca.consensusmodel.kacprzyk2010
Bundle-Vendor = Sinbad\u00B2
Bundle-Name = Kacprzyk2010
afryca.consensusmodel.kacprzyk2010.information = Paper: J. Kacprzyk, S. Zadrozny. Supporting consensus reaching processes under fuzzy preferences and a fuzzy majority via linguistic summaries. Studies in Fuzziness and Soft Computing 257 (2010), pp. 149-157.\\n\\nJ. Kacprzyk, S. Zadrozny. Soft computing and web intelligence for supporting consensus reaching. Soft Computing 14(2010), pp. 833-846.\\n\\nConsensus model based on the notion of "soft consensus" under fuzzy preference relations. Similarities between pairs of experts are computed at level of assessment, as alpha-degrees of sufficient agreement. Consensus degrees are obtained at different levels from such similarities, based on quantifier-guided OWA aggregation. The feedback mechanism identifies the pairs of alternatives with lowest degree of agreement, and then generates recommendations for experts.
afryca.consensusmodel.kacprzyk2010.mainfeature = Fuzzy preference relations\\n"Soft consensus" measure\\nLinguistic quantifiers\\nalpha-degrees of sufficient agreement
afryca.consensusmodel.kacprzyk2010.name = J. Kacprzyk et al. (2010)
afryca.consensusmodel.kacprzyk2010.observations = Instead of using linguistic summaries, the feedback mechanism implemented is based on the criterion "lack of arguments" (see 2nd reference).
afryca.consensusmodel.kacprzyk2010.variable.h_max.description = Maximum number of discussion rounds allowed
afryca.consensusmodel.kacprzyk2010.variable.aggregation_quantifiers.description = Parameters of the linguistic quantifier used in the aggregation process to compute consensus
afryca.consensusmodel.kacprzyk2010.variable.alpha.description = Parameter used for the non-strict similarity measure between experts' assessments
afryca.consensusmodel.kacprzyk2010.variable.cl.description = Consensus threshold
@@ -0,0 +1,11 @@
#Archivo de propiedades para afryca.consensusmodel.kacprzyk2010
Bundle-Vendor = Sinbad\u00B2
Bundle-Name = Kacprzyk2010
afryca.consensusmodel.kacprzyk2010.information = Artículos: J. Kacprzyk, S. Zadrozny. Supporting consensus reaching processes under fuzzy preferences and a fuzzy majority via linguistic summaries. Studies in Fuzziness and Soft Computing 257 (2010), pp. 149-157.\\n\\nJ. Kacprzyk, S. Zadrozny. Soft computing and web intelligence for supporting consensus reaching. Soft Computing 14(2010), pp. 833-846.\\n\\nMódelo de consenso basado en la noción de 'soft consensus' bajo relaciones de preferencias difusas. Las similitudes entre pares de expertos son calculadas al nivel de valoración, como alpha-grados de de acuerdo suficiente. Los grados de consenso son obtenidos a diferentes niveles de similitud, en base a una agregación OWA guiada por cuantificadores. El mecanismo de feedback identifica los pares de alternativas con el menor grado de acuerdo y son generadas recomendaciones para los expertos.
afryca.consensusmodel.kacprzyk2010.mainfeature = Relaciones de preferencia difusas\\nMedida de 'soft consensus'\\nCuantificadores lingüísticos\nalpha-grados de grado de acuerdo
afryca.consensusmodel.kacprzyk2010.name = J. Kacprzyk et al. (2010)
afryca.consensusmodel.kacprzyk2010.observations = En lugar de usar resúmenes lingüísticos, el mecanismo de feedback implementado está basado en el criterio de "falta de argumentos" (ver 2nd referencia).
afryca.consensusmodel.kacprzyk2010.variable.h_max.description = Máximo número de rondas de discusión permitidas
afryca.consensusmodel.kacprzyk2010.variable.aggregation_quantifiers.description = Parámetros de los cuantificadores lingüísticos usados en el proceso de agregación para calcular el consenso
afryca.consensusmodel.kacprzyk2010.variable.alpha.description = Parámetro usado para la similaridad no estricta entre valoraciones de los expertos
afryca.consensusmodel.kacprzyk2010.variable.cl.description = Umbral de consenso
@@ -0,0 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
OSGI-INF/
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="afryca.consensusmodel">
<ConsensusModel
ConsensusModel="afryca.consensusmodel.Kacprzyk2010"
Information="%afryca.consensusmodel.kacprzyk2010.information"
MainFeatures="%afryca.consensusmodel.kacprzyk2010.mainfeature"
Multicriteria="false"
Name="%afryca.consensusmodel.kacprzyk2010.name"
Observations="%afryca.consensusmodel.kacprzyk2010.observations"
Structure="afryca.fpr"
WithFeedback="true"
id="Kacprzyk2010">
<Variable
default_value="10"
description="%afryca.consensusmodel.kacprzyk2010.variable.h_max.description"
id="h_max"
is_array="false"
is_internal="false"
type="Integer">
<Restriction
type="lower_limit"
value="1">
</Restriction>
</Variable>
<Variable
default_value="0.4;0.8"
description="%afryca.consensusmodel.kacprzyk2010.variable.aggregation_quantifiers.description"
id="aggregation_quantifiers"
is_array="true"
is_internal="false"
type="Float">
<Array_restriction
type="element_lower_limit"
value="0">
</Array_restriction>
<Array_restriction
type="element_upper_limit"
value="1">
</Array_restriction>
<Array_restriction
type="number_of_elements"
value="2">
</Array_restriction>
</Variable>
<Variable
default_value="0.5"
description="%afryca.consensusmodel.kacprzyk2010.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="1">
</Restriction>
</Variable>
<Variable
default_value="0.85"
description="%afryca.consensusmodel.kacprzyk2010.variable.cl.description"
id="cl"
is_array="false"
is_internal="false"
type="Float">
<Restriction
type="lower_limit"
value="0">
</Restriction>
<Restriction
type="upper_limit"
value="1">
</Restriction>
</Variable>
</ConsensusModel>
</extension>
</plugin>
@@ -0,0 +1,260 @@
package afryca.consensusmodel;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import afryca.cm.CM;
import afryca.consensusmodel.definition.EResultElements;
import afryca.fpr.FPR;
import afryca.structure.Structure;
/**
* Kacprzyk2010 consensus model
*
* @author Sinbad²
* @version 3.0
*/
public class Kacprzyk2010 extends ConsensusModel {
private static final String CONSENSUS_MODEL_NAME = "J. Kacprzyk et al. (2010)"; //$NON-NLS-1$
private static final String AGGREGATION_QUANTIFIERS = "aggregation_quantifiers"; //$NON-NLS-1$
private static final String ALPHA = "alpha"; //$NON-NLS-1$
private static final String CL = "cl"; //$NON-NLS-1$
private static final String H_MAX = "h_max"; //$NON-NLS-1$
private Float[] aggregation_quantifiers;
private Float alpha;
private Float cl;
private Integer h_max;
private Float consensus;
private int h;
private int[] advises;
@Override
protected void setModelConfiguration() {
}
@Override
protected void obtainConfigurationValues() {
aggregation_quantifiers = (Float[]) configuration.getValue(AGGREGATION_QUANTIFIERS);
alpha = (Float) configuration.getValue(ALPHA);
cl = (Float) configuration.getValue(CL);
h_max = (Integer) configuration.getValue(H_MAX);
consensus = 0f;
h = 0;
advises = null;
}
@Override
protected Float[][][] obtainVisualizeValues() {
Structure[] auxPreferences = clonePreferencesUnion(preferences, ConsensusEngine.groupPreferences(numberOfExperts, numberOfAlternatives, preferences));
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 = clonePreferencesUnion(preferences, ConsensusEngine.groupPreferences(numberOfExperts, numberOfAlternatives, preferences));
CM[][] agreementMatricesBetweenExperts = ConsensusEngine.agreementMatricesBetweenFPRS(ConsensusEngine.truncateFPRS(auxPreferences, numberOfExperts), alpha);
Float[][] Q1Matrix = Q1Matrix(agreementMatricesBetweenExperts, aggregation_quantifiers[0], aggregation_quantifiers[1]);
Float consensusDegreeAchieved = ConsensusEngine.upperDiagonalOWA(Q1Matrix, aggregation_quantifiers[0], aggregation_quantifiers[1]);
preSaveRoundResult(round, auxPreferences,obtainVisualizeValues(), consensusDegreeAchieved);
result.put(EResultElements.initial_consensus_degree, consensusDegreeAchieved);
result.put(EResultElements.maxround, h_max);
result.put(EResultElements.consensus_threshold, cl);
result.put(EResultElements.consensus_model, CONSENSUS_MODEL_NAME);
}
@Override
protected void preSaveRoundResults() {
preSaveRoundResult(h + 1, preferences,obtainVisualizeValues(), consensus);
}
@Override
protected void consensusRound() {
computeCollective();
CM[][] agreementMatricesBetweenExperts = ConsensusEngine.agreementMatricesBetweenFPRS(ConsensusEngine.truncateFPRS(preferences, numberOfExperts), alpha);
Float[][] Q1Matrix = Q1Matrix(agreementMatricesBetweenExperts, aggregation_quantifiers[0], aggregation_quantifiers[1]);
computeConsensusDegree(Q1Matrix);
advises = null;
if (consensus < cl) {
CM[][] agreementMatricesBetweenAlternatives = ConsensusEngine.agreementMatricesBetweenAlternatives(agreementMatricesBetweenExperts);
Float[][] Q3Matrix = Q1Matrix(agreementMatricesBetweenAlternatives, aggregation_quantifiers[0], aggregation_quantifiers[1]);
Boolean[][] pairsOfAlternativesWithHighDiscrepancy = pairsOfAlternativesWithHighDiscrepancy(Q3Matrix);
advises = makeChanges(preferences, pairsOfAlternativesWithHighDiscrepancy);
h++;
}
}
private void computeCollective(){
preferences[numberOfExperts] = ConsensusEngine.groupPreferences(numberOfExperts, numberOfAlternatives, preferences);
}
private void computeConsensusDegree(Float[][] Q1Matrix){
consensus = ConsensusEngine.upperDiagonalOWA(Q1Matrix, aggregation_quantifiers[0], aggregation_quantifiers[1]);
}
@Override
protected void posSaveRoundResults() {
computeCollective();
CM[][] agreementMatricesBetweenExperts = ConsensusEngine.agreementMatricesBetweenFPRS(ConsensusEngine.truncateFPRS(preferences, numberOfExperts), alpha);
Float[][] Q1Matrix = Q1Matrix(agreementMatricesBetweenExperts, aggregation_quantifiers[0], aggregation_quantifiers[1]);
computeConsensusDegree(Q1Matrix);
posSaveRoundResult(preferences,obtainVisualizeValues(), consensus, advises, preferences[numberOfExperts]);
}
@Override
protected boolean mustBeCarriedOutAnotherRound() {
return (consensus < cl) && (h < h_max);
}
@Override
protected void saveExecutionResults() {
this.configuration.setValue(PREFERENCES, preferences);
result.put(EResultElements.number_of_rounds_required, h);
result.put(EResultElements.consensus_degree_achieved, consensus);
}
private static Float[][] Q1Matrix(CM[][] agreementMatrices, float a, float b) {
// Number of elements
int elements = agreementMatrices.length;
Float[][] result = new Float[elements][elements];
for (int i = 0; i < (elements - 1); i++) {
for (int j = (i + 1); j < elements; j++) {
result[i][j] = ConsensusEngine.upperDiagonalOWA(agreementMatrices[i][j].getCM(), a, b);
}
}
return result;
}
private static Boolean[][] pairsOfAlternativesWithHighDiscrepancy(Float[][] degreesOfAgreement) {
int length = degreesOfAgreement.length;
Boolean[][] result = new Boolean[length][length];
List<Float> orderedValues = new ArrayList<>();
for (int i = 0; i < (length - 1); i++) {
for (int j = (i + 1); j < length; j++) {
orderedValues.add(Float.valueOf(degreesOfAgreement[i][j]));
}
}
Collections.sort(orderedValues);
float threashold = orderedValues.get(orderedValues.size() / 2);
for (int i = 0; i < (length - 1); i++) {
for (int j = (i + 1); j < length; j++) {
if (degreesOfAgreement[i][j] <= threashold) {
result[i][j] = true;
} else {
result[i][j] = false;
}
}
}
return result;
}
private int[] makeChanges(Structure[] preferences, Boolean[][] pairsOfAlternativesWithHighDiscrepancy) {
int experts = preferences.length - 1;
int[] result = new int[experts];
for (int i = 0; i < experts; i++) {
result[i] = 0;
}
int alternatives = pairsOfAlternativesWithHighDiscrepancy.length;
int numberOfChanges = 0;
EChangeType[][][] changes = new EChangeType[experts][alternatives][alternatives];
Float[][] lowerValues = new Float[alternatives][alternatives];
Float[][] upperValues = new Float[alternatives][alternatives];
float auxValue;
for (int i = 0; i < (alternatives - 1); i++) {
for (int j = (i + 1); j < alternatives; j++) {
if (pairsOfAlternativesWithHighDiscrepancy[i][j] == true) {
lowerValues[i][j] = 2f;
upperValues[i][j] = -1f;
for (int k = 0; k < experts; k++) {
auxValue = (Float) preferences[k].getValue(i, j);
if (auxValue < lowerValues[i][j]) {
lowerValues[i][j] = auxValue;
}
if (auxValue > upperValues[i][j]) {
upperValues[i][j] = auxValue;
}
}
for (int k = 0; k < experts; k++) {
auxValue = (Float) preferences[k].getValue(i, j);
if (auxValue == lowerValues[i][j].floatValue()) {
changes[k][i][j] = EChangeType.Increase;
numberOfChanges++;
} else if (auxValue == upperValues[i][j].floatValue()) {
changes[k][i][j] = EChangeType.Decrease;
numberOfChanges++;
}
}
}
}
}
// Get behaviour for changes
double[] changesToMake = getNChanges(numberOfChanges);
// Make changes
int pos = 0;
float change;
for (int i = 0; i < (alternatives - 1); i++) {
for (int j = (i + 1); j < alternatives; j++) {
for (int k = 0; k < experts; k++) {
if (changes[k][i][j] != null) {
if (changes[k][i][j] != EChangeType.NotChange) {
result[k] = result[k] + 1;
change = (float) changesToMake[pos++];
if (EChangeType.Decrease == changes[k][i][j]) {
change *= -1f;
}
change += (Float) preferences[k].getValue(i, j);
if (change > 1f) {
change = 1f;
} else if (change < 0f) {
change = 0f;
}
((FPR) preferences[k]).setValueSymmetrically(i, j, change);
}
}
}
}
}
return result;
}
}
@@ -0,0 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: afryca.consensusmodel.kacprzyk2010;singleton:=true
Bundle-Version: 1.0.0.202101221157
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: afryca.consensusmodel
Automatic-Module-Name: afryca.consensusmodel.kacprzyk2010
@@ -0,0 +1,4 @@
#Fri Jan 22 13:01:15 CET 2021
artifact.main=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.kacprzyk2010\\target\\afryca.consensusmodel.kacprzyk2010-1.0.0-SNAPSHOT.jar
artifact.attached.p2artifacts=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.kacprzyk2010\\target\\p2artifacts.xml
artifact.attached.p2metadata=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.kacprzyk2010\\target\\p2content.xml
@@ -0,0 +1,3 @@
artifactId=afryca.consensusmodel.kacprzyk2010
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.kacprzyk2010' version='1.0.0.202101221157'>
<properties size='5'>
<property name='artifact.size' value='8992'/>
<property name='download.size' value='8992'/>
<property name='maven-groupId' value='afryca.group'/>
<property name='maven-artifactId' value='afryca.consensusmodel.kacprzyk2010'/>
<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.kacprzyk2010' version='1.0.0.202101221157' generation='2'>
<update id='afryca.consensusmodel.kacprzyk2010' range='[0.0.0,1.0.0.202101221157)' severity='0'/>
<properties size='9'>
<property name='es.Bundle-Name' value='Kacprzyk2010'/>
<property name='es.Bundle-Vendor' value='Sinbad²'/>
<property name='df_LT.Bundle-Name' value='Kacprzyk2010'/>
<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.kacprzyk2010'/>
<property name='maven-version' value='1.0.0-SNAPSHOT'/>
</properties>
<provides size='6'>
<provided namespace='org.eclipse.equinox.p2.iu' name='afryca.consensusmodel.kacprzyk2010' version='1.0.0.202101221157'/>
<provided namespace='osgi.bundle' name='afryca.consensusmodel.kacprzyk2010' version='1.0.0.202101221157'/>
<provided namespace='osgi.identity' name='afryca.consensusmodel.kacprzyk2010' 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.kacprzyk2010
</description>
</requiredProperties>
</requires>
<artifacts size='1'>
<artifact classifier='osgi.bundle' id='afryca.consensusmodel.kacprzyk2010' 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.kacprzyk2010;singleton:=true&#xA;Bundle-Version: 1.0.0.202101221157&#xA;
</instruction>
</instructions>
</touchpointData>
</unit>
</units>