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.zhang2011minimumcost</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.0
Bundle-SymbolicName: afryca.consensusmodel.zhang2011minimumcost;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: afryca.consensusmodel
Automatic-Module-Name: afryca.consensusmodel.zhang2011minimumcost
@@ -0,0 +1,10 @@
#Properties file for afryca.consensusmodel.zhang2011minimumcost
ConsensusModel.Information = ZHANG, Guiqing, et al. Minimum-cost consensus models under aggregation operators. IEEE Transactions on Systems, Man, and Cybernetics-Part A: Systems and Humans, 2011, vol. 41, no 6, p. 1253-1261.\\n\\nThis proposal closely examines the minimum-cost consensus models with a linear cost function under the common aggregation operators (e.g., the weighted averaging operator and the OWA operator). Linear-programming-based approaches are also developed to solve these models.
ConsensusModel.Features = Fuzzy preference relations\\nOWA\\nLinear programming\\n
ConsensusModel.Name = G.Zhang et al. (2011)
ConsensusModel.Observations = There may not be a feasible solution
Bundle-Vendor = Sinbad2
Bundle-Name = Zhang2011
Variable.description.epsilon = Threshold
Variable.description.cost = Cost
Bundle-Name.0 = Zhang2011minimumcost
@@ -0,0 +1,9 @@
#Properties file for afryca.consensusmodel.zhang2011minimumcost
ConsensusModel.Information = ZHANG, Guiqing, et al. Minimum-cost consensus models under aggregation operators. IEEE Transactions on Systems, Man, and Cybernetics-Part A: Systems and Humans, 2011, vol. 41, no 6, p. 1253-1261.\\n\\nEsta propuesta examina de cerca los modelos de consenso de costo mínimo con una función de costo lineal bajo los operadores de agregación comunes (por ejemplo, el operador de promedio ponderado y el operador OWA). Los enfoques basados en programación lineal también se desarrollan para resolver estos modelos.
ConsensusModel.Features = Fuzzy preference relations\\nOWA\\nLinear programming\\n
ConsensusModel.Name = G.Zhang et al. (2011)
ConsensusModel.Observations = Puede no tener solucion
Bundle-Vendor = Sinbad2
Bundle-Name = Zhang2011
Variable.description.epsilon = Umbral
Variable.description.cost = Costes
@@ -0,0 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
OSGI-INF/,\
OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="afryca.consensusmodel">
<ConsensusModel
ConsensusModel="afryca.consensusmodel.zhang2011minimumcost.Zhang2011MinimumCost"
Information="%ConsensusModel.Information"
MainFeatures="%ConsensusModel.Features"
Multicriteria="false"
Name="%ConsensusModel.Name"
Observations="%ConsensusModel.Observations"
Structure="afryca.fpr"
WithFeedback="false"
id="zhang2011minimumcost">
<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.1">
</Restriction>
<Restriction
type="upper_limit"
value="1">
</Restriction>
</Variable>
<Variable
description="%Variable.description.cost"
id="costes"
is_array="true"
is_internal="false"
type="Integer">
<Array_relation
type="number_of_elements_equals_to"
variable="experts">
</Array_relation>
</Variable>
</ConsensusModel>
</extension>
</plugin>
@@ -0,0 +1,133 @@
package afryca.consensusmodel.zhang2011minimumcost;
import java.util.ArrayList;
import afryca.ase.RunnableScript;
import afryca.cm.CM;
import afryca.consensusmodel.ConsensusEngine;
import afryca.consensusmodel.ConsensusModel;
import afryca.consensusmodel.definition.EResultElements;
import afryca.fpr.FPR;
import afryca.structure.Structure;
import afryca.consensumodel.addon.E4DIAddon;
public class Zhang2011MinimumCost extends ConsensusModel {
private static final String CONSENSUS_MODEL_NAME = "G. Zhang et al. (2011)"; //$NON-NLS-1$
private static final String EPSILON = "epsilon"; //$NON-NLS-1$ //
private static final String COST = "costes"; //$NON-NLS-1$ //
private Float epsilon;
private Integer [] cost;
private float consensusDegree;
private FPR[] preferencesWithoutGroup;
@Override
protected void setModelConfiguration() {
}
@Override
protected void obtainConfigurationValues() {
epsilon = (Float) configuration.getValue(EPSILON);
cost = (Integer[]) configuration.getValue(COST);
preferencesWithoutGroup = new FPR[preferences.length - 1];
initializePreferencesWithoutGroup();
}
private void initializePreferencesWithoutGroup() {
// Copy preferences except groupal
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));
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));
computeConsensusDegree();
computeCollective();
preSaveRoundResult(1, auxPreferences,obtainVisualizeValues(), consensusDegree);
result.put(EResultElements.initial_consensus_degree,consensusDegree);
result.put(EResultElements.maxround, 1);
result.put(EResultElements.consensus_threshold, epsilon);
result.put(EResultElements.consensus_model, CONSENSUS_MODEL_NAME);
}
@Override
protected void preSaveRoundResults() {
computeConsensusDegree();
computeCollective();
preSaveRoundResult(1, preferences,obtainVisualizeValues(), consensusDegree);
}
@Override
protected void posSaveRoundResults() {
computeConsensusDegree();
computeCollective();
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("Zhang2011MinimumCost")
.putVariable("epsilon", epsilon)
.putVariable("cost", cost)
.putVariable("pref", preferencesWithoutGroup)
.putVariable("alternatives", alternatives.length)
.execute())
.getResult();
int cont = 0;
for(FPR fpr: preferencesResult) {
preferences[cont] = fpr;
cont++;
}
}
private void computeCollective() {
preferences[numberOfExperts] = ConsensusEngine.groupPreferences(numberOfExperts, numberOfAlternatives,preferences);
}
private void computeConsensusDegree() {
CM[][] sm_matrices = ConsensusEngine.similarityMatrices(numberOfExperts, numberOfAlternatives, preferences);
CM consensusMatrix = ConsensusEngine.consensusMatrixBasedOnSimilarityBetweenFPRs(numberOfExperts,numberOfAlternatives, sm_matrices);
Float [] ca = ConsensusEngine.computeAlternativesConsensus(numberOfAlternatives, consensusMatrix);
consensusDegree = ConsensusEngine.consensusBasedOnAlternativesConsensus(numberOfAlternatives, ca);
}
}
@@ -0,0 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: afryca.consensusmodel.zhang2011minimumcost;singleto
n:=true
Bundle-Version: 1.0.0.202101221157
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: afryca.consensusmodel
Automatic-Module-Name: afryca.consensusmodel.zhang2011minimumcost
@@ -0,0 +1,4 @@
#Fri Jan 22 13:01:49 CET 2021
artifact.main=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.zhang2011minimumcost\\target\\afryca.consensusmodel.zhang2011minimumcost-1.0.0-SNAPSHOT.jar
artifact.attached.p2artifacts=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.zhang2011minimumcost\\target\\p2artifacts.xml
artifact.attached.p2metadata=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.zhang2011minimumcost\\target\\p2content.xml
@@ -0,0 +1,3 @@
artifactId=afryca.consensusmodel.zhang2011minimumcost
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.zhang2011minimumcost' version='1.0.0.202101221157'>
<properties size='5'>
<property name='artifact.size' value='7164'/>
<property name='download.size' value='7164'/>
<property name='maven-groupId' value='afryca.group'/>
<property name='maven-artifactId' value='afryca.consensusmodel.zhang2011minimumcost'/>
<property name='maven-version' value='1.0.0-SNAPSHOT'/>
</properties>
</artifact>
</artifacts>
@@ -0,0 +1,43 @@
<?xml version='1.0' encoding='UTF-8'?>
<units size='1'>
<unit id='afryca.consensusmodel.zhang2011minimumcost' version='1.0.0.202101221157' generation='2'>
<update id='afryca.consensusmodel.zhang2011minimumcost' range='[0.0.0,1.0.0.202101221157)' severity='0'/>
<properties size='5'>
<property name='df_LT.Bundle-Name.0' value='Zhang2011minimumcost'/>
<property name='org.eclipse.equinox.p2.name' value='%Bundle-Name.0'/>
<property name='maven-groupId' value='afryca.group'/>
<property name='maven-artifactId' value='afryca.consensusmodel.zhang2011minimumcost'/>
<property name='maven-version' value='1.0.0-SNAPSHOT'/>
</properties>
<provides size='5'>
<provided namespace='org.eclipse.equinox.p2.iu' name='afryca.consensusmodel.zhang2011minimumcost' version='1.0.0.202101221157'/>
<provided namespace='osgi.bundle' name='afryca.consensusmodel.zhang2011minimumcost' version='1.0.0.202101221157'/>
<provided namespace='osgi.identity' name='afryca.consensusmodel.zhang2011minimumcost' 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='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.zhang2011minimumcost
</description>
</requiredProperties>
</requires>
<artifacts size='1'>
<artifact classifier='osgi.bundle' id='afryca.consensusmodel.zhang2011minimumcost' 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.zhang2011minimumcost;singleton:=true&#xA;Bundle-Version: 1.0.0.202101221157&#xA;
</instruction>
</instructions>
</touchpointData>
</unit>
</units>