Provide an API to execute precomputation and solving separately

Open
#392 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Active
Tech stack
python

Research direction

Start with the proposed create_precomputer, precompute, load_solver, and solve entry points, and compare them with the current ch.add_to_control behavior referenced in the issue. The issue is still a draft, so done requires settling the API and its handling of precomputed data, contexts, presets, and solving before implementation can be scoped.

Written by the indexing model from the issue text.

Description

Draft of the API
ch The constraint-handler library
CHPC The Precomputer
ModelData This are just CH input facts. It should include information which variables can later be set by presets and which variables have a dynamic domain.
Context This are tables and provided python functions like getPLMTable.
Mode The solve mode: solution/brave/cautious/optimization
PCD This is the precompiled/grounded data that can be serialized/stored.
CHS The Solver
Presets The preset data used to set externals or add new facts.
Criteria The optimization criteria
SolveHandle A clingo SolveHandle
ch.create_precomputer() -> CHPC   # Create a the Precomputer
CHPC.add(ModelData)               # Load model data into the Precomputer
CHPC.add_context(Context)         # similar to current ch.add_to_control(...)
CHPC.set_mode(Mode)               # Set solve mode
CHPC.precompute() -> PCD          # Perform precomputation (grounding) and return a PCD

ch.load_solver(PCD) -> CHS        # Create a Solver and load it with the PCD data 
CHS.preset(Presets)               # Load preset data
CHS.add_context(Context)          # Load dynamic context (not sure if necessary)
CHS.solve() -> SolveHandle        # start solving
                                  #  - add new facts new preset values and optimization criteria
                                  #  - do additional incremental grounding
                                  #  - set presets - externals
                                  #  - solve
What do we precompute?
  • domain facts
  • and fact representation of reified rules
Dominant language
Python
Stars
4
Forks
0
Avg merge
2d 9h
Merged PRs (30d)
19

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from potassco/constraint-handler

All issues in potassco/constraint-handler

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.