Class LingelingSatSolver
- All Implemented Interfaces:
 AutoCloseable,SatSolver
This class handles the interaction with the native Lingeling solver via bindings, allowing for the creation of variables, addition of clauses, and checking satisfiability under assumptions.
Author: [Your Name]
- 
Constructor Summary
ConstructorsConstructorDescriptionInitializes a new instance of the Lingeling SAT solver. - 
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int[] clause) Adds a clause to the current formula in the Lingeling solver.voidclose()Releases resources associated with the Lingeling solver instance.intnewVar()Creates and returns a new variable in the Lingeling solver.booleansatisfiable(int[] assumptions) Checks if the current formula is satisfiable under the given assumptions.boolean[]witness(int[] literals, int[] assumptions) Returns a witness (truth assignment) for the given literals under the given assumptions.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.tweetyproject.sat.SatSolver
satisfiable, witness 
- 
Constructor Details
- 
LingelingSatSolver
public LingelingSatSolver()Initializes a new instance of the Lingeling SAT solver.This constructor initializes the Lingeling solver instance by calling the native `init` method through the `Binding` class. The handle to the Lingeling instance is stored in the `handle` field.
 
 - 
 - 
Method Details
- 
satisfiable
public boolean satisfiable(int[] assumptions) Checks if the current formula is satisfiable under the given assumptions.- Specified by:
 satisfiablein interfaceSatSolver- Parameters:
 assumptions- an array of literals that are assumed to be true- Returns:
 - `true` if the formula is satisfiable under the given assumptions, `false` otherwise
 
 - 
witness
public boolean[] witness(int[] literals, int[] assumptions) Returns a witness (truth assignment) for the given literals under the given assumptions.This method checks if the formula is satisfiable under the given assumptions, and if it is, returns a witness that represents the truth values of the specified literals.
- Specified by:
 witnessin interfaceSatSolver- Parameters:
 literals- an array of literals for which the truth assignment is requestedassumptions- an array of literals that are assumed to be true- Returns:
 - a boolean array representing the truth assignment of the given literals, or an empty array if unsatisfiable
 
 - 
add
 - 
newVar
public int newVar()Creates and returns a new variable in the Lingeling solver.This method increments the internal variable counter and returns the new variable index. This ensures that each variable created by the solver is unique.
 - 
close
public void close()Releases resources associated with the Lingeling solver instance.This method calls the native `release` method to free the resources held by the Lingeling instance associated with the `handle`.
- Specified by:
 closein interfaceAutoCloseable- Specified by:
 closein interfaceSatSolver
 
 -