# ARXConfiguration (ARX Developer Documentation)

org.deidentifier.arx

## Class ARXConfiguration

- java.lang.Object
- - org.deidentifier.arx.ARXConfiguration

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

      public class ARXConfiguration
      extends java.lang.Object
      implements java.io.Serializable, java.lang.Cloneable

  A generic configuration for the ARX anonymizer.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ARXConfiguration.ARXConfigurationInternal` Class for internal use that provides access to more parameters and functionality.
    `static class` | `ARXConfiguration.Monotonicity` Monotonicity.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `REQUIREMENT_COUNTER` Do the criteria require a counter per equivalence class.
    `static int` | `REQUIREMENT_DISTRIBUTION` Do the criteria require distributions of sensitive values in the equivalence classes.
    `static int` | `REQUIREMENT_SECONDARY_COUNTER` Do the criteria require a second counter.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ARXConfiguration` | `addCriterion(PrivacyCriterion c)` Deprecated.
    `ARXConfiguration` | `addPrivacyModel(PrivacyCriterion c)` Adds a privacy model to the configuration.
    `ARXConfiguration` | `clone()` Clones this config.
    `boolean` | `containsCriterion(java.lang.Class<? extends PrivacyCriterion> clazz)` Deprecated.
    `static ARXConfiguration` | `create()` Creates a new configuration without tuple suppression.
    `static ARXConfiguration` | `create(double suppressionLimit)` Creates a new configuration that allows the given percentage of outliers and thus implements tuple suppression.
    `static ARXConfiguration` | `create(double suppressionLimit, Metric<?> metric)` Creates a new configuration that allows the given percentage of outliers and thus implements tuple suppression.
    `static ARXConfiguration` | `create(Metric<?> metric)` Creates a new configuration that allows to define the metric for measuring information loss.
    `protected int` | `getAbsoluteMaxOutliers()` Returns the maximum number of allowed outliers.
    `double` | `getAttributeWeight(java.lang.String attribute)` Returns the weight for the given attribute.
    `java.util.Map<java.lang.String,java.lang.Double>` | `getAttributeWeights()` Returns all configured attribute weights.
    `ARXCostBenefitConfiguration` | `getCostBenefitConfiguration()` Returns the cost/benefit configuration
    `java.util.Set<PrivacyCriterion>` | `getCriteria()` Deprecated.
    `<T extends PrivacyCriterion> java.util.Set<T>` | `getCriteria(java.lang.Class<T> clazz)` Deprecated.
    `<T extends PrivacyCriterion> T` | `getCriterion(java.lang.Class<T> clazz)` Deprecated.
    `int` | `getHeuristicSearchThreshold()` When the size of the solution space exceeds the returned number of transformations, ARX will use a heuristic search strategy.
    `int` | `getHeuristicSearchTimeLimit()` The heuristic search algorithm will terminate after the returned number of milliseconds.
    `protected ARXConfiguration` | `getInstanceForLocalRecoding(RowSet rowset, double gsFactor)` Clones this config and projects everything onto the given subset. - All privacy models will be cloned - Subsets in d-presence will be projected accordingly - Utility measures will be cloned - Replaces estimated k-map with according k-anonymity
    `protected ARXConfiguration.ARXConfigurationInternal` | `getInternalConfiguration()` Returns an internal variant of the class which provides a broader interface
    `double` | `getMaxOutliers()` Returns the maximum number of allowed outliers.
    `Metric<?>` | `getMetric()` Deprecated.
    `protected int` | `getMinimalGroupSize()` Returns the minimal size of an equivalence class induced by the defined privacy models.
    `ARXConfiguration.Monotonicity` | `getMonotonicityOfPrivacy()` Returns whether the privacy model is monotonic
    `ARXConfiguration.Monotonicity` | `getMonotonicityOfUtility()` Returns whether the utility measure is monotonic
    `<T extends PrivacyCriterion> T` | `getPrivacyModel(java.lang.Class<T> clazz)` Returns an instance of the class, if any.
    `java.util.Set<PrivacyCriterion>` | `getPrivacyModels()` Returns all privacy models.
    `<T extends PrivacyCriterion> java.util.Set<T>` | `getPrivacyModels(java.lang.Class<T> clazz)` Returns all privacy models which are instances of the given class.
    `protected PrivacyCriterion[]` | `getPrivacyModelsAsArray()` Returns all criteria (except k-anonymity) as an array.
    `Metric<?>` | `getQualityModel()` Returns the quality model to be used for optimizing output data.
    `protected int` | `getRequirements()` Returns the criteria's requirements.
    `double` | `getRiskThresholdJournalist()` Return journalist risk threshold, 1 if there is none
    `double` | `getRiskThresholdMarketer()` Return marketer risk threshold, 1 if there is none
    `double` | `getRiskThresholdProsecutor()` Return prosecutor risk threshold, 1 if there is none
    `protected SampleBasedCriterion[]` | `getSampleBasedPrivacyModelsAsArray()` Returns all sample-based criteria as an array.
    `protected int` | `getSnapshotLength()` Returns the specific length of each entry in a snapshot.
    `protected DataSubset` | `getSubset()` Returns the data subset, if any subset is defined.
    `protected int` | `getSuppressedAttributeTypes()` Returns an integer representing all attribute types that must be suppressed.
    `protected void` | `initialize(DataManager manager)` Initializes the configuration.
    `boolean` | `isAttributeTypeSuppressed(AttributeType type)` Returns whether values of the given attribute type will be replaced by the suppression string in suppressed tuples.
    `boolean` | `isHeuristicSearchEnabled()` Returns whether ARX will use a heuristic search strategy.
    `boolean` | `isPracticalMonotonicity()` Is practical monotonicity assumed.
    `boolean` | `isPrivacyModelSpecified(java.lang.Class<? extends PrivacyCriterion> clazz)` Returns whether the configuration contains a privacy model which is an instance of the given class.
    `boolean` | `isSuppressionAlwaysEnabled()` Returns whether suppression is applied to the output of anonymous as well as non-anonymous transformations.
    `boolean` | `isUseHeuristicSearchForSampleBasedCriteria()` Is optimality guaranteed for sample-based criteria?
    `boolean` | `isUtilityBasedMicroaggregation()` Returns whether the impact of microaggregation on data utility should be considered
    `boolean` | `isUtilityBasedMicroaggregationUseMeanSquaredError()` If set to true, mean squared error will be used to measure the impact of microaggregation on data quality.
    `<T extends PrivacyCriterion> boolean` | `removeCriterion(PrivacyCriterion arg)` Removes the given criterion.
    `java.util.List<ElementData>` | `render()` Renders this object
    `protected boolean` | `requires(int requirement)` Convenience method for checking the requirements.
    `void` | `setAttributeTypeSuppressed(AttributeType type, boolean enabled)` Defines values of which attribute type are to be replaced by the suppression string in suppressed tuples.
    `void` | `setAttributeWeight(java.lang.String attribute, double weight)` Sets the weight for the given attribute.
    `void` | `setAttributeWeight(java.lang.String attribute, java.lang.Double weight)` Sets the weight for the given attribute.
    `ARXConfiguration` | `setCostBenefitConfiguration(ARXCostBenefitConfiguration config)` Sets the cost/benefit configuration
    `void` | `setHeuristicSearchEnabled(boolean heuristicSearchEnabled)` Sets whether ARX will use a heuristic search strategy.
    `void` | `setHeuristicSearchThreshold(int numberOfTransformations)` When the size of the solution space exceeds the given number of transformations, ARX will use a heuristic search strategy.
    `void` | `setHeuristicSearchTimeLimit(int timeInMillis)` The heuristic search algorithm will terminate after the given number of milliseconds.
    `void` | `setMaxOutliers(double max)` Allows for a certain percentage of outliers and thus triggers tuple suppression.
    `void` | `setMetric(Metric<?> model)` Deprecated.
    `void` | `setPracticalMonotonicity(boolean assumeMonotonicity)` Set, if practical monotonicity assumed.
    `void` | `setQualityModel(Metric<?> model)` Sets the quality model to be used for optimizing output data.
    `void` | `setSuppressionAlwaysEnabled(boolean enabled)` Sets whether suppression is applied to the output of anonymous as well as non-anonymous transformations.
    `void` | `setSuppressionLimit(double limit)` Sets the suppression limit.
    `void` | `setUseHeuristicSearchForSampleBasedCriteria(boolean value)` Do we guarantee optimality for sample-based criteria?
    `void` | `setUtilityBasedMicroaggregation(boolean value)` Sets whether the impact of microaggregation on data utility should be considered
    `void` | `setUtilityBasedMicroaggregationUseMeanSquaredError(boolean useMSE)` If set to true, mean squared error will be used to measure the impact of microaggregation on data quality.

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### REQUIREMENT_COUNTER

          public static final int REQUIREMENT_COUNTER

      Do the criteria require a counter per equivalence class.
      See Also:
        Constant Field Values

    - #### REQUIREMENT_DISTRIBUTION

          public static final int REQUIREMENT_DISTRIBUTION

      Do the criteria require distributions of sensitive values in the equivalence classes.
      See Also:
        Constant Field Values

    - #### REQUIREMENT_SECONDARY_COUNTER

          public static final int REQUIREMENT_SECONDARY_COUNTER

      Do the criteria require a second counter.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### create

          public static ARXConfiguration create()

      Creates a new configuration without tuple suppression.
      Returns:

    - #### create

          public static ARXConfiguration create(double suppressionLimit)

      Creates a new configuration that allows the given percentage of outliers and thus implements tuple suppression.
      Parameters:
        `suppressionLimit` -
      Returns:

    - #### create

          public static ARXConfiguration create(double suppressionLimit,
                                Metric<?> metric)

      Creates a new configuration that allows the given percentage of outliers and thus implements tuple suppression. Defines the metric for measuring information loss.
      Parameters:
        `suppressionLimit` -
        `metric` -
      Returns:

    - #### create

          public static ARXConfiguration create(Metric<?> metric)

      Creates a new configuration that allows to define the metric for measuring information loss.
      Parameters:
        `metric` -
      Returns:

    - #### addCriterion

          @Deprecated
          public ARXConfiguration addCriterion(PrivacyCriterion c)

      Deprecated.
      Adds a privacy model to the configuration. This method is deprecated. Please use addPrivacyModel(...) instead.
      Parameters:
        `c` -
      Returns:

    - #### addPrivacyModel

          public ARXConfiguration addPrivacyModel(PrivacyCriterion c)

      Adds a privacy model to the configuration.
      Parameters:
        `c` -
      Returns:

    - #### clone

          public ARXConfiguration clone()

      Clones this config.
      Overrides:
        `clone` in class `java.lang.Object`
      Returns:

    - #### containsCriterion

          @Deprecated
          public boolean containsCriterion(java.lang.Class<? extends PrivacyCriterion> clazz)

      Deprecated.
      Returns whether the configuration contains a privacy model which is an instance of the given class. This method is deprecated. Please use isPrivacyModelSpecified(...) instead.
      Parameters:
        `clazz` -
      Returns:

    - #### isPrivacyModelSpecified

          public boolean isPrivacyModelSpecified(java.lang.Class<? extends PrivacyCriterion> clazz)

      Returns whether the configuration contains a privacy model which is an instance of the given class.
      Parameters:
        `clazz` -
      Returns:

    - #### getAttributeWeight

          public double getAttributeWeight(java.lang.String attribute)

      Returns the weight for the given attribute.
      Parameters:
        `attribute` -
      Returns:

    - #### getAttributeWeights

          public java.util.Map<java.lang.String,java.lang.Double> getAttributeWeights()

      Returns all configured attribute weights. For attributes which are not a key in this set the default attribute weight will be assumed by ARX. This default value is currently set to 0.5.
      Returns:

    - #### getCostBenefitConfiguration

          public ARXCostBenefitConfiguration getCostBenefitConfiguration()

      Returns the cost/benefit configuration

    - #### getCriteria

          @Deprecated
          public java.util.Set<PrivacyCriterion> getCriteria()

      Deprecated.
      Returns all criteria. This method is deprecated. Please use getPrivacyModels() instead.
      Returns:

    - #### getCriteria

          @Deprecated
          public <T extends PrivacyCriterion> java.util.Set<T> getCriteria(java.lang.Class<T> clazz)

      Deprecated.
      Returns all privacy models which are instances of the given class. This method is deprecated. Please use getPrivacyModels(...) instead.
      Type Parameters:
        `T` -
      Parameters:
        `clazz` -
      Returns:

    - #### getCriterion

          @Deprecated
          public <T extends PrivacyCriterion> T getCriterion(java.lang.Class<T> clazz)

      Deprecated.
      Returns an instance of the class, if any. Throws an exception if more than one such model exists. This method is deprecated. Please use getPrivacyModel(...) instead.
      Type Parameters:
        `T` -
      Parameters:
        `clazz` -
      Returns:

    - #### getHeuristicSearchThreshold

          public int getHeuristicSearchThreshold()

      When the size of the solution space exceeds the returned number of transformations, ARX will use a heuristic search strategy. The default is 100.000.
      Returns:

    - #### getHeuristicSearchTimeLimit

          public int getHeuristicSearchTimeLimit()

      The heuristic search algorithm will terminate after the returned number of milliseconds. The default is 30 seconds.
      Parameters:
        `timeInMillis` -

    - #### getMaxOutliers

          public final double getMaxOutliers()

      Returns the maximum number of allowed outliers.
      Returns:

    - #### getMetric

          @Deprecated
          public Metric<?> getMetric()

      Deprecated.
      Returns the quality model to be used for optimizing output data. This method is deprecated. Please use getQualityModel() instead.
      Returns:

    - #### getMonotonicityOfPrivacy

          public ARXConfiguration.Monotonicity getMonotonicityOfPrivacy()

      Returns whether the privacy model is monotonic
      Returns:

    - #### getMonotonicityOfUtility

          public ARXConfiguration.Monotonicity getMonotonicityOfUtility()

      Returns whether the utility measure is monotonic
      Returns:

    - #### getPrivacyModel

          public <T extends PrivacyCriterion> T getPrivacyModel(java.lang.Class<T> clazz)

      Returns an instance of the class, if any. Throws an exception if more than one such model exists.
      Type Parameters:
        `T` -
      Parameters:
        `clazz` -
      Returns:

    - #### getPrivacyModels

          public java.util.Set<PrivacyCriterion> getPrivacyModels()

      Returns all privacy models.
      Returns:

    - #### getPrivacyModels

          public <T extends PrivacyCriterion> java.util.Set<T> getPrivacyModels(java.lang.Class<T> clazz)

      Returns all privacy models which are instances of the given class.
      Type Parameters:
        `T` -
      Parameters:
        `clazz` -
      Returns:

    - #### getQualityModel

          public Metric<?> getQualityModel()

      Returns the quality model to be used for optimizing output data.
      Returns:

    - #### getRiskThresholdJournalist

          public double getRiskThresholdJournalist()

      Return journalist risk threshold, 1 if there is none
      Returns:

    - #### getRiskThresholdMarketer

          public double getRiskThresholdMarketer()

      Return marketer risk threshold, 1 if there is none
      Returns:

    - #### getRiskThresholdProsecutor

          public double getRiskThresholdProsecutor()

      Return prosecutor risk threshold, 1 if there is none
      Returns:

    - #### isAttributeTypeSuppressed

          public boolean isAttributeTypeSuppressed(AttributeType type)

      Returns whether values of the given attribute type will be replaced by the suppression string in suppressed tuples.
      Parameters:
        `type` -
      Returns:

    - #### isHeuristicSearchEnabled

          public boolean isHeuristicSearchEnabled()

      Returns whether ARX will use a heuristic search strategy. The default is false.
      Returns:

    - #### isPracticalMonotonicity

          public boolean isPracticalMonotonicity()

      Is practical monotonicity assumed.
      Returns:

    - #### isSuppressionAlwaysEnabled

          public boolean isSuppressionAlwaysEnabled()

      Returns whether suppression is applied to the output of anonymous as well as non-anonymous transformations. If this flag is set to `true`, suppression will be applied to the output of non-anonymous transformations to make them anonymous (if possible). Default is `true`.
      Returns:

    - #### isUseHeuristicSearchForSampleBasedCriteria

          public boolean isUseHeuristicSearchForSampleBasedCriteria()

      Is optimality guaranteed for sample-based criteria?

    - #### isUtilityBasedMicroaggregation

          public boolean isUtilityBasedMicroaggregation()

      Returns whether the impact of microaggregation on data utility should be considered
      Returns:

    - #### isUtilityBasedMicroaggregationUseMeanSquaredError

          public boolean isUtilityBasedMicroaggregationUseMeanSquaredError()

      If set to true, mean squared error will be used to measure the impact of microaggregation on data quality. If set to false, a more simple measure of information loss will be used. Default is `false`.
      Returns:

    - #### removeCriterion

          public <T extends PrivacyCriterion> boolean removeCriterion(PrivacyCriterion arg)

      Removes the given criterion.
      Type Parameters:
        `T` -
      Parameters:
        `arg` -
      Returns:

    - #### render

          public java.util.List<ElementData> render()

      Renders this object
      Returns:

    - #### setAttributeTypeSuppressed

          public void setAttributeTypeSuppressed(AttributeType type,
                                        boolean enabled)

      Defines values of which attribute type are to be replaced by the suppression string in suppressed tuples. With default settings, only quasi-identifiers will be suppressed.
      Parameters:
        `type` - the attribute type
        `enabled` - whether suppression should be performed or not

    - #### setAttributeWeight

          public void setAttributeWeight(java.lang.String attribute,
                                double weight)

      Sets the weight for the given attribute.
      Parameters:
        `attribute` -
        `weight` -

    - #### setAttributeWeight

          public void setAttributeWeight(java.lang.String attribute,
                                java.lang.Double weight)

      Sets the weight for the given attribute.
      Parameters:
        `attribute` -
        `weight` -

    - #### setCostBenefitConfiguration

          public ARXConfiguration setCostBenefitConfiguration(ARXCostBenefitConfiguration config)

      Sets the cost/benefit configuration
      Parameters:
        `config` -

    - #### setHeuristicSearchEnabled

          public void setHeuristicSearchEnabled(boolean heuristicSearchEnabled)

      Sets whether ARX will use a heuristic search strategy. The default is false.
      Parameters:
        `heuristicSearchEnabled` -

    - #### setHeuristicSearchThreshold

          public void setHeuristicSearchThreshold(int numberOfTransformations)

      When the size of the solution space exceeds the given number of transformations, ARX will use a heuristic search strategy. The default is 100.000.
      Parameters:
        `numberOfTransformations` -

    - #### setHeuristicSearchTimeLimit

          public void setHeuristicSearchTimeLimit(int timeInMillis)

      The heuristic search algorithm will terminate after the given number of milliseconds. The default is 30 seconds.
      Parameters:
        `timeInMillis` -

    - #### setMaxOutliers

          public void setMaxOutliers(double max)

      Allows for a certain percentage of outliers and thus triggers tuple suppression.
      Parameters:
        `max` -

    - #### setMetric

          @Deprecated
          public void setMetric(Metric<?> model)

      Deprecated.
      Sets the quality model to be used for optimizing output data. This method is deprecated. Please use setQualityModel(...) instead.
      Parameters:
        `model` -

    - #### setPracticalMonotonicity

          public void setPracticalMonotonicity(boolean assumeMonotonicity)

      Set, if practical monotonicity assumed.
      Parameters:
        `assumeMonotonicity` -

    - #### setQualityModel

          public void setQualityModel(Metric<?> model)

      Sets the quality model to be used for optimizing output data.
      Parameters:
        `model` -

    - #### setSuppressionAlwaysEnabled

          public void setSuppressionAlwaysEnabled(boolean enabled)

      Sets whether suppression is applied to the output of anonymous as well as non-anonymous transformations. If this flag is set to `true`, suppression will be applied to the output of non-anonymous transformations to make them anonymous (if possible). Default is `true`.
      Parameters:
        `enabled` -

    - #### setSuppressionLimit

          public void setSuppressionLimit(double limit)

      Sets the suppression limit. This is an alias for setMaxOutliers().
      Parameters:
        `limit` -

    - #### setUseHeuristicSearchForSampleBasedCriteria

          public void setUseHeuristicSearchForSampleBasedCriteria(boolean value)

      Do we guarantee optimality for sample-based criteria?

    - #### setUtilityBasedMicroaggregation

          public void setUtilityBasedMicroaggregation(boolean value)

      Sets whether the impact of microaggregation on data utility should be considered

    - #### setUtilityBasedMicroaggregationUseMeanSquaredError

          public void setUtilityBasedMicroaggregationUseMeanSquaredError(boolean useMSE)

      If set to true, mean squared error will be used to measure the impact of microaggregation on data quality. If set to false, a more simple measure of information loss will be used. Default is `false`.

    - #### getAbsoluteMaxOutliers

          protected final int getAbsoluteMaxOutliers()

      Returns the maximum number of allowed outliers.
      Returns:

    - #### getPrivacyModelsAsArray

          protected PrivacyCriterion[] getPrivacyModelsAsArray()

      Returns all criteria (except k-anonymity) as an array. Only used internally. If k-anonymity is included the minimal group size should be obtained and enforced
      Returns:

    - #### getInstanceForLocalRecoding

          protected ARXConfiguration getInstanceForLocalRecoding(RowSet rowset,
                                                     double gsFactor)

      Clones this config and projects everything onto the given subset.
      - All privacy models will be cloned
      - Subsets in d-presence will be projected accordingly
      - Utility measures will be cloned
      - Replaces estimated k-map with according k-anonymity
      Parameters:
        `gsFactor` -
      Returns:

    - #### getInternalConfiguration

          protected ARXConfiguration.ARXConfigurationInternal getInternalConfiguration()

      Returns an internal variant of the class which provides a broader interface
      Returns:

    - #### getMinimalGroupSize

          protected int getMinimalGroupSize()

      Returns the minimal size of an equivalence class induced by the defined privacy models.
      Returns:
        If k-anonymity is contained, k is returned. If l-diversity is contained, l is returned. If both are contained max(k,l) is returned. Otherwise, Integer.MAX_VALUE is returned.

    - #### getRequirements

          protected int getRequirements()

      Returns the criteria's requirements.
      Returns:

    - #### getSampleBasedPrivacyModelsAsArray

          protected SampleBasedCriterion[] getSampleBasedPrivacyModelsAsArray()

      Returns all sample-based criteria as an array. Only used internally.
      Returns:

    - #### getSnapshotLength

          protected int getSnapshotLength()

      Returns the specific length of each entry in a snapshot.
      Returns:

    - #### getSubset

          protected DataSubset getSubset()

      Returns the data subset, if any subset is defined. You may only call this, after the configuration has be initialized.
      Returns:

    - #### getSuppressedAttributeTypes

          protected int getSuppressedAttributeTypes()

      Returns an integer representing all attribute types that must be suppressed.
      Returns:

    - #### initialize

          protected void initialize(DataManager manager)

      Initializes the configuration.
      Parameters:
        `manager` -

    - #### requires

          protected boolean requires(int requirement)

      Convenience method for checking the requirements.
      Parameters:
        `requirement` -
      Returns: