Skip to content

Commit 9d46ffc

Browse files
OpenSMT: Use enums for the options that select an interpolation algorithm
1 parent 5a2591a commit 9d46ffc

File tree

5 files changed

+98
-6
lines changed

5 files changed

+98
-6
lines changed

src/org/sosy_lab/java_smt/solvers/opensmt/OpenSmtAbstractProver.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,12 @@ static SMTConfig getConfigInstance(
7979
config.setOption(":print-cores-full", optUnsatCore);
8080
config.setOption(":produce-interpolants", new SMTOption(interpolation));
8181
if (interpolation) {
82-
config.setOption(":interpolation-bool-algorithm", new SMTOption(pSolverOptions.algBool));
83-
config.setOption(":interpolation-euf-algorithm", new SMTOption(pSolverOptions.algUf));
84-
config.setOption(":interpolation-lra-algorithm", new SMTOption(pSolverOptions.algLra));
82+
config.setOption(
83+
":interpolation-bool-algorithm", new SMTOption(pSolverOptions.algBool.getValue()));
84+
config.setOption(
85+
":interpolation-euf-algorithm", new SMTOption(pSolverOptions.algUf.getValue()));
86+
config.setOption(
87+
":interpolation-lra-algorithm", new SMTOption(pSolverOptions.algLra.getValue()));
8588
config.setOption(
8689
":simplify-interpolants", new SMTOption(pSolverOptions.simplifyInterpolants));
8790
}

src/org/sosy_lab/java_smt/solvers/opensmt/OpenSmtSolverContext.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
import org.sosy_lab.java_smt.basicimpl.AbstractNumeralFormulaManager.NonLinearArithmetic;
2727
import org.sosy_lab.java_smt.basicimpl.AbstractSolverContext;
2828
import org.sosy_lab.java_smt.solvers.opensmt.api.LogicFactory;
29+
import org.sosy_lab.java_smt.solvers.opensmt.interpolationAlgorithms.Core;
30+
import org.sosy_lab.java_smt.solvers.opensmt.interpolationAlgorithms.LA;
31+
import org.sosy_lab.java_smt.solvers.opensmt.interpolationAlgorithms.UF;
2932

3033
public final class OpenSmtSolverContext extends AbstractSolverContext {
3134
private final OpenSmtFormulaCreator creator;
@@ -46,13 +49,13 @@ static class OpenSMTOptions {
4649
Logics logic = Logics.QF_AUFLIRA;
4750

4851
@Option(secure = true, description = "Algorithm for boolean interpolation")
49-
int algBool = 0;
52+
Core algBool = Core.MCMILLAN;
5053

5154
@Option(secure = true, description = "Algorithm for UF interpolation")
52-
int algUf = 0;
55+
UF algUf = UF.STRONG;
5356

5457
@Option(secure = true, description = "Algorithm for LRA interpolation")
55-
int algLra = 0;
58+
LA algLra = LA.STRONG;
5659

5760
@IntegerOption(min = 0, max = 4)
5861
@Option(
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* This file is part of JavaSMT,
3+
* an API wrapper for a collection of SMT solvers:
4+
* https://github.com/sosy-lab/java-smt
5+
*
6+
* SPDX-FileCopyrightText: 2024 Dirk Beyer <https://www.sosy-lab.org>
7+
*
8+
* SPDX-License-Identifier: Apache-2.0
9+
*/
10+
11+
package org.sosy_lab.java_smt.solvers.opensmt.interpolationAlgorithms;
12+
13+
public enum Core {
14+
MCMILLAN(0),
15+
PUDLAK(1),
16+
MCMILLAN_PRIME(2),
17+
PROOF_SENSITIVE(3),
18+
PROOF_SENSITIVE_WEAK(4),
19+
PROOF_SENSITIVE_STRONG(5);
20+
21+
private final int value;
22+
23+
Core(int i) {
24+
value = i;
25+
}
26+
27+
public int getValue() {
28+
return value;
29+
}
30+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* This file is part of JavaSMT,
3+
* an API wrapper for a collection of SMT solvers:
4+
* https://github.com/sosy-lab/java-smt
5+
*
6+
* SPDX-FileCopyrightText: 2024 Dirk Beyer <https://www.sosy-lab.org>
7+
*
8+
* SPDX-License-Identifier: Apache-2.0
9+
*/
10+
11+
package org.sosy_lab.java_smt.solvers.opensmt.interpolationAlgorithms;
12+
13+
public enum LA {
14+
STRONG(0),
15+
WEAK(2),
16+
FACTOR(3),
17+
DECOMPOSING_STRONG(4),
18+
DECOMPOSING_WEAK(5);
19+
20+
private final int value;
21+
22+
LA(int i) {
23+
value = i;
24+
}
25+
26+
public int getValue() {
27+
return value;
28+
}
29+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* This file is part of JavaSMT,
3+
* an API wrapper for a collection of SMT solvers:
4+
* https://github.com/sosy-lab/java-smt
5+
*
6+
* SPDX-FileCopyrightText: 2024 Dirk Beyer <https://www.sosy-lab.org>
7+
*
8+
* SPDX-License-Identifier: Apache-2.0
9+
*/
10+
11+
package org.sosy_lab.java_smt.solvers.opensmt.interpolationAlgorithms;
12+
13+
public enum UF {
14+
STRONG(0),
15+
WEAK(2),
16+
RANDOM(3);
17+
18+
private final int value;
19+
20+
UF(int i) {
21+
value = i;
22+
}
23+
24+
public int getValue() {
25+
return value;
26+
}
27+
}

0 commit comments

Comments
 (0)