public class ParetoDominanceCalculator
extends java.lang.Object
SimpleField
,
PairField
or SimilarityField
. To see how the dominance for pairs of simple field values is calculated,
see PairField.checkDominance
and SimilarityField.checkDominance
methods.Modifier and Type | Field | Description |
---|---|---|
static int |
DEFAULT_TREATMENT_FOR_ATTRIBUTES_WITHOUT_PREFERENCE_TYPE |
Default treatment for attributes without preference type assigned.
|
static int |
EXAMPLES_EQUAL |
Result of the
checkDominance methods comparing whole examples,
returned when both compared examples have identical values for each checked active condition criterion. |
static int |
EXAMPLES_INCOMPARABLE |
Result of the
checkDominance methods comparing whole examples,
returned when two examples are incomparable. |
static int |
FIELD_VALUES_EQUAL |
Result of the
checkDominance method comparing two field values,
returned when both field values are equal. |
static int |
FIELD_VALUES_INCOMPARABLE |
Result of the
checkDominance method comparing two field values,
returned when these values are incomparable. |
static int |
FIRST_EXAMPLE_STRICTLY_DOMINATES_SECOND |
Result of the
checkDominance methods comparing whole examples,
returned when the first example Pareto-dominates the second one and for at least one checked active condition
criterion dominance is strict (attributes' values are not equal). |
static int |
FIRST_FIELD_VALUE_IS_BETTER |
Result of the
checkDominance method comparing two field values,
returned when the first field value is better than the second one. |
static int |
IGNORE_ATTRIBUTES_WITHOUT_PREFERENCE_TYPE |
Possible value of
treatmentForAttributesWithoutPreferenceType field,
used when all attributes without preference type assigned should be ignored when
calculating dominance between two given examples. |
static int |
INCLUDE_ATTRIBUTES_WITHOUT_PREFERENCE_TYPE |
Possible value of private
treatmentForAttributesWithoutPreferenceType field,
used when all attributes without preference type assigned should be taken into account when
calculating dominance between two given examples. |
static int |
SECOND_EXAMPLE_STRICTLY_DOMINATES_FIRST |
Result of the
checkDominance methods comparing whole examples,
returned when the second example Pareto-dominates the first one and for at least one checked active condition
criterion dominance is strict (attributes' values are not equal). |
static int |
SECOND_FIELD_VALUE_IS_BETTER |
Result of the
checkDominance method comparing two field values,
returned when the second field value is better than the first one. |
Modifier and Type | Method | Description |
---|---|---|
static int |
checkDominance(int exampleNumber1,
int exampleNumber2,
MemoryContainer memoryContainer) |
Establishes presence or absence of Pareto dominance between two examples given by numbers.
|
static int |
checkDominance(int exampleNumber1,
int exampleNumber2,
MemoryContainer memoryContainer,
byte[] attributesMask) |
Establishes presence or absence of Pareto dominance between two examples given by numbers.
|
static int |
checkDominance(int exampleNumber1,
int exampleNumber2,
MemoryContainer memoryContainer,
int attributeNumber) |
Establishes presence or absence of Pareto dominance between two examples given by numbers, for one attribute only.
|
static int |
checkDominance(Field fieldValue1,
Field fieldValue2,
int preferenceType) |
Establishes presence or absence of Pareto dominance between given two field values, each from a different example.
|
static boolean |
dominates(int x,
int y,
MemoryContainer memoryContainer) |
Checks if the first object Pareto-dominates the second one w.r.t. given memory container.
|
static boolean |
dominates(int x,
int y,
MemoryContainer memoryContainer,
byte[] attributesMask) |
Checks if the first object Pareto-dominates the second one w.r.t. given memory container.
This method wraps checkDominance(int, int, MemoryContainer) method - sets temporary mask
for attributes, gets result of checkDominance(int, int, MemoryContainer) method
(which uses temporary mask), deletes the mask and then returns processed result. |
static int |
getTreatmentForAttributesWithoutPreferenceType() |
Gets current treatment for attributes without preference type assigned.
|
static void |
resetTreatmentForAttributesWithoutPreferenceType() |
Restores default treatment for attributes without preference type assigned
|
static void |
setTreatmentForAttributesWithoutPreferenceType(int treatmentForAttributesWithoutPreferenceType) |
Sets method of treatment for atributes without preference type assigned.
|
public static final int EXAMPLES_EQUAL
checkDominance
methods comparing whole examples,
returned when both compared examples have identical values for each checked active condition criterion.public static final int FIRST_EXAMPLE_STRICTLY_DOMINATES_SECOND
checkDominance
methods comparing whole examples,
returned when the first example Pareto-dominates the second one and for at least one checked active condition
criterion dominance is strict (attributes' values are not equal).public static final int SECOND_EXAMPLE_STRICTLY_DOMINATES_FIRST
checkDominance
methods comparing whole examples,
returned when the second example Pareto-dominates the first one and for at least one checked active condition
criterion dominance is strict (attributes' values are not equal).public static final int EXAMPLES_INCOMPARABLE
checkDominance
methods comparing whole examples,
returned when two examples are incomparable.public static final int FIELD_VALUES_EQUAL
checkDominance
method comparing two field values,
returned when both field values are equal.public static final int FIRST_FIELD_VALUE_IS_BETTER
checkDominance
method comparing two field values,
returned when the first field value is better than the second one.public static final int SECOND_FIELD_VALUE_IS_BETTER
checkDominance
method comparing two field values,
returned when the second field value is better than the first one.public static final int FIELD_VALUES_INCOMPARABLE
checkDominance
method comparing two field values,
returned when these values are incomparable.public static final int IGNORE_ATTRIBUTES_WITHOUT_PREFERENCE_TYPE
treatmentForAttributesWithoutPreferenceType
field,
used when all attributes without preference type assigned should be ignored when
calculating dominance between two given examples. Attributes without preference type
are those, for which method getPreferenceType
returns Attribute.NONE
.public static final int INCLUDE_ATTRIBUTES_WITHOUT_PREFERENCE_TYPE
treatmentForAttributesWithoutPreferenceType
field,
used when all attributes without preference type assigned should be taken into account when
calculating dominance between two given examples. Attributes without preference type
are those, for which method getPreferenceType
returns Attribute.NONE
.
When comparing two examples on such attribute it is checked if both attribute's values are equal.
If so, then it means that examples are comparable and calculations can proceed to next attribute.
If not, then it means that examples are incomparable, calculations stop and appropriate result is returned.public static final int DEFAULT_TREATMENT_FOR_ATTRIBUTES_WITHOUT_PREFERENCE_TYPE
INCLUDE_ATTRIBUTES_WITHOUT_PREFERENCE_TYPE
value.public static void setTreatmentForAttributesWithoutPreferenceType(int treatmentForAttributesWithoutPreferenceType)
IGNORE_ATTRIBUTES_WITHOUT_PREFERENCE_TYPE
or
INCLUDE_ATTRIBUTES_WITHOUT_PREFERENCE_TYPE
.
SIC! By modifing class variable this method affects all subsequent calls to checkDominance
method.
To restore default treatment of attributes without preference type at any time, call
resetTreatmentForAttributesWithoutPreferenceType
method.treatmentForAttributesWithoutPreferenceType
- method of treatment for atributes without preference type assignedInvalidValueException
- when treatmentForAttributesWithoutPreferenceType
is not
IGNORE_ATTRIBUTES_WITHOUT_PREFERENCE_TYPE
nor
INCLUDE_ATTRIBUTES_WITHOUT_PREFERENCE_TYPE
public static void resetTreatmentForAttributesWithoutPreferenceType()
public static int getTreatmentForAttributesWithoutPreferenceType()
IGNORE_ATTRIBUTES_WITHOUT_PREFERENCE_TYPE
or
INCLUDE_ATTRIBUTES_WITHOUT_PREFERENCE_TYPE
.public static boolean dominates(int x, int y, MemoryContainer memoryContainer)
x
- number of the first object from the given memory containery
- number of the second object from the given memory containermemoryContainer
- memory containertrue
if the first object Pareto-dominates the second one w.r.t. given memory container, false
otherwisepublic static boolean dominates(int x, int y, MemoryContainer memoryContainer, byte[] attributesMask)
checkDominance(int, int, MemoryContainer)
method - sets temporary mask
for attributes, gets result of checkDominance(int, int, MemoryContainer)
method
(which uses temporary mask), deletes the mask and then returns processed result.x
- number of the first object from the given memory containery
- number of the second object from the given memory containermemoryContainer
- memory containerattributesMask
- Mask for attributes, allowing dominance calculations for a subset of active and condition attributes.
It is checked if length of the mask is equal to the number of attributes in memory container.
If attributesMask(i) is equal to zero,
than corresponding attribute is not taken into account at all when calculating dominance, even if it's active and condition.
If attributesMask(i) is different than zero,
than corresponding attribute is considered further - it is checked if it's active and condition.
In fact only mask values corresponding to active and condition attributes are important. All other values are
not taken into account and may be any.
If all active and condition attributes are masked (i.e., all mask entries corresponding to active and
condition attributes are equal to zero), then result of this method is true
.true
if the first object Pareto-dominates the second one w.r.t. given memory container, false
otherwisepublic static int checkDominance(int exampleNumber1, int exampleNumber2, MemoryContainer memoryContainer)
SimpleField
, PairField
or SimilarityField
.
For method details see description of the whole class.null
.exampleNumber1
- number of first example to compareexampleNumber2
- number of second example to comparememoryContainer
- reference to memory container both examples belong toEXAMPLES_EQUAL
if both examples have identical values for each checked attributeFIRST_EXAMPLE_STRICTLY_DOMINATES_SECOND
if first example Pareto-dominates second one
and for at least one checked active condition criterion dominance is strict
(attributes' values are not equal)SECOND_EXAMPLE_STRICTLY_DOMINATES_FIRST
if second example Pareto-dominates first one
and for at least one checked active condition criterion dominance is strict
(attributes' values are not equal)EXAMPLES_INCOMPARABLE
if examples are incomparableInvalidTypeException
- when type of any active condition attribute is different than
SimpleField
, PairField
and SimilarityField
java.lang.NullPointerException
- when memory container is null
java.lang.IndexOutOfBoundsException
- when number of first or second example is too small or too big for
given memory containerInvalidValueException
- when memory container contains no attributes or no examplespublic static int checkDominance(int exampleNumber1, int exampleNumber2, MemoryContainer memoryContainer, byte[] attributesMask)
SimpleField
, PairField
or SimilarityField
.
For method details see description of whole class.checkDominance(int, int, MemoryContainer)
method - sets temporary mask
for attributes, gets result of checkDominance(int, int, MemoryContainer)
method
(which uses temporary mask) and finally deletes the mask.exampleNumber1
- number of first example to compareexampleNumber2
- number of second example to comparememoryContainer
- reference to memory container both examples belong toattributesMask
- Mask for attributes, allowing dominance calculations for a subset of active and condition attributes.
It is checked if length of the mask is equal to the number of attributes in memory container.
If attributesMask(i) is equal to zero,
than corresponding attribute is not taken into account at all when calculating dominance, even if it's active and condition.
If attributesMask(i) is different than zero,
than corresponding attribute is considered further - it is checked if it's active and condition.
In fact only mask values corresponding to active and condition attributes are important. All other values are
not taken into account and may be any.
If all active and condition attributes are masked (i.e., all mask entries corresponding to active and
condition attributes are equal to zero), then result of dominance check is EXAMPLES_EQUAL
.EXAMPLES_EQUAL
if both examples have identical values for each checked attributeFIRST_EXAMPLE_STRICTLY_DOMINATES_SECOND
if first example Pareto-dominates second one
and for at least one checked active condition criterion dominance is strict
(attributes' values are not equal)SECOND_EXAMPLE_STRICTLY_DOMINATES_FIRST
if second example Pareto-dominates first one
and for at least one checked active condition criterion dominance is strict
(attributes' values are not equal)EXAMPLES_INCOMPARABLE
if examples are incomparableInvalidTypeException
- when type of any active condition attribute is different than
SimpleField
, PairField
and SimilarityField
java.lang.NullPointerException
- when memory container is null
java.lang.IndexOutOfBoundsException
- when number of first or second example is too small or too big for
given memory containerInvalidValueException
- when length of given mask is different than number of attributes
in given memory container
or when memory container contains no attributes or no examplespublic static int checkDominance(Field fieldValue1, Field fieldValue2, int preferenceType)
fieldValue1
- first compared field valuefieldValue2
- second compared field valuepreferenceType
- preference type of the attribute for which field values are givenFIELD_VALUES_EQUAL
if given field values are equalFIRST_FIELD_VALUE_IS_BETTER
if the first field value is better than the second field valueSECOND_FIELD_VALUE_IS_BETTER
if the second field value is better than the first field valueFIELD_VALUES_INCOMPARABLE
if field values are incomparable (which can happen for compound fields only)InvalidTypeException
- when compared field values are not objects of the same class
or when preference type is none of: Attribute.NONE
, Attribute.GAIN
, and Attribute.COST
public static int checkDominance(int exampleNumber1, int exampleNumber2, MemoryContainer memoryContainer, int attributeNumber)
SimpleField
, PairField
or SimilarityField
.
For method details see description of whole class.exampleNumber1
- number of first example to compareexampleNumber2
- number of second example to comparememoryContainer
- reference to memory container both examples belong toattributeNumber
- number of considered attribute from given memory containerEXAMPLES_EQUAL
if both examples have identical value for considered attributeFIRST_EXAMPLE_STRICTLY_DOMINATES_SECOND
if for considered attribute first example strictly Pareto-dominates second oneSECOND_EXAMPLE_STRICTLY_DOMINATES_FIRST
if for considered attribute second example strictly Pareto-dominates first oneEXAMPLES_INCOMPARABLE
if examples are incomparable on considered attributeInvalidTypeException
- when type of considered active condition attribute is different than
SimpleField
, PairField
or SimilarityField
java.lang.NullPointerException
- when memory container is null
java.lang.IndexOutOfBoundsException
- when number of first or second example is too small or too big for
given memory container
or when number of the attribute is too small or too big for given memory containerInvalidValueException
- when memory container contains no attributes or no examples
or when considered attribute is not active or not condition