Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Grounding strategies and phase saving and restarts #206

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
e98a1dc
Merge branch 'domind_heuristics' into domind_plus_grounder_heu
rtaupe Jan 7, 2019
cb17d3c
First attempt at lax grounder heuristics
rtaupe Jan 7, 2019
9be1542
Rename RuleGroundingOrder -> RuleGroundingOrders
rtaupe Jan 7, 2019
932e587
Determine position where all vars are bound in RuleGroundingOrder
rtaupe Jan 8, 2019
46efc99
Record predicates defined only be facts in NaiveGrounder
rtaupe Jan 8, 2019
16ed906
Merge branch 'grounder_heuristics' into domind_plus_grounder_heu
rtaupe Jan 8, 2019
3149162
Introduce GrounderHeuristicsConfiguration
rtaupe Jan 8, 2019
fd18df0
Changes after review by Antonius Weinzierl
rtaupe Jan 8, 2019
f36485c
RuleGroundingOrder#toString
rtaupe Jan 8, 2019
74546b6
Satisfy CheckStyle
rtaupe Jan 8, 2019
8e0dc36
Fix bug in NaiveGrounder#storeAtomAndTerminateIfAtomDoesNotHold
rtaupe Jan 11, 2019
20572c1
Throw exception when lax grounder heuristics encounters a dead end
rtaupe Jan 11, 2019
492e50b
Do not ground rules that are not applicable
rtaupe Jan 11, 2019
d800cf0
Respect GrounderHeuristicConfiguration
rtaupe Jan 11, 2019
d197df8
Merge branch 'grounder_heuristics' into domind_plus_grounder_heu
rtaupe Jan 11, 2019
543a502
Merge branch 'grounder_heuristics' into domind_plus_grounder_heu
rtaupe Jan 13, 2019
f09eb9b
Strengthen NaiveGrounder.laxGrounderHeuristicCouldPotentiallyContinue
rtaupe Jan 13, 2019
ebd1e4f
RuleGroundingOrder.pushBack() (experimental)
rtaupe Jan 14, 2019
2b24a78
Do not abort grounding a rule in which a negative atom is true
rtaupe Jan 15, 2019
ce53f0a
Ignore deprecated test case
rtaupe Jan 15, 2019
d884d55
Correct escaping dead ends in rule grounding order
rtaupe Jan 18, 2019
684ea80
Log message if rule is grounded with unassigned positive body atoms
rtaupe Jan 22, 2019
3570d8d
Fix handling of (remaining)tolerance in NaiveGrounder#bindNextAtomInRule
rtaupe Jan 22, 2019
802877a
Fix: Terminate binding if FixedInterpretationLiteral cannot be satisfied
rtaupe Jan 22, 2019
7390d76
Merge branch 'fix_158' into domind_plus_grounder_heu
rtaupe Jan 24, 2019
b768f28
Make GrounderHeuristicConfiguration configurable from CLI
rtaupe Jan 24, 2019
2ab535e
Merge branch 'fix_159_justification' into domind_plus_grounder_heu_2
rtaupe Feb 1, 2019
02fdb19
Fix merge
rtaupe Feb 1, 2019
8d5f082
Merge branch 'master' into domind_plus_grounder_heu_2
rtaupe Feb 2, 2019
df714e5
workaround for bug causing non-satisfiable comparison literals
rtaupe Feb 11, 2019
84d86b3
Statistics on numbers of NoGoods by type and cardinality
rtaupe Mar 4, 2019
fede066
Avoid debug message if debug not enabled
rtaupe Mar 12, 2019
6c7a49b
Merge branch 'domind_heuristics' into domind_plus_grounder_heu
rtaupe Mar 13, 2019
3b85a8e
Reintroduce CLI parameters for grounding strategies
rtaupe Mar 13, 2019
bfd4d32
Merge branch 'fix_gradle_config_loc' into domind_plus_grounder_heu
rtaupe Mar 26, 2019
9968b47
Merge branch 'master' into domind_plus_grounder_heu
rtaupe Mar 26, 2019
9a7c175
Extend decision counters when heuristic is added to chain
rtaupe Mar 27, 2019
2edc783
remove obsolete TODO
rtaupe Apr 15, 2019
27ea98a
Merge branch 'master' into domind_plus_grounder_heu
rtaupe Apr 22, 2019
7c11a36
Minor simplifications in NaiveGrounder
rtaupe May 3, 2019
b93ae0f
Refactoring NaiveGrounder
rtaupe May 3, 2019
548760a
Refactoring NaiveGrounder
rtaupe May 3, 2019
b26aa81
Refactoring NaiveGrounder
rtaupe May 3, 2019
c0ef033
Refactoring NaiveGrounder
rtaupe May 3, 2019
1468745
Fix control flow in NaiveGrounder.bindNextAtomInRule
rtaupe May 3, 2019
f04413b
Refactoring NaiveGrounder
rtaupe May 3, 2019
37771bc
Remove redundant check for facts in NaiveGrounder.bindNext...
rtaupe May 6, 2019
92560da
Additional NaiveGrounderTest
rtaupe May 6, 2019
d3f3797
Simplify Substitution.equals(...)
rtaupe May 7, 2019
e89eb27
Avoid to ground constraints that have already been grounded
rtaupe May 7, 2019
71b557b
Revert "Avoid to ground constraints that have already been grounded"
rtaupe May 7, 2019
21f4782
Fix bug in accumulator grounder
rtaupe May 21, 2019
ba2dd4c
Merge branch 'master' into grounding_strategies
rtaupe May 22, 2019
8b69a7a
Add phase saving.
AntoniusW Sep 29, 2019
ddda826
Merge branch 'master' into grounding_strategies
rtaupe Oct 3, 2019
eeaa54d
Fix merge ddda826e967ce6b38acc56bd41909a2c30cfe99a
rtaupe Oct 3, 2019
2904653
Adding restarts (default disabled).
AntoniusW Oct 5, 2019
af19a14
Enhance performance logs to show quality of heuristic decisions.
AntoniusW Oct 7, 2019
5179a1a
Use constants instead of magic numbers.
rtaupe Oct 15, 2019
567cc8e
Make accumulator grounding strategy configurable via CLI
rtaupe Oct 15, 2019
e479e44
Test several grounder configurations.
rtaupe Oct 15, 2019
66c653c
Refactor NaiveGrounder#storeAtomAndTerminateIfAtomDoesNotHold
rtaupe Oct 15, 2019
cbe56aa
Fix JavaDoc
rtaupe Oct 15, 2019
41f52ac
Improve NaiveGrounderTest
rtaupe Oct 15, 2019
cf59e94
Reduce load of unit tests (on CI).
rtaupe Oct 16, 2019
8a4c93c
Increase PigeonHoleTest time limits.
rtaupe Oct 16, 2019
313b10e
Refactor NaiveGrounder#bindNextAtomInRule.
rtaupe Oct 16, 2019
272e5ec
Undo change in ArithmeticTerm#evaluateGroundTerm
rtaupe Oct 16, 2019
1591dfb
Give Travis more time to build.
rtaupe Oct 16, 2019
9fb8570
Remove unused method.
rtaupe Oct 17, 2019
fbdf7f6
Correct log level.
rtaupe Oct 17, 2019
7edca34
Add more unit tests to increase coverage.
rtaupe Oct 17, 2019
c3ac978
Add options for initial phase settings; add atom dependency to VSIDS
AntoniusW Oct 23, 2019
78b7e89
Add HeapOfRelatedChoiceAtoms recording only choice points, improve logs.
AntoniusW Nov 7, 2019
6143e82
Fix bug in AlphaHeadMustBeTrueHeuristic.
AntoniusW Nov 12, 2019
cd6ea23
Fix Luby restart sequence computation.
AntoniusW Nov 12, 2019
e83c866
Make AtomChoiceRelation a mandatory Grounder component.
AntoniusW Nov 12, 2019
184cbd7
Merge branch 'phase_saving_and_restarts' into grounding_strategies_an…
rtaupe Nov 12, 2019
a116cf2
fix merge 184cbd7f85d5944d0d8893c3580bf4dbb1e5a1cd
rtaupe Nov 13, 2019
14dfbf4
Merge branch 'phase_saving_and_restarts' into grounding_strategies_an…
rtaupe Nov 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ install:
- true

script:
- ./gradlew build --scan --stacktrace
- travis_wait ./gradlew build --scan --stacktrace

after_success:
- ./gradlew jacocoTestReport coveralls
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/at/ac/tuwien/kr/alpha/Alpha.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import at.ac.tuwien.kr.alpha.config.SystemConfig;
import at.ac.tuwien.kr.alpha.grounder.Grounder;
import at.ac.tuwien.kr.alpha.grounder.GrounderFactory;
import at.ac.tuwien.kr.alpha.grounder.heuristics.GrounderHeuristicsConfiguration;
import at.ac.tuwien.kr.alpha.grounder.parser.ProgramParser;
import at.ac.tuwien.kr.alpha.solver.Solver;
import at.ac.tuwien.kr.alpha.solver.SolverFactory;
Expand Down Expand Up @@ -103,8 +104,12 @@ public Solver prepareSolverFor(Program program, java.util.function.Predicate<Pre
String grounderName = this.config.getGrounderName();
boolean doDebugChecks = this.config.isDebugInternalChecks();

GrounderHeuristicsConfiguration grounderHeuristicConfiguration = GrounderHeuristicsConfiguration
.getInstance(this.config.getGrounderToleranceConstraints(), this.config.getGrounderToleranceRules());
grounderHeuristicConfiguration.setDisableInstanceRemoval(this.config.isDisableInstanceRemoval());

AtomStore atomStore = new AtomStoreImpl();
Grounder grounder = GrounderFactory.getInstance(grounderName, program, atomStore, filter, doDebugChecks);
Grounder grounder = GrounderFactory.getInstance(grounderName, program, atomStore, filter, grounderHeuristicConfiguration, doDebugChecks);

return SolverFactory.getInstance(this.config, atomStore, grounder);
}
Expand All @@ -117,7 +122,7 @@ public Stream<AnswerSet> solve(Program program, java.util.function.Predicate<Pre
Stream<AnswerSet> retVal = this.prepareSolverFor(program, filter).stream();
return this.config.isSortAnswerSets() ? retVal.sorted() : retVal;
}

public Stream<AnswerSet> solve(Program program) {
return this.solve(program, InputConfig.DEFAULT_FILTER);
}
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/at/ac/tuwien/kr/alpha/common/Assignment.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
import java.util.Iterator;
import java.util.Set;

import static at.ac.tuwien.kr.alpha.common.Literals.*;
import static at.ac.tuwien.kr.alpha.common.Literals.atomOf;
import static at.ac.tuwien.kr.alpha.common.Literals.isNegated;

public interface Assignment {
Entry get(int atom);
Expand Down Expand Up @@ -71,6 +72,13 @@ default ThriceTruth getTruth(int atom) {
*/
Antecedent getImpliedBy(int atom);

/**
* Returns the last truth value (i.e., phase) assigned to the atom.
* @param atom the atom
* @return the last truth value.
*/
boolean getLastValue(int atom);

/**
* Determines if the given {@code noGood} is undefined in the current assignment.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017-2018, the Alpha Team.
* Copyright (c) 2017-2019, the Alpha Team.
* All rights reserved.
*
* Additional changes made by Siemens.
Expand Down Expand Up @@ -171,6 +171,12 @@ public List<Substitution> getSubstitutions(Substitution partialSubstitution) {
extendedSubstitution.put(variable, resultTerm);
return Collections.singletonList(extendedSubstitution);
}

public boolean isLeftOrRightAssigning() {
final Term left = getTerms().get(0);
final Term right = getTerms().get(1);
return isNormalizedEquality && (assignable(left) && right.isGround() || assignable(right) && left.isGround());
}

private Term evaluateTerm(Term term) {
// Evaluate arithmetics.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,24 @@ public class CommandLineParser {
.desc("disable the deletion of (learned, little active) nogoods (default: "
+ SystemConfig.DEFAULT_DISABLE_NOGOOD_DELETION + ")")
.build();
private static final Option OPT_GROUNDER_TOLERANCE_CONSTRAINTS = Option.builder("gtc").longOpt("grounderToleranceConstraints")
.desc("grounder tolerance for constraints (default: " + SystemConfig.DEFAULT_GROUNDER_TOLERANCE_CONSTRAINTS + ")")
.hasArg().argName("tolerance")
.build();
private static final Option OPT_GROUNDER_TOLERANCE_RULES = Option.builder("gtr").longOpt("grounderToleranceRules")
.desc("grounder tolerance for rules (default: " + SystemConfig.DEFAULT_GROUNDER_TOLERANCE_RULES + ")")
.hasArg().argName("tolerance")
.build();
private static final Option OPT_NO_INSTANCE_REMOVAL = Option.builder("dir").longOpt("disableInstanceRemoval")
.desc("activates the accumulator grounding strategy by disabling removal of instances from grounder memory in certain cases (default: " + SystemConfig.DEFAULT_DISABLE_INSTANCE_REMOVAL + ")")
.build();
private static final Option OPT_ENABLE_RESTARTS = Option.builder("rs").longOpt("enableRestarts")
.desc("enable the usage of (dynamic and static) restarts (default: "
+ SystemConfig.DEFAULT_ENABLE_RESTARTS + ")")
.build();
private static final Option OPT_INITIAL_PHASE = Option.builder("ph").longOpt("initialPhase").hasArg(true).argName("initializer")
.desc("set the initial phase [ alltrue | allfalse | random ] (default: " + SystemConfig.DEFAULT_PHASE_INITIALIZER + ")")
.build();

private static final Options CLI_OPTS = new Options();

Expand Down Expand Up @@ -137,6 +155,11 @@ public class CommandLineParser {
CommandLineParser.CLI_OPTS.addOption(CommandLineParser.OPT_NO_JUSTIFICATION);
CommandLineParser.CLI_OPTS.addOption(CommandLineParser.OPT_NORMALIZATION_GRID);
CommandLineParser.CLI_OPTS.addOption(CommandLineParser.OPT_NO_NOGOOD_DELETION);
CommandLineParser.CLI_OPTS.addOption(CommandLineParser.OPT_GROUNDER_TOLERANCE_CONSTRAINTS);
CommandLineParser.CLI_OPTS.addOption(CommandLineParser.OPT_GROUNDER_TOLERANCE_RULES);
CommandLineParser.CLI_OPTS.addOption(CommandLineParser.OPT_NO_INSTANCE_REMOVAL);
CommandLineParser.CLI_OPTS.addOption(CommandLineParser.OPT_ENABLE_RESTARTS);
CommandLineParser.CLI_OPTS.addOption(CommandLineParser.OPT_INITIAL_PHASE);
}

/*
Expand Down Expand Up @@ -180,6 +203,11 @@ public CommandLineParser(String cmdLineSyntax, Consumer<String> abortAction) {
this.globalOptionHandlers.put(CommandLineParser.OPT_NO_JUSTIFICATION.getOpt(), this::handleNoJustification);
this.globalOptionHandlers.put(CommandLineParser.OPT_NORMALIZATION_GRID.getOpt(), this::handleNormalizationGrid);
this.globalOptionHandlers.put(CommandLineParser.OPT_NO_NOGOOD_DELETION.getOpt(), this::handleNoNoGoodDeletion);
this.globalOptionHandlers.put(CommandLineParser.OPT_GROUNDER_TOLERANCE_CONSTRAINTS.getOpt(), this::handleGrounderToleranceConstraints);
this.globalOptionHandlers.put(CommandLineParser.OPT_GROUNDER_TOLERANCE_RULES.getOpt(), this::handleGrounderToleranceRules);
this.globalOptionHandlers.put(CommandLineParser.OPT_NO_INSTANCE_REMOVAL.getOpt(), this::handleNoInstanceRemoval);
this.globalOptionHandlers.put(CommandLineParser.OPT_ENABLE_RESTARTS.getOpt(), this::handleEnableRestarts);
this.globalOptionHandlers.put(CommandLineParser.OPT_INITIAL_PHASE.getOpt(), this::handleInitialPhase);

this.inputOptionHandlers.put(CommandLineParser.OPT_NUM_ANSWER_SETS.getOpt(), this::handleNumAnswerSets);
this.inputOptionHandlers.put(CommandLineParser.OPT_INPUT.getOpt(), this::handleInput);
Expand Down Expand Up @@ -325,7 +353,7 @@ private void handleMomsStrategy(Option opt, SystemConfig cfg) throws ParseExcept
throw new ParseException("Unknown mom's strategy: " + momsStrategyName + ". Please try one of the following: " + BinaryNoGoodPropagationEstimation.Strategy.listAllowedValues());
}
}

private void handleReplayChoices(Option opt, SystemConfig cfg) throws ParseException {
String replayChoices = opt.getValue(SystemConfig.DEFAULT_REPLAY_CHOICES.toString());
try {
Expand Down Expand Up @@ -359,4 +387,25 @@ private void handleNoNoGoodDeletion(Option opt, SystemConfig cfg) {
cfg.setDisableNoGoodDeletion(true);
}

private void handleGrounderToleranceConstraints(Option opt, SystemConfig cfg) {
String grounderToleranceConstraints = opt.getValue(SystemConfig.DEFAULT_GROUNDER_TOLERANCE_CONSTRAINTS);
cfg.setGrounderToleranceConstraints(grounderToleranceConstraints);
}

private void handleGrounderToleranceRules(Option opt, SystemConfig cfg) {
String grounderToleranceRules = opt.getValue(SystemConfig.DEFAULT_GROUNDER_TOLERANCE_RULES);
cfg.setGrounderToleranceRules(grounderToleranceRules);
}

private void handleNoInstanceRemoval(Option opt, SystemConfig cfg) {
cfg.setDisableInstanceRemoval(true);
}

private void handleEnableRestarts(Option opt, SystemConfig cfg) {
cfg.setRestartsEnabled(true);
}

private void handleInitialPhase(Option opt, SystemConfig cfg) {
cfg.setPhaseInitializer(opt.getValue(SystemConfig.DEFAULT_PHASE_INITIALIZER));
}
}
50 changes: 50 additions & 0 deletions src/main/java/at/ac/tuwien/kr/alpha/config/SystemConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/
package at.ac.tuwien.kr.alpha.config;

import at.ac.tuwien.kr.alpha.grounder.heuristics.GrounderHeuristicsConfiguration;
import at.ac.tuwien.kr.alpha.solver.BinaryNoGoodPropagationEstimation;
import at.ac.tuwien.kr.alpha.solver.heuristics.BranchingHeuristicFactory.Heuristic;

Expand Down Expand Up @@ -56,6 +57,11 @@ public class SystemConfig {
public static final boolean DEFAULT_SORT_ANSWER_SETS = false;
public static final List<Integer> DEFAULT_REPLAY_CHOICES = Collections.emptyList();
public static final boolean DEFAULT_DISABLE_NOGOOD_DELETION = false;
public static final String DEFAULT_GROUNDER_TOLERANCE_CONSTRAINTS = GrounderHeuristicsConfiguration.STRICT_STRING;
public static final String DEFAULT_GROUNDER_TOLERANCE_RULES = GrounderHeuristicsConfiguration.STRICT_STRING;
public static final boolean DEFAULT_DISABLE_INSTANCE_REMOVAL = false;
public static final boolean DEFAULT_ENABLE_RESTARTS = false;
public static final String DEFAULT_PHASE_INITIALIZER = "random";

private String grounderName = SystemConfig.DEFAULT_GROUNDER_NAME;
private String solverName = SystemConfig.DEFAULT_SOLVER_NAME;
Expand All @@ -72,6 +78,11 @@ public class SystemConfig {
private boolean sortAnswerSets = SystemConfig.DEFAULT_SORT_ANSWER_SETS;
private List<Integer> replayChoices = SystemConfig.DEFAULT_REPLAY_CHOICES;
private boolean disableNoGoodDeletion = SystemConfig.DEFAULT_DISABLE_NOGOOD_DELETION;
private String grounderToleranceConstraints = DEFAULT_GROUNDER_TOLERANCE_CONSTRAINTS;
private String grounderToleranceRules = DEFAULT_GROUNDER_TOLERANCE_RULES;
private boolean disableInstanceRemoval = DEFAULT_DISABLE_INSTANCE_REMOVAL;
private boolean areRestartsEnabled = SystemConfig.DEFAULT_ENABLE_RESTARTS;
private String phaseInitializer = SystemConfig.DEFAULT_PHASE_INITIALIZER;

public String getGrounderName() {
return this.grounderName;
Expand Down Expand Up @@ -205,4 +216,43 @@ public void setDisableNoGoodDeletion(boolean disableNoGoodDeletion) {
this.disableNoGoodDeletion = disableNoGoodDeletion;
}

public String getGrounderToleranceConstraints() {
return grounderToleranceConstraints;
}

public void setGrounderToleranceConstraints(String grounderToleranceConstraints) {
this.grounderToleranceConstraints = grounderToleranceConstraints;
}

public String getGrounderToleranceRules() {
return grounderToleranceRules;
}

public void setGrounderToleranceRules(String grounderToleranceRules) {
this.grounderToleranceRules = grounderToleranceRules;
}

public boolean isDisableInstanceRemoval() {
return disableInstanceRemoval;
}

public void setDisableInstanceRemoval(boolean disableInstanceRemoval) {
this.disableInstanceRemoval = disableInstanceRemoval;
}
public boolean areRestartsEnabled() {
return areRestartsEnabled;
}

public void setRestartsEnabled(boolean areRestartsEnabled) {
this.areRestartsEnabled = areRestartsEnabled;
}

public String getPhaseInitializerName() {
return phaseInitializer;
}

public void setPhaseInitializer(String phaseInitializer) {
this.phaseInitializer = phaseInitializer;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public String toString() {
}
sb.append(" disablers: ");
for (Map.Entry<Integer, Integer> disablers : newChoiceAtoms.getRight().entrySet()) {
sb.append(disablers.getKey()).append("/").append(disablers.getValue());
sb.append(disablers.getKey()).append("/").append(disablers.getValue()).append(", ");
}
return sb.append("]").toString();
}
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/at/ac/tuwien/kr/alpha/grounder/Grounder.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import at.ac.tuwien.kr.alpha.common.Assignment;
import at.ac.tuwien.kr.alpha.common.NoGood;
import at.ac.tuwien.kr.alpha.grounder.atoms.RuleAtom;
import at.ac.tuwien.kr.alpha.grounder.structure.AtomChoiceRelation;
import org.apache.commons.lang3.tuple.Pair;

import java.util.Iterator;
Expand Down Expand Up @@ -79,4 +80,11 @@ public interface Grounder {
* @return
*/
int register(NoGood noGood);


/**
* Returns the relation between atoms and choices in form of an {@link AtomChoiceRelation} object.
* @return the {@link AtomChoiceRelation} of the grounded program parts.
*/
AtomChoiceRelation getAtomChoiceRelation();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016-2018, the Alpha Team.
* Copyright (c) 2016-2019, the Alpha Team.
* All rights reserved.
*
* Additional changes made by Siemens.
Expand Down Expand Up @@ -32,21 +32,22 @@
import at.ac.tuwien.kr.alpha.common.Program;
import at.ac.tuwien.kr.alpha.config.InputConfig;
import at.ac.tuwien.kr.alpha.grounder.bridges.Bridge;
import at.ac.tuwien.kr.alpha.grounder.heuristics.GrounderHeuristicsConfiguration;

public final class GrounderFactory {
public static Grounder getInstance(String name, Program program, AtomStore atomStore, java.util.function.Predicate<Predicate> filter, boolean useCountingGridNormalization, boolean debugInternalChecks, Bridge... bridges) {
public static Grounder getInstance(String name, Program program, AtomStore atomStore, java.util.function.Predicate<Predicate> filter, GrounderHeuristicsConfiguration heuristicsConfiguration, boolean useCountingGridNormalization, boolean debugInternalChecks, Bridge... bridges) {
switch (name.toLowerCase()) {
case "naive":
return new NaiveGrounder(program, atomStore, filter, useCountingGridNormalization, debugInternalChecks, bridges);
return new NaiveGrounder(program, atomStore, filter, heuristicsConfiguration, useCountingGridNormalization, debugInternalChecks, bridges);
}
throw new IllegalArgumentException("Unknown grounder requested.");
}

public static Grounder getInstance(String name, Program program, AtomStore atomStore, java.util.function.Predicate<Predicate> filter, boolean debugInternalChecks) {
return getInstance(name, program, atomStore, filter, false, debugInternalChecks);
}
public static Grounder getInstance(String name, Program program, AtomStore atomStore, java.util.function.Predicate<Predicate> filter, GrounderHeuristicsConfiguration heuristicsConfiguration, boolean debugInternalChecks) {
return getInstance(name, program, atomStore, filter, heuristicsConfiguration, false, debugInternalChecks);
}

public static Grounder getInstance(String name, Program program, AtomStore atomStore, boolean debugInternalChecks) {
return getInstance(name, program, atomStore, InputConfig.DEFAULT_FILTER, false, debugInternalChecks);
return getInstance(name, program, atomStore, InputConfig.DEFAULT_FILTER, new GrounderHeuristicsConfiguration(), false, debugInternalChecks);
}
}
Loading