Comments (4)
Hi,
As Roland pointed out, continuously adding new program increments for new time steps won't scale. We noticed this problem too and to address it, we introduced in this paper a technique to implement a time-based sliding window. The primary idea is as follows:
- The discrete time steps are arranged in a cycle (modulo-ring) which loops after a fixed number of steps.
- The problem is encoded with rules containing only regular facts and a fixed horizon = the modulo-ring size
- At each time point t, arriving streamed data represented as external facts are continuously assigned (via equivalence) to corresponding regular facts for timestamp t modulo window-length.
With that, only the assignment rules have to be continuously grounded and added as new modules but not the whole problem encoding. Naturally, this won't scale ad infinitum either but should provide a notable improvement to your original approach.
from clingo.
Hi, I do not know much about stream reasoning but can tell you what the limitations of the clingo system are.
- Continuously adding new facts to a program and then ground and solve will certainly cause slow downs/failure at some point because the system is accumulating more and more memory.
- What can be done is to write an encoding that takes a fixed set of inputs (*). The inputs can then be assigned before solving. This approach will not consume unbounded amounts of memory but is harder to implement. Also if the domains of your inputs are too large the approach might be infeasible.
- If you can solve you problem in reasonable time when solving each problem from scratch, why bother with anything more complicated (except as a research topic).
(*) It is also possible to extend the inputs dynamically but this is getting complicated.
from clingo.
Pobermei and rkaminsk, thanks a lot for your answer.
I read the paper and understood the sliding window approach. Given streams of sensor data (as external predicates), the clingo solver (plus a python scripts handling the incremental behavior) in my application is used as a stream reasoner in order to recognize activities in a smart home. It means that for some activities the solver needs to keep track of some events (as the precondition of other upcoming events) for a long period of time e.g., 4 hours equivalent to timestamp t = 4*3600 (the resolution of timestamp is in second). I think for such situations, the sliding window solution doesn't seem effective. Right?
My second question: Is it possible to remove some obsolete predicates from the grounding set of the solver during the solving process?
Best
from clingo.
It means that for some activities the solver needs to keep track of some events (as the precondition of other upcoming events) for a long period of time e.g., 4 hours equivalent to timestamp t = 4*3600 (the resolution of timestamp is in second). I think for such situations, the sliding window solution doesn't seem effective. Right?
Representing so many time points with atoms will certainly not scale. You might want to have a look into clingcon, which can handle variables over (finite) numbers. But note that it does not support multi-shot solving yet.
My second question: Is it possible to remove some obsolete predicates from the grounding set of the solver during the solving process?
To remove something from a logic program, externals can be used. Releasing a.
in
#external a.
b :- a.
will remove a
and b
from the program. By calling Control.cleanup()
, both atoms will also be removed from clingo's domains and not used for grounding in later steps. Actually, anything the solver determined to be false is removed. But note that this does not free all memory associated with the atoms but will keep the symbolic representation in memory. I thought about also collecting such kind of memory but this is difficult to implement and won't happen anytime soon. The solving backend will also keep a small amount of memory because even though all constraints over a variable will be removed the variable as such is not.
from clingo.
Related Issues (20)
- C++ API throws exception from destructor that cannot be caught HOT 3
- Code that has no effect HOT 1
- The Python extension fails to compile: 'math/wide_integer/uintwide_t.h' file not found HOT 6
- Clingo programs with python scripts hang with Python3.12 HOT 4
- Segv with add_atom and ground() multiple times, with Script, on M1 HOT 6
- Building a library that depends on clingo with `DCLASP_BUILD_WITH_THREADS=Off` HOT 10
- Solving iteratively (as in `examples/cc/solve_iteratively.cc` gives different results than solving using the CLI. HOT 6
- How to get atom numbers for symbols associated with facts in the Python Observer? HOT 5
- Computing minimal answer sets w.r.t. a subset of atoms HOT 11
- wrong grounding involving recursive conditional literals
- Is it possible to maintain order of literals? HOT 2
- Unexpected grounding blow-up in aggregates HOT 2
- Gringo considers unnecessary instantiations of rule heads. HOT 12
- graph.lp:2:1-5: error: syntax error, unexpected <IDENTIFIER> HOT 3
- how to write the "different than" symbol in a .lp file ? HOT 3
- understanding how to format an lp input graph file for clingo HOT 2
- How to check if #external predicates are defined properly? HOT 6
- Multiple conditions in the head of a condition literal HOT 11
- Absolute submodule paths would be welcome. HOT 6
- Cannot instantiate Comment AST using CommentType enum as argument.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clingo.