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.palomares2014cluster</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.palomares2014cluster;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: afryca.consensusmodel
Bundle-ActivationPolicy: lazy
Automatic-Module-Name: afryca.consensusmodel.palomares2014cluster
@@ -0,0 +1,14 @@
#Properties file for afryca.consensusmodel.palomares2014cluster
afryca.consensusmodel.palomares2014cluster.information = Paper:Palomares, I., Martinez, L., & Herrera, F. A consensus model to detect and manage noncooperative behaviors in large-scale group decision making. IEEE Transactions on Fuzzy Systems, 22(3), pp. 516-530, 2014\\n I. Palomares \\n Consensus model suitable to manage large scales of decision makers, which incorporates a fuzzy clustering-based scheme to detect and manage individual and subgroup noncooperative behaviors
afryca.consensusmodel.palomares2014cluster.MainFeatures = Fuzzy preference relations \\n Clustering \\n Detect non cooperative behaviours \\ Full weigth penalizing \\n Feedback
afryca.consensusmodel.palomares2014cluster.Name = I. Palomares et al. (TFS-2014)
afryca.consensusmodel.palomares2014cluster.Observations = No observations
afryca.consensusmodel.palomares2014cluster.variable.max_rounds.description = Maximum Number of rounds
afryca.consensusmodel.palomares2014cluster.variable.epsilon.description = Aceptability threshold
afryca.consensusmodel.palomares2014cluster.variable.distance_measure_minkowski.description = Minkowski distance measure
afryca.consensusmodel.palomares2014cluster.variable.cluster_similiraty_threshold.description = Threshold similarity between clusters
afryca.consensusmodel.palomares2014cluster.variable.min_distance_cluster.description = Minimun distance between similar clusters
afryca.consensusmodel.palomares2014cluster.variable.outlier_threshold.description = Outlier detection mechanism
afryca.consensusmodel.palomares2014cluster.variable.outlier_membership.description = Cluster membership threshold for outliers
afryca.consensusmodel.palomares2014cluster.variable.consensus_threshold.description = Consensus threshold
Bundle-Name = Palomares2014cluster
@@ -0,0 +1,14 @@
#Properties file for afryca.consensusmodel.palomares2014cluster
afryca.consensusmodel.palomares2014cluster.information = Paper:Palomares, I., Martinez, L., & Herrera, F. A consensus model to detect and manage noncooperative behaviors in large-scale group decision making. IEEE Transactions on Fuzzy Systems, 22(3), pp. 516-530, 2014\\n I. Palomares \\n Consensus model suitable to manage large scales of decision makers, which incorporates a fuzzy clustering-based scheme to detect and manage individual and subgroup noncooperative behaviors
afryca.consensusmodel.palomares2014cluster.MainFeatures = Clustering \\n Detección de comportamientos no cooperativos \\ Penalizacion de pesos completa \\n Retroalimentacion
afryca.consensusmodel.palomares2014cluster.Name = I. Palomares et al. (TFS-2014)
afryca.consensusmodel.palomares2014cluster.Observations = No observations
afryca.consensusmodel.palomares2014cluster.variable.max_rounds.description = Número mmáximo de rondas
afryca.consensusmodel.palomares2014cluster.variable.epsilon.description = Umbral de aceptabilidad
afryca.consensusmodel.palomares2014cluster.variable.distance_measure_minkowski.description = Medida de distancia Minkowski
afryca.consensusmodel.palomares2014cluster.variable.cluster_similiraty_threshold.description = Umbral de similitud entre clasters
afryca.consensusmodel.palomares2014cluster.variable.min_distance_cluster.description = Distancia minima entre clusters parecidos
afryca.consensusmodel.palomares2014cluster.variable.outlier_threshold.description = Umbral del mecanismo de expertos solitarios(outliers)
afryca.consensusmodel.palomares2014cluster.variable.outlier_membership.description = Umbral de pertenecia a un claster para expertos solitarios(outliers)
afryca.consensusmodel.palomares2014cluster.variable.consensus_threshold.description = Umbral de consenso
Bundle-Name = Palomares2014cluster
@@ -0,0 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="afryca.consensusmodel">
<ConsensusModel
ConsensusModel="afryca.consensusmodel.Palomares2014Cluster"
Information="%afryca.consensusmodel.palomares2014cluster.information"
MainFeatures="%afryca.consensusmodel.palomares2014cluster.MainFeatures"
Multicriteria="false"
Name="%afryca.consensusmodel.palomares2014cluster.Name"
Observations="%afryca.consensusmodel.palomares2014cluster.Observations"
Structure="afryca.fpr"
WithFeedback="true"
id="Palomares2014Cluster">
<Variable
default_value="15"
description="%afryca.consensusmodel.palomares2014cluster.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.palomares2014cluster.variable.epsilon.description"
id="epsilon"
is_array="false"
is_internal="false"
type="Float">
<Restriction
type="lower_limit"
value="0">
</Restriction>
</Variable>
<Variable
default_value="1"
description="%afryca.consensusmodel.palomares2014cluster.variable.distance_measure_minkowski.description"
id="distance_measure_minkowski"
is_array="false"
is_internal="false"
type="Integer">
<Restriction
type="lower_limit"
value="1">
</Restriction>
</Variable>
<Variable
default_value="0.9"
description="%afryca.consensusmodel.palomares2014cluster.variable.cluster_similiraty_threshold.description "
id="cluster_similiraty_threshold"
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.01"
description="%afryca.consensusmodel.palomares2014cluster.variable.min_distance_cluster.description"
id="min_distance_cluster"
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.75"
description="%afryca.consensusmodel.palomares2014cluster.variable.outlier_threshold.description"
id="outlier_threshold"
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.4"
description="%afryca.consensusmodel.palomares2014cluster.variable.outlier_membership.description"
id="outlier_membership"
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.palomares2014cluster.variable.consensus_threshold.description"
id="consensus_threshold"
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,566 @@
package afryca.consensusmodel;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import afryca.cm.CM;
import afryca.consensusmodel.cluster.ClusterFPR;
import afryca.consensusmodel.clustering.FuzzyCMeansFPR;
import afryca.consensusmodel.clustering.FuzzyCMeansFPRKatsavounidis;
import afryca.consensusmodel.definition.EResultElements;
import afryca.consensusmodel.definition.ERoundResult;
import afryca.fpr.FPR;
import afryca.structure.Structure;
import afryca.structure.pair.Pair;
public class Palomares2014Cluster extends ConsensusModel {
private static final String CONSENSUS_MODEL_NAME = "I. Palomares IEEE. (2014) Clustering"; //$NON-NLS-1$
private static final String DISTANCE_MEASURE_MINKOWSKI = "distance_measure_minkowski"; //$NON-NLS-1$ //1
private static final String CLUSTER_SIMILARITY_THRESHOLD = "cluster_similiraty_threshold"; //$NON-NLS-1$ //0.9
private static final String MIN_DISTANCE_CLUSTER = "min_distance_cluster"; //$NON-NLS-1$ //0.01
private static final String OUTLIER_THRESHOLD = "outlier_threshold"; //$NON-NLS-1$ //0.75
private static final String OULIER_MEMBERSHIP = "outlier_membership"; //$NON-NLS-1$ //0.4
private static final String MAX_ROUNDS = "max_rounds"; //$NON-NLS-1$ //15
private static final String CONSENSUS_THRESHOLD = "consensus_threshold";//$NON-NLS-1$ //0.85
private static final String EPSILON = "epsilon"; //$NON-NLS-1$ //
private int p;
private float cSimThreshold;
private float minDisCluster;
private float outThreshold;
private float outMembership;
private float epsilon;
private int maxRounds;
private float consensusThreshold;
private float consensusDegree;
private int currentRound;
private int[] advises;
private Float[] weights;
private CM consensusMatrix;
private Float[] ca;
private List<ClusterFPR> postClusters;
@Override
protected void setModelConfiguration() {
}
@Override
protected void obtainConfigurationValues() {
p = (Integer) configuration.getValue(DISTANCE_MEASURE_MINKOWSKI);
cSimThreshold = (Float) configuration.getValue(CLUSTER_SIMILARITY_THRESHOLD);
minDisCluster = (Float) configuration.getValue(MIN_DISTANCE_CLUSTER);
outThreshold = (Float) configuration.getValue(OUTLIER_THRESHOLD);
outMembership = (Float) configuration.getValue(OULIER_MEMBERSHIP);
epsilon = (Float) configuration.getValue(EPSILON);
maxRounds = (Integer) configuration.getValue(MAX_ROUNDS);
consensusThreshold = (Float) configuration.getValue(CONSENSUS_THRESHOLD);
postClusters = new LinkedList<ClusterFPR>();
initializeAdvises();
initializeWeights();
}
private void initializeAdvises() {
advises = new int[experts.length];
for (int i = 0; i < advises.length; i++) {
advises[i] = 0;
}
}
private void initializeWeights() {
weights = new Float[experts.length];
for (int i = 0; i < weights.length; i++) {
weights[i] = 1f;
}
}
@Override
protected Float[][][] obtainVisualizeValues() {
computeCollective();
computeConsensusDegree();
Float[][][] preferencesGroupVisualization = new Float[numberOfExperts + 1][numberOfAlternatives][numberOfAlternatives];
for (int k = 0; k < numberOfExperts+1; k++) {
preferencesGroupVisualization[k] = preferences[k].obtainVisualizeValues();
}
return preferencesGroupVisualization;
}
@Override
protected void preFirstSaveRoundResults() {
preSaveRoundResult(0, preferences,obtainVisualizeValues(), consensusDegree);
result.put(EResultElements.initial_consensus_degree, consensusDegree);
result.put(EResultElements.maxround, maxRounds);
result.put(EResultElements.consensus_threshold, consensusThreshold);
result.put(EResultElements.consensus_model, CONSENSUS_MODEL_NAME);
}
@Override
protected void preSaveRoundResults() {
preSaveRoundResult(currentRound + 1, preferences,obtainVisualizeValues(), consensusDegree);
roundsResults.get(roundsResults.size() - 1).put(ERoundResult.clusters, postClusters);
}
@Override
protected void consensusRound() {
int nChanges = 0;
computeCollective();
computeConsensusDegree();
if (consensusDegree < consensusThreshold) {
CM[] proximityMatrices = ConsensusEngine.similarityMatricesRespectCollective(numberOfExperts,numberOfAlternatives, preferences, preferences[numberOfExperts]);
Boolean[][] pairsOfAlternativesToChange = identifyPairsOfAlternativesToChange(numberOfAlternatives, ca, consensusDegree, consensusMatrix);
CM proximityAverageMatrix = ConsensusEngine.similarityAverageMatrix(numberOfExperts, numberOfAlternatives,proximityMatrices);
Boolean[][][] changePairsOfAlternativesByExperts = identifyChangePairsOfAlternativesByExperts(pairsOfAlternativesToChange, proximityMatrices,proximityAverageMatrix);
EChangeType[][][] changes = calculeChanges(changePairsOfAlternativesByExperts);
nChanges = countChanges(changes);
double[] changesIndividual = getNChanges(nChanges);
advises = new int[numberOfExperts];
makeChanges(changes, changesIndividual);
postClusters = FuzzyCMeansFPRKatsavounidis.doClusteringFuzzyCMeansKatsavounidis(alternatives, experts, (Structure[]) preferences, p);
List<Integer> nonCooperativeClusters=detectGroupNonCooperativeBehavior();
if(!nonCooperativeClusters.isEmpty()){
updateSubGroupWeights(nonCooperativeClusters);
}
if (consensusDegree > outThreshold) {
List<Integer> expertsNonCooperative=detectIndividualNonCooperativeBehavior();
if(!expertsNonCooperative.isEmpty()){
updateIndividualWeights(expertsNonCooperative);
}
}
currentRound++;
}
}
private void computeCollective() {
if (equalWeigths(weights)) {
preferences[numberOfExperts] = ConsensusEngine.groupPreferences(numberOfExperts, numberOfAlternatives,preferences);
} else {
preferences[numberOfExperts] = ConsensusEngine.groupPreferencesWeights(numberOfExperts, numberOfAlternatives, preferences, weights);
}
}
private void computeConsensusDegree() {
CM[][] sm_matrices = ConsensusEngine.similarityMatrices(numberOfExperts, numberOfAlternatives, preferences);
if (equalWeigths(weights)) {
consensusMatrix = ConsensusEngine.consensusMatrixBasedOnSimilarityBetweenFPRs(numberOfExperts, numberOfAlternatives, sm_matrices);
} else {
consensusMatrix = ConsensusEngine.consensusMatrixBasedOnSimilarityBetweenFPRsMinWeights(numberOfExperts, numberOfAlternatives, sm_matrices, weights);
}
ca = ConsensusEngine.computeAlternativesConsensus(numberOfAlternatives, consensusMatrix);
consensusDegree = ConsensusEngine.consensusBasedOnAlternativesConsensus(numberOfAlternatives, ca);
}
private boolean equalWeigths(Float[] weights) {
for (int i = 0; i < weights.length - 1; i++) {
if (Float.compare(weights[i], weights[i + 1]) !=0 ) {
return false;
}
}
return true;
}
@Override
protected void posSaveRoundResults() {
posSaveRoundResult(preferences,obtainVisualizeValues(), consensusDegree, advises, preferences[numberOfExperts]);
}
@Override
protected boolean mustBeCarriedOutAnotherRound() {
return (((float) consensusDegree < consensusThreshold) && (currentRound < maxRounds));
}
@Override
protected void saveExecutionResults() {
this.configuration.setValue(PREFERENCES, preferences);
result.put(EResultElements.number_of_rounds_required, currentRound);
result.put(EResultElements.consensus_degree_achieved, consensusDegree);
}
/**
* 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 Boolean[][][] identifyChangePairsOfAlternativesByExperts(Boolean[][] pairsOfAlternativesToChange, CM[] proximityMatrices, CM proximityAverageMatrix) {
Boolean[][][] result = new Boolean[experts.length][alternatives.length][alternatives.length];
Boolean change;
for (int expert = 0; expert < experts.length; expert++) {
for (int i = 0; i < alternatives.length; i++) {
for (int j = 0; j < alternatives.length; j++) {
change = false;
if (pairsOfAlternativesToChange[i][j]) {
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 EChangeType[][][] calculeChanges(Boolean[][][] changePairsOfAlternativesByExperts) {
EChangeType[][][] result = new EChangeType[experts.length][alternatives.length][alternatives.length];
Float difference;
for (int expert = 0; expert < experts.length; expert++) {
for (int i = 0; i < alternatives.length; i++) {
for (int j = 0; j < alternatives.length; j++) {
if (changePairsOfAlternativesByExperts[expert][i][j]) {
difference = (float) preferences[expert].getValue(i, j)
- (Float) preferences[experts.length].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
* @param changesIndividual
* Update coefficient
* @param advises
*/
private void makeChanges( EChangeType[][][] changes,double[] changesIndividual) {
float value;
EChangeType change;
int numChanges = 0;
for (int expert = 0; expert < experts.length; expert++) {
for (int i = 0; i < alternatives.length; i++) {
for (int j = 0; j < alternatives.length; j++) {
change = changes[expert][i][j];
if (change != EChangeType.NotChange) {
if (changesIndividual[numChanges] != 0) {
value = (Float) preferences[expert].getValue(i, j);
if (change == EChangeType.Increase) {
value+=changesIndividual[numChanges];
if (value > 1f) {
value = 1f;
} else if(value < 0f) {
value = 0f;
}
} else if (change == EChangeType.Decrease) {
value-=changesIndividual[numChanges];
if (value > 1f) {
value = 1f;
} else if(value < 0f) {
value = 0f;
}
}
((FPR) preferences[expert]).setValueSymmetrically(i, j, value);
advises[expert] = 1;
}
numChanges++;
}
}
}
}
}
private int countChanges(EChangeType[][][] result) {
int n = 0;
for (int expert = 0; expert < result.length; expert++) {
for (int i = 0; i < result[expert].length; i++) {
for (int j = 0; j < result[expert][i].length; j++) {
if (result[expert][i][j] != EChangeType.NotChange) {
n++;
}
}
}
}
return n;
}
@SuppressWarnings("unchecked")
private List<Integer> detectGroupNonCooperativeBehavior() {
List<ClusterFPR> lastClusters=(List<ClusterFPR>) roundsResults.get(roundsResults.size() - 1).get(ERoundResult.clusters);
ArrayList<ArrayList<Double>> degreeLast = new ArrayList<ArrayList<Double>>();
ArrayList<ArrayList<Double>> degreePost = new ArrayList<ArrayList<Double>>();
double increment = 0;
List<Pair<Integer,Integer>> sameClusterList=new ArrayList<>();
List<Pair<Integer,Integer>> furtherDistanceClusterList=new ArrayList<>();
HashSet<Integer> nonClustersHash=new HashSet<>();
List<Integer> nonCooperativeClusters=new ArrayList<>();
if (lastClusters != null) {
// Detect subgroups non coperative
//SIMILAR CLUSTER COMPOSITION
degreePost=computeExpertsMembershipDegrees((Structure[]) preferences, postClusters);
degreeLast=computeExpertsMembershipDegrees(((Structure[]) roundsResults.get(roundsResults.size() - 1).get(ERoundResult.pre_preferences)),lastClusters);
for (int i = 1; i < postClusters.size(); i++) {//INIT i=1, not compare the first cluster(centroid=collective)
for (int j = i; j < lastClusters.size(); j++) {
increment = 0;
for (int k = 0; k < experts.length; k++) {
increment += Math.abs(degreePost.get(k).get(i) - degreeLast.get(k).get(j));
}
if ((1 - (increment / experts.length)) >= cSimThreshold) {//IS A SIMILAR CLUSTER
sameClusterList.add(new Pair<Integer,Integer>(i,j));
}
}
}
//FURTHER DISTANCE TO Pc
if (!sameClusterList.isEmpty()) {
for (int i=0;i<sameClusterList.size();i++) {
double postDistance = ConsensusEngine.distanceMinkowski((FPR) postClusters.get(0).getCentroid(), (FPR) postClusters.get(sameClusterList.get(i).getLeft()).getCentroid(), p);
double lastDistance = ConsensusEngine.distanceMinkowski((FPR) lastClusters.get(0).getCentroid(), (FPR) lastClusters.get(sameClusterList.get(i).getRight()).getCentroid(), p);
if (postDistance > minDisCluster && postDistance >= lastDistance) {
furtherDistanceClusterList.add(sameClusterList.get(i));
}
}
}
//MEMBERSHIP ASSEMBLING
if (!furtherDistanceClusterList.isEmpty()) {
for (int i=0;i<furtherDistanceClusterList.size();i++) {
double sumDegreeLast = 0;
double sumDegreePost = 0;
for (int j = 0; j < experts.length; j++) {
sumDegreePost += degreePost.get(j).get(furtherDistanceClusterList.get(i).getLeft());
sumDegreeLast += degreeLast.get(j).get(furtherDistanceClusterList.get(i).getRight());
}
if (sumDegreePost > sumDegreeLast) {
nonClustersHash.add(furtherDistanceClusterList.get(i).getLeft());
}
}
double sumDegreeLastCollective = 0;
double sumDegreePostCollective = 0;
for (int j = 0; j < experts.length; j++) {
sumDegreePostCollective += degreePost.get(j).get(0);
sumDegreeLastCollective += degreeLast.get(j).get(0);
}
if (sumDegreePostCollective < sumDegreeLastCollective) {
nonClustersHash.add(0);
}
}
}
for( Iterator<Integer> it = nonClustersHash.iterator(); it.hasNext(); ) {
Object obj = it.next();
int c = (int)obj;
nonCooperativeClusters.add(c);
}
return nonCooperativeClusters;
}
private List<Integer> detectIndividualNonCooperativeBehavior() {
ArrayList<ArrayList<Double>> degreePost = new ArrayList<ArrayList<Double>>();
List<Integer> expertsAux = new ArrayList<>();
List<Integer> expertsNonCooperative = new ArrayList<>();
degreePost=computeExpertsMembershipDegrees((Structure[]) preferences, postClusters);
for (int i = 0; i < experts.length; i++) {
boolean membership=true;
for (Double degree : degreePost.get(i)) {
if (degree < outMembership) {
membership=false;
}
}
if(!membership){
expertsAux.add(i);
}
}
if (!expertsAux.isEmpty()) {
double d = 0;
for (int i = 0; i < experts.length; i++) {
d += ConsensusEngine.distanceMinkowski((FPR) preferences[i], (FPR) preferences[experts.length],p);
}
d = d / experts.length;
for (int expert : expertsAux) {
if (ConsensusEngine.distanceMinkowski((FPR) preferences[expert], (FPR) preferences[experts.length],p) > d) {
expertsNonCooperative.add(expert);
} else {
double distanceMinkPost = ConsensusEngine.distanceMinkowski((FPR) preferences[expert],(FPR) preferences[experts.length], p);
double distanceMinkLast = ConsensusEngine.distanceMinkowski((FPR) ((Structure[]) roundsResults.get(roundsResults.size() - 1).get(ERoundResult.pre_preferences))[expert],
(FPR) ((Structure[]) roundsResults.get(roundsResults.size() - 1).get(ERoundResult.pre_preferences))[experts.length],p);
if (distanceMinkPost > distanceMinkLast) {
expertsNonCooperative.add(expert);
}
}
}
}
return expertsNonCooperative;
}
private ArrayList<ArrayList<Double>> computeExpertsMembershipDegrees(Structure[] preferences, List<ClusterFPR> cluster){
ArrayList<ArrayList<Double>> degree = new ArrayList<ArrayList<Double>>();
for (int i = 0; i < experts.length; i++) {
degree.add(FuzzyCMeansFPR.computeExpertMembershipDegrees(i, (FPR) preferences[i], p,cluster));
}
return degree;
}
private void updateSubGroupWeights(List<Integer> nonCooperativeClusters) {
for (Integer cluster : nonCooperativeClusters) {
for (Integer expert: postClusters.get(cluster).getExperts()) {
weights[expert]=updateWeight(expert);
}
}
}
private void updateIndividualWeights(List<Integer> expertsNonCooperative) {
for (Integer expert : expertsNonCooperative) {
weights[expert]=updateWeight(expert);
}
}
private float updateWeight(int expert) {
double maxDist = Double.MIN_VALUE, dist = 0;
for (int i = 0; i < experts.length; i++) {
dist = ConsensusEngine.distanceMinkowski((FPR) preferences[i], (FPR) preferences[experts.length],p);
if (maxDist < dist) {
maxDist = dist;
}
}
dist = ConsensusEngine.distanceMinkowski((FPR) preferences[expert], (FPR) preferences[experts.length], p);
return (float) (weights[expert] * (1 - (dist / maxDist)));
}
}
@@ -0,0 +1,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: afryca.consensusmodel.palomares2014cluster;singleto
n:=true
Bundle-Version: 1.0.0.202101221157
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: afryca.consensusmodel
Bundle-ActivationPolicy: lazy
Automatic-Module-Name: afryca.consensusmodel.palomares2014cluster
@@ -0,0 +1,4 @@
#Fri Jan 22 13:01:32 CET 2021
artifact.main=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.palomares2014cluster\\target\\afryca.consensusmodel.palomares2014cluster-1.0.0-SNAPSHOT.jar
artifact.attached.p2artifacts=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.palomares2014cluster\\target\\p2artifacts.xml
artifact.attached.p2metadata=C\:\\Users\\\u00C1lvaro\\Workspaces\\afryca_2020\\afryca\\plugins\\afryca.consensusmodel.palomares2014cluster\\target\\p2content.xml
@@ -0,0 +1,3 @@
artifactId=afryca.consensusmodel.palomares2014cluster
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.palomares2014cluster' version='1.0.0.202101221157'>
<properties size='5'>
<property name='artifact.size' value='12369'/>
<property name='download.size' value='12369'/>
<property name='maven-groupId' value='afryca.group'/>
<property name='maven-artifactId' value='afryca.consensusmodel.palomares2014cluster'/>
<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.palomares2014cluster' version='1.0.0.202101221157' generation='2'>
<update id='afryca.consensusmodel.palomares2014cluster' range='[0.0.0,1.0.0.202101221157)' severity='0'/>
<properties size='6'>
<property name='es.Bundle-Name' value='Palomares2014cluster'/>
<property name='df_LT.Bundle-Name' value='Palomares2014cluster'/>
<property name='org.eclipse.equinox.p2.name' value='%Bundle-Name'/>
<property name='maven-groupId' value='afryca.group'/>
<property name='maven-artifactId' value='afryca.consensusmodel.palomares2014cluster'/>
<property name='maven-version' value='1.0.0-SNAPSHOT'/>
</properties>
<provides size='6'>
<provided namespace='org.eclipse.equinox.p2.iu' name='afryca.consensusmodel.palomares2014cluster' version='1.0.0.202101221157'/>
<provided namespace='osgi.bundle' name='afryca.consensusmodel.palomares2014cluster' version='1.0.0.202101221157'/>
<provided namespace='osgi.identity' name='afryca.consensusmodel.palomares2014cluster' 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.palomares2014cluster
</description>
</requiredProperties>
</requires>
<artifacts size='1'>
<artifact classifier='osgi.bundle' id='afryca.consensusmodel.palomares2014cluster' 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.palomares2014cluster;singleton:=true&#xA;Bundle-Version: 1.0.0.202101221157&#xA;
</instruction>
</instructions>
</touchpointData>
</unit>
</units>