aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/store-dse/src/main/java/tools/refinery/store/dse/transition/statespace/internal/FastEquivalenceClassStore.java
blob: 75e117c0a8ef8460c270879af5a5e7042abfbff9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/>
 *
 * SPDX-License-Identifier: EPL-2.0
 */
package tools.refinery.store.dse.transition.statespace.internal;

import org.eclipse.collections.impl.set.mutable.primitive.IntHashSet;
import tools.refinery.store.dse.transition.VersionWithObjectiveValue;
import tools.refinery.store.dse.transition.statespace.EquivalenceClassStore;
import tools.refinery.store.statecoding.StateCoderResult;
import tools.refinery.store.statecoding.StateCoderStoreAdapter;

public abstract class FastEquivalenceClassStore extends AbstractEquivalenceClassStore implements EquivalenceClassStore {

	final IntHashSet codes;

	public FastEquivalenceClassStore(StateCoderStoreAdapter stateCoderStoreAdapter) {
		super(stateCoderStoreAdapter);
		this.codes = new IntHashSet();
	}

	@Override
	protected boolean tryToAdd(StateCoderResult stateCoderResult, VersionWithObjectiveValue newVersion, int[] emptyActivations, boolean accept) {
		return this.codes.add(stateCoderResult.modelCode());
	}

	@Override
	public void resolveOneSymmetry() {
		throw new IllegalArgumentException("This equivalence storage is not prepared to resolve symmetries!");
	}
}