Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
sat4j
sat4j
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 51
    • Issues 51
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 2
    • Merge Requests 2
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • SAT4J
  • sat4jsat4j
  • Issues
  • #62

Closed
Open
Opened Mar 19, 2012 by Pablo Abad@pabad

Expose solver stats and info programatically

Currently, the Solver class exposes several methods that can be used to get insight into different solver metrics: void printStat(PrintWriter out, String prefix) void printStat(PrintStream out, String prefix) int nVars() void printLearntClausesInfos(PrintWriter out, String prefix) void printInfos(PrintWriter out, String prefix) Map<String, Number> getStat() long getTimeoutMs() int realNumberOfVariables() int nConstraints()

While some of these methods may be used while building constraints, most of them return information about the problem being represented and status of the solving process. Furthermore, some of this information can't be accessed programatically, but printed to a Stream or Writer.

The proposal would be to create an interface that provides methods for retrieving all these information and add a method in Solver that returns an implementation of this interface. Ideally, all the printXXX methods could be moved from Solver into another class that would receive this interface.

Here is a possible draft of this interface: public interface SolverStats { int numberOfVars(); int realNumberOfVars(); int nContraints();

void observeStats(StatObserver observer); void observeConstraintTypes(ConstraintTypeObserver observer); void observeLearnedConstraintTypes(ConstraintTypeObserver observer); }

public interface StatObserver { public void observe(String stat, Number value); // or a method per value type }

public interface ConstraintTypeObserver { public void observe(String type, int count); }

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: sat4j/sat4j#62