本文整理汇总了Java中org.deidentifier.arx.framework.lattice.SolutionSpace类的典型用法代码示例。如果您正苦于以下问题:Java SolutionSpace类的具体用法?Java SolutionSpace怎么用?Java SolutionSpace使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SolutionSpace类属于org.deidentifier.arx.framework.lattice包,在下文中一共展示了SolutionSpace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FLASHAlgorithmImpl
import org.deidentifier.arx.framework.lattice.SolutionSpace; //导入依赖的package包/类
/**
* Creates a new instance.
*
* @param solutionSpace
* @param checker
* @param strategy
* @param config
*/
public FLASHAlgorithmImpl(SolutionSpace solutionSpace,
NodeChecker checker,
FLASHStrategy strategy,
FLASHConfiguration config) {
super(solutionSpace, checker);
if (solutionSpace.getSize() > Integer.MAX_VALUE) {
throw new IllegalArgumentException();
}
this.checked = 0;
this.solutionSpace.setAnonymityPropertyPredictable(config.isAnonymityPropertyPredicable());
this.strategy = strategy;
this.sortedSuccessors = new int[(int)solutionSpace.getSize()][];
this.config = config;
this.potentiallyInsufficientUtility = this.config.isPruneInsufficientUtility() ?
new LinkedList<Integer>() : null;
}
示例2: ARXResult
import org.deidentifier.arx.framework.lattice.SolutionSpace; //导入依赖的package包/类
/**
* Creates a new instance.
*
* @param anonymizer
* @param registry
* @param manager
* @param checker
* @param definition
* @param config
* @param lattice
* @param duration
* @param solutionSpace
*/
protected ARXResult(ARXAnonymizer anonymizer,
DataRegistry registry,
DataManager manager,
NodeChecker checker,
DataDefinition definition,
ARXConfiguration config,
ARXLattice lattice,
long duration,
SolutionSpace solutionSpace) {
this.anonymizer = anonymizer;
this.registry = registry;
this.manager = manager;
this.checker = checker;
this.definition = definition;
this.config = config;
this.lattice = lattice;
this.optimalNode = lattice.getOptimum();
this.duration = duration;
this.solutionSpace = solutionSpace;
}
示例3: LIGHTNINGAlgorithm
import org.deidentifier.arx.framework.lattice.SolutionSpace; //导入依赖的package包/类
/**
* Constructor
* @param space
* @param checker
* @param timeLimit
* @param checkLimit
*/
private LIGHTNINGAlgorithm(SolutionSpace space, NodeChecker checker, int timeLimit, int checkLimit) {
super(space, checker);
this.checker.getHistory().setStorageStrategy(StorageStrategy.ALL);
int stepping = space.getTop().getLevel();
this.stepping = stepping > 0 ? stepping : 1;
this.propertyChecked = space.getPropertyChecked();
this.propertyExpanded = space.getPropertyExpanded();
this.propertyInsufficientUtility = space.getPropertyInsufficientUtility();
this.solutionSpace.setAnonymityPropertyPredictable(false);
this.timeLimit = timeLimit;
this.checkLimit = checkLimit;
if (timeLimit <= 0) {
throw new IllegalArgumentException("Invalid time limit. Must be greater than zero.");
}
if (checkLimit <= 0) {
throw new IllegalArgumentException("Invalid step limit. Must be greater than zero.");
}
}
示例4: History
import org.deidentifier.arx.framework.lattice.SolutionSpace; //导入依赖的package包/类
/**
* Creates a new history.
*
* @param rowCount the row count
* @param size the max size
* @param snapshotSizeDataset the snapshotSizeDataset
* @param snapshotSizeSnapshot
* @param config
* @param dictionarySensValue
* @param dictionarySensFreq
* @param solutionSpace
*/
public History(final int rowCount,
final int size,
final double snapshotSizeDataset,
final double snapshotSizeSnapshot,
final ARXConfigurationInternal config,
final IntArrayDictionary dictionarySensValue,
final IntArrayDictionary dictionarySensFreq,
final SolutionSpace solutionSpace) {
this.snapshotSizeDataset = (long) (rowCount * snapshotSizeDataset);
this.snapshotSizeSnapshot = snapshotSizeSnapshot;
this.cache = new MRUCache<MRUCacheEntryMetadata>(size);
this.nodeToSnapshot = new HashMap<Long, int[]>(size);
this.size = size;
this.dictionarySensFreq = dictionarySensFreq;
this.dictionarySensValue = dictionarySensValue;
this.config = config;
this.requirements = config.getRequirements();
this.storageTrigger = STORAGE_TRIGGER_NON_ANONYMOUS;
this.solutionSpace = solutionSpace;
}
示例5: AlgorithmMinimal
import org.deidentifier.arx.framework.lattice.SolutionSpace; //导入依赖的package包/类
/**
* Constructor
* @param space
* @param checker
*/
public AlgorithmMinimal(SolutionSpace space, NodeChecker checker) {
super(space, checker);
this.propertyChecked = space.getPropertyChecked();
this.checker.getHistory().setStorageStrategy(StorageStrategy.ALL);
this.solutionSpace.setAnonymityPropertyPredictable(false);
}
示例6: AlgorithmFlash
import org.deidentifier.arx.framework.lattice.SolutionSpace; //导入依赖的package包/类
/**
* Creates a new instance.
*
* @param solutionSpace
* @param checker
* @param strategy
*/
public AlgorithmFlash(SolutionSpace solutionSpace, NodeChecker checker, FLASHStrategy strategy) {
super(solutionSpace, checker);
if (solutionSpace.getSize() > Integer.MAX_VALUE) {
throw new IllegalArgumentException();
}
this.checked = 0;
this.config = ((FLASHAlgorithmImpl)FLASHAlgorithm.create(solutionSpace, checker, strategy)).config;
this.solutionSpace.setAnonymityPropertyPredictable(config.isAnonymityPropertyPredicable());
this.strategy = strategy;
this.sortedSuccessors = new int[(int)solutionSpace.getSize()][];
}
示例7: AlgorithmLightning
import org.deidentifier.arx.framework.lattice.SolutionSpace; //导入依赖的package包/类
/**
* Constructor
* @param space
* @param checker
* @param timeLimit Set it to zero to search for a minimally anonymous solution
*/
public AlgorithmLightning(SolutionSpace space, NodeChecker checker, int timeLimit) {
super(space, checker);
this.checker.getHistory().setStorageStrategy(StorageStrategy.ALL);
int stepping = space.getTop().getLevel();
this.stepping = stepping > 0 ? stepping : 1;
this.propertyChecked = space.getPropertyChecked();
this.propertyExpanded = space.getPropertyExpanded();
this.solutionSpace.setAnonymityPropertyPredictable(false);
this.timeLimit = timeLimit;
}
示例8: FLASHStrategy
import org.deidentifier.arx.framework.lattice.SolutionSpace; //导入依赖的package包/类
/**
* Creates a new instance.
*
* @param solutionSpace the solution space
* @param hierarchies the hierarchies
*/
public FLASHStrategy(final SolutionSpace solutionSpace,
final GeneralizationHierarchy[] hierarchies) {
// Check
if (solutionSpace.getSize() > Integer.MAX_VALUE) {
throw new IllegalArgumentException("Solution space is too large for executing the FLASH algorithm");
}
// Store
this.solutionSpace = solutionSpace;
// Prepare information about levels
int level = 0;
this.maxLevels = solutionSpace.getTop().getGeneralization().clone();
for (int i=0; i < this.maxLevels.length; i++) {
level += this.maxLevels[i];
this.maxLevels[i] ++;
}
this.maxlevel = level;
// Prepare information about distinct values
this.distinct = new int[hierarchies.length][];
for (int i = 0; i < hierarchies.length; i++) {
this.distinct[i] = hierarchies[i].getDistinctValues();
}
// Prepare cache
this.cache = new double[(int)solutionSpace.getSize()][];
}
示例9: createNoneNone
import org.deidentifier.arx.framework.lattice.SolutionSpace; //导入依赖的package包/类
/**
* Semantics of method name: monotonicity of privacy + monotonicity of utility.
*
* @param solutionSpace
* @param checker
* @param strategy
* @return
*/
private static AbstractAlgorithm createNoneNone(final SolutionSpace solutionSpace,
NodeChecker checker,
FLASHStrategy strategy) {
// We focus on the anonymity property
PhaseAnonymityProperty anonymityProperty = PhaseAnonymityProperty.ANONYMITY;
// Skip nodes for which the anonymity property is known
DependentAction triggerSkip = new DependentAction() {
@Override
public boolean appliesTo(Transformation node) {
return node.hasProperty(solutionSpace.getPropertyAnonymous()) ||
node.hasProperty(solutionSpace.getPropertyNotAnonymous());
}
};
// No evaluation, no tagging
DependentAction triggerEvaluate = new NodeActionConstant(false);
DependentAction triggerCheck = new NodeActionInverse(triggerSkip);
DependentAction triggerTag = new NodeActionConstant(false);
// Only one linear phase
FLASHConfiguration config = FLASHConfiguration.createLinearPhaseConfiguration(new FLASHPhaseConfiguration(anonymityProperty,
triggerTag,
triggerCheck,
triggerEvaluate,
triggerSkip),
StorageStrategy.ALL,
true,
false);
return new FLASHAlgorithmImpl(solutionSpace, checker, strategy, config);
}
示例10: Result
import org.deidentifier.arx.framework.lattice.SolutionSpace; //导入依赖的package包/类
/**
* Creates a new instance.
*
* @param metric the metric
* @param checker the checker
* @param lattice the solution space
* @param manager the manager
* @param algorithm
* @param time
*/
Result(final NodeChecker checker,
final SolutionSpace solutionSpace,
final DataManager manager,
final AbstractAlgorithm algorithm,
final long time) {
this.checker = checker;
this.solutionSpace = solutionSpace;
this.manager = manager;
this.algorithm = algorithm;
this.time = time;
this.optimum = algorithm.getGlobalOptimum();
}
示例11: getAlgorithm
import org.deidentifier.arx.framework.lattice.SolutionSpace; //导入依赖的package包/类
/**
* Returns an algorithm for the given problem instance
* @param config
* @param manager
* @param solutionSpace
* @param checker
* @return
*/
private AbstractAlgorithm getAlgorithm(final ARXConfiguration config,
final DataManager manager,
final SolutionSpace solutionSpace,
final NodeChecker checker) {
if (config.isHeuristicSearchEnabled() || solutionSpace.getSize() > config.getHeuristicSearchThreshold()) {
return LIGHTNINGAlgorithm.create(solutionSpace, checker, config.getHeuristicSearchTimeLimit(), config.getHeuristicSearchStepLimit());
} else {
FLASHStrategy strategy = new FLASHStrategy(solutionSpace, manager.getHierarchies());
return FLASHAlgorithm.create(solutionSpace, checker, strategy);
}
}
示例12: BenchmarkEnvironment
import org.deidentifier.arx.framework.lattice.SolutionSpace; //导入依赖的package包/类
/**
* Creates a new instance
* @param algorithm
* @param dataset
* @param measure
* @param criterion
* @param suppressionLimit
* @throws IOException
*/
private BenchmarkEnvironment(BenchmarkAlgorithm algorithm,
BenchmarkDataset dataset,
BenchmarkQualityMeasure measure,
BenchmarkPrivacyModel criterion,
double suppressionLimit) throws IOException {
// Prepare
Data data = BenchmarkSetup.getData(dataset, criterion);
ARXConfiguration config = BenchmarkSetup.getConfiguration(dataset,
measure,
algorithm,
criterion);
config.setMaxOutliers(suppressionLimit);
// Initialize
DataHandle handle = data.getHandle();
handle.getDefinition().materializeHierarchies(handle);
handle.getRegistry().reset();
handle.getRegistry().createInputSubset(config);
DataDefinition definition = handle.getDefinition();
// Encode
String[] header = ((DataHandleInput) handle).header;
int[][] dataArray = ((DataHandleInput) handle).data;
Dictionary dictionary = ((DataHandleInput) handle).dictionary;
manager = new DataManager(header,
dataArray,
dictionary,
definition,
config.getCriteria(),
new HashMap<String, DistributionAggregateFunction>());
// Attach arrays to data handle
((DataHandleInput) handle).update(manager.getDataGeneralized().getArray(),
manager.getDataAnalyzed().getArray(),
manager.getDataStatic().getArray());
// Initialize
config.initialize(manager);
// Build or clean the lattice
solutions = new SolutionSpace(manager.getHierarchiesMinLevels(),
manager.getHierarchiesMaxLevels());
// Build a node checker
checker = new NodeChecker(manager,
config.getMetric(),
config.getInternalConfiguration(),
CONST_HISTORY_SIZE,
CONST_SNAPSHOT_SIZE_1,
CONST_SNAPSHOT_SIZE_2,
solutions);
// Initialize the metric
config.getMetric().initialize(definition,
manager.getDataGeneralized(),
manager.getHierarchies(),
config);
}
示例13: ARXNode
import org.deidentifier.arx.framework.lattice.SolutionSpace; //导入依赖的package包/类
/**
* Constructor.
*
* @param lattice
* @param solutions
* @param transformation
* @param headermap
*/
private ARXNode(final ARXLattice lattice,
final SolutionSpace solutions,
final Transformation transformation,
final Map<String, Integer> headermap) {
// Set properties
this.lattice = lattice;
this.headermap = headermap;
this.transformation = transformation.getGeneralization();
this.minInformationLoss = transformation.getInformationLoss();
this.maxInformationLoss = transformation.getInformationLoss();
this.lowerBound = transformation.getLowerBound();
this.checked = transformation.hasProperty(solutions.getPropertyChecked());
// Transfer anonymity property without uncertainty
if (transformation.hasProperty(solutions.getPropertyChecked())){
if (transformation.hasProperty(solutions.getPropertyAnonymous())) {
this.anonymity = Anonymity.ANONYMOUS;
} else if(transformation.hasProperty(solutions.getPropertyNotAnonymous())) {
this.anonymity = Anonymity.NOT_ANONYMOUS;
} else {
if (!complete) {
this.anonymity = Anonymity.UNKNOWN;
} else {
throw new IllegalStateException("Missing information about transformations");
}
}
// This is a node for which the property is unknown
} else {
if (transformation.hasProperty(solutions.getPropertyAnonymous())) {
this.anonymity = uncertainty ? Anonymity.PROBABLY_ANONYMOUS : Anonymity.ANONYMOUS;
} else if (transformation.hasProperty(solutions.getPropertyNotAnonymous())) {
this.anonymity = uncertainty ? Anonymity.PROBABLY_NOT_ANONYMOUS : Anonymity.NOT_ANONYMOUS;
} else if (transformation.hasProperty(solutions.getPropertyNotKAnonymous())) {
this.anonymity = Anonymity.NOT_ANONYMOUS;
} else if (transformation.hasProperty(solutions.getPropertyInsufficientUtility())) {
this.anonymity = Anonymity.UNKNOWN;
} else {
if (!complete) {
this.anonymity = Anonymity.UNKNOWN;
} else {
throw new IllegalStateException("Missing information about transformations");
}
}
}
// Make sure that we have information loss available
// Important for expand operations
if (!complete) {
if (this.maxInformationLoss == null) {
this.maxInformationLoss = metric.createInstanceOfHighestScore();
}
if (this.minInformationLoss == null) {
this.minInformationLoss = metric.createInstanceOfLowestScore();
}
}
}
示例14: create
import org.deidentifier.arx.framework.lattice.SolutionSpace; //导入依赖的package包/类
/**
* Creates a new instance of the FLASH algorithm.
*
* @param solutionSpace
* @param checker
* @param strategy
* @return
*/
public static AbstractAlgorithm create(final SolutionSpace solutionSpace,
final NodeChecker checker,
final FLASHStrategy strategy) {
// Init
ARXConfigurationInternal config = checker.getConfiguration();
Monotonicity monotonicityOfUtility = config.getMonotonicityOfUtility();
Monotonicity monotonicityOfPrivacy = config.getMonotonicityOfPrivacy();
// ******************************
// CASE 1
// ******************************
if ((monotonicityOfPrivacy == Monotonicity.FULL) && (monotonicityOfUtility == Monotonicity.FULL)) {
return createFullFull(solutionSpace, checker, strategy);
}
// ******************************
// CASE 2
// ******************************
if ((monotonicityOfPrivacy == Monotonicity.FULL) && (monotonicityOfUtility == Monotonicity.NONE)) {
return createFullNone(solutionSpace, checker, strategy);
}
// ******************************
// CASE 3
// ******************************
if ((monotonicityOfPrivacy == Monotonicity.PARTIAL) && (monotonicityOfUtility == Monotonicity.FULL)) {
return createPartialFull(solutionSpace, checker, strategy);
}
// ******************************
// CASE 4
// ******************************
if ((monotonicityOfPrivacy == Monotonicity.PARTIAL) && (monotonicityOfUtility == Monotonicity.NONE)) {
return createPartialNone(solutionSpace, checker, strategy);
}
// ******************************
// CASE 5
// ******************************
if ((monotonicityOfPrivacy == Monotonicity.NONE) && (monotonicityOfUtility == Monotonicity.FULL)) {
return createNoneFull(solutionSpace, checker, strategy);
}
// ******************************
// CASE 6
// ******************************
if ((monotonicityOfPrivacy == Monotonicity.NONE) && (monotonicityOfUtility == Monotonicity.NONE)) {
return createNoneNone(solutionSpace, checker, strategy);
}
throw new IllegalStateException("Oops");
}
示例15: anonymize
import org.deidentifier.arx.framework.lattice.SolutionSpace; //导入依赖的package包/类
/**
* Reset a previous lattice and run the algorithm.
*
* @param manager
* @param definition
* @param config
* @return
* @throws IOException
*/
protected Result anonymize(final DataManager manager,
final DataDefinition definition,
final ARXConfiguration config) throws IOException {
// Initialize
config.initialize(manager);
// Check
checkAfterEncoding(config, manager);
// Build or clean the lattice
SolutionSpace solutionSpace = new SolutionSpace(manager.getHierarchiesMinLevels(), manager.getHierarchiesMaxLevels());
// Initialize the metric
config.getQualityModel().initialize(manager, definition, manager.getDataGeneralized(), manager.getHierarchies(), config);
// Build a node checker
final NodeChecker checker = new NodeChecker(manager,
config.getQualityModel(),
config.getInternalConfiguration(),
historySize,
snapshotSizeDataset,
snapshotSizeSnapshot,
solutionSpace);
// Create an algorithm instance
AbstractAlgorithm algorithm = getAlgorithm(config,
manager,
solutionSpace,
checker);
algorithm.setListener(listener);
// Execute
final long time = System.currentTimeMillis();
algorithm.traverse();
// Free resources
checker.reset();
// Return the result
return new Result(checker, solutionSpace, manager, algorithm, time);
}