public code v1

This commit is contained in:
Francisco Jesús Martínez Mimbrera
2026-05-23 00:32:57 +02:00
commit 759a8968a2
4357 changed files with 163763 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,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>flintstones.group</groupId>
<artifactId>flintstones.bundles</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>flintstones.operator.aggregation.choquetIntegral</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>[bundle] ChoquetIntegral</name>
</project>
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flintstones.operator.aggregation.choquetIntegral</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>
<filteredResources>
<filter>
<id>1779484362732</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
@@ -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,16 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ChoquetIntegral
Bundle-SymbolicName: flintstones.operator.aggregation.choquetIntegral
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: flintstones.operator.aggregation.choquetIntegral
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: flintstones.operator,
flintstones.entity.operator
Import-Package: flintstones.domain.numeric,
flintstones.domain.numeric.integer,
flintstones.helper.validator,
flintstones.entity.valuation,
flintstones.model.valuation.service,
flintstones.valuation.numeric,
flintstones.valuation.numeric.integer
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
@@ -0,0 +1,157 @@
package flintstones.operator.aggregation.choquetIntegral;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import flintstones.entity.operator.AggregationOperator;
import flintstones.entity.operator.interfaces.IWeightedAggregationOperator;
public abstract class ChoquetIntegral extends AggregationOperator implements IWeightedAggregationOperator{
@Override
public String getName() {
return "Choquet Integral";
}
public List<Integer> getRanking(List<Double> values) {
// TODO: QUITAR ESTO; ARREGLAR; SACAR; PONER NOMBRE
class MyObject implements Comparable<MyObject> {
private Integer _pos;
private Double _value;
public MyObject(Integer pos, Double value) {
_pos = pos;
_value = value;
}
public Integer getPos() {
return _pos;
}
public Double getValue() {
return _value;
}
@Override
public int compareTo(MyObject o) {
return Double.compare(_value, o.getValue());
}
}
List<Integer> result = new LinkedList<Integer>();
List<MyObject> aux = new LinkedList<MyObject>();
int size = values.size();
for(int i = 0; i < size; i++) {
aux.add(new MyObject(i, values.get(i)));
}
Collections.sort(aux);
for(int i = 0; i < size; i++) {
result.add(aux.get(i).getPos());
}
return result;
}
public List<Double> getMeasures(List<Double> measures, List<Integer> ranking) {
List<Double> result = new LinkedList<Double>();
Double[] values = new Double[measures.size()];
double last = 0;
for(Integer i : ranking) {
values[i] = measures.get(i) - last;
last += values[i];
}
for(Double value : values) {
result.add(value);
}
return result;
}
public List<Double> getWeights(List<Integer> ranking, List<Double> weights, List<Set<Integer>> assignments) {
List<Double> result = new LinkedList<Double>();
Map<Integer, Double> auxResult = new HashMap<Integer, Double>();
Set<Integer> currentSet = new HashSet<Integer>();
for (int i = 0; i < ranking.size(); i++) {
currentSet.add(i);
}
Set<Integer> currentAssignment;
int assignmentsSize = assignments.size();
boolean duplicate = false;
Set<Integer> elementAssignments;
// Iteramos sobre todos los elementos
for(Integer currentElement : ranking) {
elementAssignments = new HashSet<Integer>();
// vamos aadiendo asignaciones una a una
for(int assignmentPos = 0; assignmentPos < assignmentsSize; assignmentPos++) {
currentAssignment = assignments.get(assignmentPos);
if(currentSet.containsAll(currentAssignment)) {
//Comprobamos si no exite una asignacin con ms elementos que la contenga
duplicate = false;
Iterator<Integer> iterator = elementAssignments.iterator();
while(iterator.hasNext() && (!duplicate)) {
if(assignments.get(iterator.next()).containsAll(currentAssignment)) {
duplicate = true;
}
}
if(!duplicate) {
// Eliminamos asignaciones contenidas en esta
List<Integer> toRemove = new LinkedList<Integer>();
for(Integer testToRemove : elementAssignments) {
if (currentAssignment.containsAll(assignments.get(testToRemove))) {
toRemove.add(testToRemove);
}
}
for(Integer removePos : toRemove) {
elementAssignments.remove(removePos);
}
// Aadimos la asignacin
elementAssignments.add(assignmentPos);
}
}
}
// Calculamos la ponderacin para cada elemento
double weight = 0;
for(Integer i : elementAssignments) {
weight += weights.get(i);
}
auxResult.put(currentElement, weight);
// Eliminamos el elemento del conjunto a calcular
currentSet.remove(currentElement);
}
// Establecemos los pesos para cada elemento
int size = auxResult.size();
for(int pos = 0; pos < size; pos++) {
result.add(auxResult.get(pos));
}
return result;
}
}
@@ -0,0 +1,71 @@
package flintstones.operator.aggregation.choquetIntegral.operators;
import java.util.List;
import flintstones.entity.valuation.Valuation;
import flintstones.operator.aggregation.choquetIntegral.ChoquetIntegral;
/*
*
http://serezade.ujaen.es:8003/igmunoz/flintstones3/blob/master/sinbad2.aggregationoperator.choquetIntegral/src/sinbad2/aggregationoperator/choquetIntegral/valuation/IntegerOperator.java
http://serezade.ujaen.es:8003/igmunoz/flintstones3/blob/master/sinbad2.aggregationoperator.choquetIntegral/src/sinbad2/aggregationoperator/choquetIntegral/valuation/RealOperator.java
http://serezade.ujaen.es:8003/igmunoz/flintstones3/blob/master/sinbad2.aggregationoperator.choquetIntegral/src/sinbad2/aggregationoperator/choquetIntegral/valuation/TwoTupleOperator.java
*/
public class ChoquetIntegralInteger extends ChoquetIntegral {
@Override
public Valuation aggregate(List<Valuation> valuations, List<Double> weights) {
/*
IntegerValuation result = null;
double measure = 0;
List<Double> measures = new LinkedList<Double>();
NumericIntegerDomain domain = null;
for (Valuation valuation : valuations) {
// Controlar evaluacin de tipo invlido
Validator.notIllegalElementType(valuation, new String[] { IntegerValuation.class.toString() });
// Comprobamos que el dominio sea igual
if(domain == null) {
domain = (NumericIntegerDomain) valuation.getDomain();
} else if(!domain.equals(valuation.getDomain())) {
throw new IllegalArgumentException("Invalid domain");
}
// Agregamos la evaluacin
measures.add((double) ((IntegerValuation) valuation).getValue());
}
// Calculamos la evaluacin
if(domain != null) {
// Calculamos el ranking
List<Integer> ranking = this.getRanking(measures);
// Calculamos los pesos para cada elemento
List<Double> finalWeights = this.getWeights(ranking, weights, assignments, rules);
// Calculamos las medidas finales
List<Double> finalMeasures = this.getMeasures(measures, ranking);
// Calculamos el resultado del operador
int size = finalMeasures.size();
for (int i = 0; i < size; i++) {
measure += finalWeights.get(i) * finalMeasures.get(i);
}
// Establecemos la medida del resultado
result = (IntegerValuation) valuations.get(0).clone();
result.setValue(measure);
}
return result;
*/
// TODO Auto-generated method stub
return null;
}
}
@@ -0,0 +1,16 @@
package flintstones.operator.aggregation.choquetIntegral.operators;
import java.util.List;
import flintstones.entity.valuation.Valuation;
import flintstones.operator.aggregation.choquetIntegral.ChoquetIntegral;
public class ChoquetIntegralReal extends ChoquetIntegral {
@Override
public Valuation aggregate(List<Valuation> valuations, List<Double> weights) {
// TODO Auto-generated method stub
return null;
}
}
@@ -0,0 +1,16 @@
package flintstones.operator.aggregation.choquetIntegral.operators;
import java.util.List;
import flintstones.entity.valuation.Valuation;
import flintstones.operator.aggregation.choquetIntegral.ChoquetIntegral;
public class ChoquetIntegralTwoTuple extends ChoquetIntegral {
@Override
public Valuation aggregate(List<Valuation> valuations, List<Double> weights) {
// TODO Auto-generated method stub
return null;
}
}