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.hongbin2018</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,8 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: afryca.consensusmodel.hongbin2018;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: afryca.consensusmodel
Automatic-Module-Name: afryca.consensusmodel.hongbin2018
@@ -0,0 +1,12 @@
#Properties file for afryca.consensusmodel.hongbin2018
ConsensusModel.Information = H. Liu, et al. Minimum-cost consensus. Not published yet\\n\\nMetric definition to compare different consensus models based on the cost.
ConsensusModel.Features = Fuzzy preference relations\\nMinimun cost consensus\\nDistance among experts\\nDistance among experts and collective\\nLinear programming\\n
ConsensusModel.Name = H. Liu et al. (2018)
ConsensusModel.Observations = There may not be a feasible solution
Bundle-Vendor = Sinbad2
Variable.description.epsilon = Minimum distance to the collective allowed
Variable.description.alpha = Consensus threshold
Variable.description.cost = Cost
Variable.description.weights = Experts' weights
Variable.description.model = Compute consensus through distance among experts (if it is not selected, then consensus degree will be computed based on the distance among experts and collective)
Bundle-Name = H.Liu2018
@@ -0,0 +1,12 @@
#Properties file for afryca.consensusmodel.hongbin2018
ConsensusModel.Information = H. Liu, et al. Consenso de mínimo coste. Aún no publicado\\n\\nNueva métrica para comparar diferentes modelos de consensos basada en el coste.
ConsensusModel.Features = Relaciones de preferencia difusas\\nConsenso de mínimo coste\\nConsenso calculado mediante distancia entre expertos\\nConsenso calculado mediante distancia entre expertos y colectiva\\nProgramación lineal\\n
ConsensusModel.Name = H. Liu et al. (2018)
ConsensusModel.Observations = Podría no haber soluciones factibles
Bundle-Vendor = Sinbad2
Variable.description.epsilon = Mínima distancia a la colectiva permitida
Variable.description.alpha = Umbral de consenso
Variable.description.cost = Costes
Variable.description.weights = Pesos de expertos
Variable.description.model = Calcular consenso mediante distancia entre expertos (si no se selecciona, el grado de consenso se calculará en base a la distancia entre los expertos y la colectiva)
Bundle-Name = H.Liu2018
@@ -0,0 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="afryca.consensusmodel">
<ConsensusModel
ConsensusModel="afryca.consensusmodel.hongbin2018.HLIU2018"
Information="%ConsensusModel.Information"
MainFeatures="%ConsensusModel.Features"
Multicriteria="false"
Name="%ConsensusModel.Name"
Observations="%ConsensusModel.Observations"
Structure="afryca.fpr"
WithFeedback="false"
id="HLiu2018">
<Variable
default_value="0.85"
description="%Variable.description.alpha"
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.8"
description="%Variable.description.epsilon"
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
array_default_element_value="1"
description="%Variable.description.cost"
id="cost"
is_array="true"
is_internal="false"
type="Integer">
<Array_relation
type="number_of_elements_equals_to"
variable="experts">
</Array_relation>
<Array_restriction
type="element_lower_limit"
value="0">
</Array_restriction>
</Variable>
<Variable
array_default_element_value="1"
description="%Variable.description.weights"
id="weights"
is_array="true"
is_internal="false"
type="Float">
<Array_relation
type="number_of_elements_equals_to"
variable="experts">
</Array_relation>
<Array_restriction
type="element_lower_limit"
value="0">
</Array_restriction>
<Array_restriction
type="element_upper_limit"
value="1">
</Array_restriction>
<Array_restriction
type="elements_sum_value"
value="1">
</Array_restriction>
</Variable>
<Variable
default_value="false"
description="%Variable.description.model"
id="model"
is_array="false"
is_internal="false"
type="Boolean">
</Variable>
</ConsensusModel>
</extension>
</plugin>
@@ -0,0 +1,140 @@
package afryca.consensusmodel.hongbin2018;
import java.util.ArrayList;
import afryca.ase.RunnableScript;
import afryca.consensumodel.addon.E4DIAddon;
import afryca.consensusmodel.ConsensusEngine;
import afryca.consensusmodel.ConsensusModel;
import afryca.consensusmodel.definition.EResultElements;
import afryca.fpr.FPR;
import afryca.structure.Structure;
public class HLIU2018 extends ConsensusModel {
private static final String CONSENSUS_MODEL_NAME = "H. Liu et al. (2018)"; //$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 COST = "cost"; //$NON-NLS-1$ //
private static final String WEIGHTS = "weights"; //$NON-NLS-1$ //
private static final String MODEL = "model"; //$NON-NLS-1$ //
private Float epsilon;
private Float alpha;
private Integer[] cost;
private Float[] weights;
private boolean model;
private float consensusDegree;
private FPR[] preferencesWithoutGroup;
@Override
protected void setModelConfiguration() {
}
@Override
protected void obtainConfigurationValues() {
epsilon = (Float) configuration.getValue(EPSILON);
alpha = (Float) configuration.getValue(ALPHA);
cost = (Integer[]) configuration.getValue(COST);
weights = (Float[]) configuration.getValue(WEIGHTS);
model = (Boolean) configuration.getValue(MODEL);
preferencesWithoutGroup = new FPR[preferences.length - 1];
initializePreferencesWithoutGroup();
}
private void initializePreferencesWithoutGroup() {
// Copy preferences except collective
for (int i = 0; i < preferences.length - 1; i++) {
try {
preferencesWithoutGroup[i] = (FPR) preferences[i].clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
}
}
@Override
protected Float[][][] obtainVisualizeValues() {
Structure[] auxPreferences = clonePreferencesUnion(preferences, ConsensusEngine.groupPreferences(numberOfExperts, numberOfAlternatives, preferences,weights));
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() {
Structure[] auxPreferences = clonePreferencesUnion(preferences, ConsensusEngine.groupPreferences(numberOfExperts, numberOfAlternatives, preferences,weights));
computeCollective();
computeConsensusDegree();
preSaveRoundResult(1, auxPreferences, obtainVisualizeValues(), consensusDegree);
result.put(EResultElements.initial_consensus_degree, consensusDegree);
result.put(EResultElements.maxround, 1);
result.put(EResultElements.consensus_threshold, alpha);
result.put(EResultElements.consensus_model, CONSENSUS_MODEL_NAME);
}
@Override
protected void preSaveRoundResults() {
computeCollective();
computeConsensusDegree();
preSaveRoundResult(1, preferences,obtainVisualizeValues(), consensusDegree);
}
@Override
protected void posSaveRoundResults() {
computeCollective();
computeConsensusDegree();
posSaveRoundResult(preferences,obtainVisualizeValues(), consensusDegree, null);
}
@Override
protected boolean mustBeCarriedOutAnotherRound() {
return false;
}
@Override
protected void saveExecutionResults() {
this.configuration.setValue(PREFERENCES, preferences);
result.put(EResultElements.number_of_rounds_required, 1);
result.put(EResultElements.consensus_degree_achieved, consensusDegree);
}
@SuppressWarnings("unchecked")
@Override
protected void consensusRound() {
ArrayList<FPR> preferencesResult = (ArrayList<FPR>) ((RunnableScript) E4DIAddon.aseService.createExecutionBuilder()
.setFunction("HLiuMinimumCost")
.putVariable("epsilon", epsilon)
.putVariable("alpha", alpha)
.putVariable("cost", cost)
.putVariable("weights", weights)
.putVariable("prefs", preferencesWithoutGroup)
.putVariable("alternatives", numberOfAlternatives)
.putVariable("model", model)
.execute())
.getResult();
int cont = 0;
for(FPR fpr: preferencesResult) {
preferences[cont] = fpr;
preferencesWithoutGroup[cont] = fpr;
cont++;
}
}
private void computeCollective() {
preferences[numberOfExperts] = ConsensusEngine.groupPreferences(numberOfExperts, numberOfAlternatives, preferences, weights);
}
private void computeConsensusDegree() {
if(!model)
consensusDegree = Math.round(ConsensusEngine.consensusBasedOnDistanceIndividualCollectiveWeightedAverage(preferencesWithoutGroup, (FPR) preferences[numberOfExperts], weights) * 100f) / 100f;
else
consensusDegree = Math.round(ConsensusEngine.consensusBasedOnDistanceBetweenExpertsWeightedAverage(preferencesWithoutGroup, weights) * 100f) / 100f;
}
}
@@ -0,0 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: afryca.consensusmodel.hongbin2018;singleton:=true
Bundle-Version: 1.0.0.202101221157
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: afryca.consensusmodel
Automatic-Module-Name: afryca.consensusmodel.hongbin2018
@@ -0,0 +1,4 @@
#Fri Jan 22 13:00:55 CET 2021
artifact.main=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.hongbin2018\\target\\afryca.consensusmodel.hongbin2018-1.0.0-SNAPSHOT.jar
artifact.attached.p2artifacts=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.hongbin2018\\target\\p2artifacts.xml
artifact.attached.p2metadata=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.hongbin2018\\target\\p2content.xml
@@ -0,0 +1,3 @@
artifactId=afryca.consensusmodel.hongbin2018
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.hongbin2018' version='1.0.0.202101221157'>
<properties size='5'>
<property name='artifact.size' value='7168'/>
<property name='download.size' value='7168'/>
<property name='maven-groupId' value='afryca.group'/>
<property name='maven-artifactId' value='afryca.consensusmodel.hongbin2018'/>
<property name='maven-version' value='1.0.0-SNAPSHOT'/>
</properties>
</artifact>
</artifacts>
@@ -0,0 +1,45 @@
<?xml version='1.0' encoding='UTF-8'?>
<units size='1'>
<unit id='afryca.consensusmodel.hongbin2018' version='1.0.0.202101221157' generation='2'>
<update id='afryca.consensusmodel.hongbin2018' range='[0.0.0,1.0.0.202101221157)' severity='0'/>
<properties size='6'>
<property name='es.Bundle-Name' value='H.Liu2018'/>
<property name='df_LT.Bundle-Name' value='H.Liu2018'/>
<property name='org.eclipse.equinox.p2.name' value='%Bundle-Name'/>
<property name='maven-groupId' value='afryca.group'/>
<property name='maven-artifactId' value='afryca.consensusmodel.hongbin2018'/>
<property name='maven-version' value='1.0.0-SNAPSHOT'/>
</properties>
<provides size='6'>
<provided namespace='org.eclipse.equinox.p2.iu' name='afryca.consensusmodel.hongbin2018' version='1.0.0.202101221157'/>
<provided namespace='osgi.bundle' name='afryca.consensusmodel.hongbin2018' version='1.0.0.202101221157'/>
<provided namespace='osgi.identity' name='afryca.consensusmodel.hongbin2018' 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.hongbin2018
</description>
</requiredProperties>
</requires>
<artifacts size='1'>
<artifact classifier='osgi.bundle' id='afryca.consensusmodel.hongbin2018' 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.hongbin2018;singleton:=true&#xA;Bundle-Version: 1.0.0.202101221157&#xA;
</instruction>
</instructions>
</touchpointData>
</unit>
</units>