public code v1
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<?flintstones.helper.data.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,17 @@
|
||||
<?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.owa</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<name>[bundle] Owa</name>
|
||||
<organization>
|
||||
<name>Sinbad2</name>
|
||||
</organization>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>flintstones.operator.aggregation.owa</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>1779484362735</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>
|
||||
+2
@@ -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,20 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Owa
|
||||
Bundle-SymbolicName: flintstones.operator.aggregation.owa;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: Sinbad2
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: flintstones.operator,
|
||||
flintstones.entity.valuation,
|
||||
flintstones.model.valuation.service,
|
||||
flintstones.valuation.numeric.integer,
|
||||
flintstones.valuation.numeric.real,
|
||||
flintstones.valuation.linguistic,
|
||||
flintstones.valuation.twoTuple,
|
||||
flintstones.quantifiers.yager,
|
||||
flintstones.domain.numeric.real,
|
||||
flintstones.entity.domain,
|
||||
flintstones.entity.operator
|
||||
Automatic-Module-Name: flintstones.operator.aggregation.owa
|
||||
Export-Package: flintstones.operator.aggregation.owa
|
||||
@@ -0,0 +1,5 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xml>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="flintstones.operator.aggregation.extensionpoint">
|
||||
<aggregation_operator_type
|
||||
uid="flintstones.operator.aggregation.owa"
|
||||
implementation="flintstones.operator.aggregation.owa.OWA">
|
||||
<aggregation_operator
|
||||
implementation="flintstones.operator.aggregation.owa.operators.OWAInteger"
|
||||
valuationId="flintstones.valuation.integer">
|
||||
</aggregation_operator>
|
||||
<aggregation_operator
|
||||
implementation="flintstones.operator.aggregation.owa.operators.OWAReal"
|
||||
valuationId="flintstones.valuation.real">
|
||||
</aggregation_operator>
|
||||
<aggregation_operator
|
||||
implementation="flintstones.operator.aggregation.owa.operators.OwaTwoTuple"
|
||||
valuationId="flintstones.valuation.twoTuple">
|
||||
</aggregation_operator>
|
||||
</aggregation_operator_type>
|
||||
</extension>
|
||||
</plugin>
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package flintstones.operator.aggregation.owa;
|
||||
|
||||
import flintstones.entity.operator.AggregationOperator;
|
||||
import flintstones.entity.operator.interfaces.IWeightedAggregationOperator;
|
||||
|
||||
@SuppressWarnings("javadoc")
|
||||
public abstract class OWA extends AggregationOperator implements IWeightedAggregationOperator {
|
||||
|
||||
public static final String ID = "flintstones.operator.aggregation.owa"; //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "OWA";
|
||||
}
|
||||
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package flintstones.operator.aggregation.owa.operators;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import flintstones.domain.numeric.integer.NumericIntegerDomain;
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
import flintstones.helper.validator.Validator;
|
||||
import flintstones.operator.aggregation.owa.OWA;
|
||||
import flintstones.quantifiers.yager.YagerQuantifiers;
|
||||
import flintstones.valuation.numeric.integer.IntegerValuation;
|
||||
|
||||
public class OWAInteger extends OWA {
|
||||
|
||||
@Override
|
||||
public Valuation aggregate(List<Valuation> valuations, List<Double> weights) {
|
||||
return this.aggregate(valuations, weights.get(0), weights.get(1));
|
||||
}
|
||||
|
||||
|
||||
public Valuation aggregate(List<Valuation> valuations, double alphaQ, double betaQ) {
|
||||
IntegerValuation result = null;
|
||||
double measure = 0;
|
||||
List<Double> measures = new LinkedList<Double>();
|
||||
NumericIntegerDomain domain = null;
|
||||
|
||||
for(Valuation valuation : valuations) {
|
||||
Validator.notIllegalElementType(valuation, new String[] { IntegerValuation.class.toString() });
|
||||
|
||||
if(domain == null) {
|
||||
domain = (NumericIntegerDomain) valuation.getDomain();
|
||||
} else if (!domain.equals(valuation.getDomain())) {
|
||||
throw new IllegalArgumentException("Messages.IntegerOperator_Invalid_domain");
|
||||
}
|
||||
|
||||
measures.add(((IntegerValuation) valuation).getValue());
|
||||
|
||||
}
|
||||
|
||||
if(domain != null) {
|
||||
Collections.sort(measures);
|
||||
Collections.reverse(measures);
|
||||
|
||||
int size = measures.size();
|
||||
double[] weights = YagerQuantifiers.Q(size, alphaQ, betaQ);
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
measure += weights[i] * measures.get(i);
|
||||
}
|
||||
|
||||
result = (IntegerValuation) valuations.get(0).clone();
|
||||
result.setValue(measure);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package flintstones.operator.aggregation.owa.operators;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import flintstones.domain.numeric.real.NumericRealDomain;
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
import flintstones.helper.validator.Validator;
|
||||
import flintstones.operator.aggregation.owa.OWA;
|
||||
import flintstones.quantifiers.yager.YagerQuantifiers;
|
||||
import flintstones.valuation.numeric.real.RealValuation;
|
||||
|
||||
public class OWAReal extends OWA {
|
||||
|
||||
@Override
|
||||
public Valuation aggregate(List<Valuation> valuations, List<Double> weights) {
|
||||
return this.aggregate(valuations, weights.get(0), weights.get(1));
|
||||
}
|
||||
|
||||
public Valuation aggregate(List<Valuation> valuations, double alphaQ, double betaQ) {
|
||||
RealValuation result = null;
|
||||
double measure = 0;
|
||||
List<Double> measures = new LinkedList<Double>();
|
||||
NumericRealDomain domain = null;
|
||||
|
||||
for(Valuation valuation : valuations) {
|
||||
Validator.notIllegalElementType(valuation, new String[] { RealValuation.class.toString() });
|
||||
|
||||
if(domain == null) {
|
||||
domain = (NumericRealDomain) valuation.getDomain();
|
||||
} else if (!domain.equals(valuation.getDomain())) {
|
||||
throw new IllegalArgumentException("Messages.RealOperator_Invalid_domain");
|
||||
}
|
||||
|
||||
measures.add(((RealValuation) valuation).getValue());
|
||||
|
||||
}
|
||||
|
||||
if(domain != null) {
|
||||
Collections.sort(measures);
|
||||
Collections.reverse(measures);
|
||||
|
||||
int size = measures.size();
|
||||
double[] weights = YagerQuantifiers.Q(size, alphaQ, betaQ);
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
measure += weights[i] * measures.get(i);
|
||||
}
|
||||
|
||||
result = (RealValuation) valuations.get(0).clone();
|
||||
result.setValue(measure);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
package flintstones.operator.aggregation.owa.operators;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import flintstones.domain.fuzzyset.FuzzySet;
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
import flintstones.helper.validator.Validator;
|
||||
import flintstones.operator.aggregation.owa.OWA;
|
||||
import flintstones.valuation.twoTuple.TwoTupleValuation;
|
||||
|
||||
public class OwaTwoTuple extends OWA {
|
||||
//
|
||||
// @Override
|
||||
// public Valuation aggregate(List<Valuation> valuations, List<Double> weights) {
|
||||
// return this.aggregate(valuations, weights.get(0), weights.get(1));
|
||||
// }
|
||||
//
|
||||
// public Valuation aggregate(List<Valuation> valuations, double alphaQ, double betaQ) {
|
||||
// TwoTuple result = null;
|
||||
// double beta = 0;
|
||||
// List<Double> measures = new LinkedList<Double>();
|
||||
// FuzzySet domain = null;
|
||||
//
|
||||
// for (Valuation valuation : valuations) {
|
||||
// Validator.notIllegalElementType(valuation, new String[] { TwoTuple.class.toString() });
|
||||
//
|
||||
// if (domain == null) {
|
||||
// domain = (FuzzySet) valuation.getDomain();
|
||||
// } else if (!domain.equals(valuation.getDomain())) {
|
||||
// throw new IllegalArgumentException("Messages.TwoTupleOperator_Invalid_domain");
|
||||
// }
|
||||
//
|
||||
// measures.add(((TwoTuple) valuation).calculateInverseDelta());
|
||||
// }
|
||||
//
|
||||
// if (domain != null) {
|
||||
// Collections.sort(measures);
|
||||
// Collections.reverse(measures);
|
||||
//
|
||||
// int size = measures.size();
|
||||
// double[] weights = YagerQuantifiers.Q(size, alphaQ, betaQ);
|
||||
//
|
||||
// for (int i = 0; i < size; i++) {
|
||||
// beta += weights[i] * measures.get(i);
|
||||
// }
|
||||
//
|
||||
// result = (TwoTuple) valuations.get(0)
|
||||
// .clone();
|
||||
// result.calculateDelta(beta);
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
public Valuation aggregate(List<Valuation> valuations, List<Double> weights) {
|
||||
TwoTupleValuation result = null;
|
||||
double beta = 0;
|
||||
List<Double> measures = new LinkedList<Double>();
|
||||
FuzzySet domain = null;
|
||||
|
||||
for (Valuation valuation : valuations) {
|
||||
Validator.notIllegalElementType(valuation, new String[] { TwoTupleValuation.class.toString() });
|
||||
|
||||
if (domain == null) {
|
||||
domain = (FuzzySet) valuation.getDomain();
|
||||
} else if (!domain.equals(valuation.getDomain())) {
|
||||
throw new IllegalArgumentException("Messages.TwoTupleOperator_Invalid_domain");
|
||||
}
|
||||
measures.add(((TwoTupleValuation) valuation).calculateInverseDelta());
|
||||
}
|
||||
|
||||
if (domain != null) {
|
||||
Collections.sort(measures);
|
||||
Collections.reverse(measures);
|
||||
|
||||
int size = measures.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
beta += weights.get(i) * measures.get(i);
|
||||
}
|
||||
|
||||
result = (TwoTupleValuation) valuations.get(0).clone();
|
||||
result.calculateDelta(beta);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user