Commit Graph

158 Commits

Author SHA1 Message Date
Fedor Isakov 0e02bab768 Replace tag() method in rule with uniqueTag() returning Object. This
allows for further memory optimization.
2019-05-17 17:10:52 +02:00
Fedor Isakov 658963903d Refactor controller: extract component for managing dispatching front,
drop Store, introduce ProcessingState and StateFrame.

ProcessingState class to represent current state, including the
dispatching front and all the logical observers.
StateFrame is a persistent class that reacts to activated constraint
and launches processing via Controller.
Breaking change: the frames correspond to an activated constraint occurrence,
and not to a triggered rule match as it has been the case before.
2019-05-16 12:35:52 +02:00
Fedor Isakov 11a9505ee9 Decompose controller's processing of constraints for better separation of concerns.
Restructure the code in controller to enable being called from an
external component.
2019-05-14 11:38:19 +02:00
Fedor Isakov bfc4b641bb Refactor constraint occurrence to depend on controller directly.
Drop creating of a frame stack from a store view.
2019-05-13 10:48:10 +02:00
Fedor Isakov eb5b38384f Rename Handler class in reactor API to RulesList. 2019-05-09 17:30:14 +02:00
Fedor Isakov d70bc2509d Rename for better readability: fringe -> front, matchRule -> ruleMatch. 2019-05-09 17:30:14 +02:00
Fedor Isakov cc2774d66d Refactorings in conreactor: better separation of concerns, cleaner interfaces.
Introduce Supervisor, extract evaluation-related stuff from Program, merge with EvaluationFeedbackHandler.
Move implementation of EvaluationFeedback to internal API, reduce number of public interfaces.
Cleaner interface for reporting feedback.
2019-05-05 13:52:26 +02:00
Fedor Isakov 09ca1f1236 Fix the Store implementation and the test harness to support incremental
program launch.
2019-05-03 22:03:17 +02:00
Fedor Isakov 13e8f4a205 Cleanup obsolete code in test helper.
Refactor mock program builder for ease of use.
2019-05-03 22:03:17 +02:00
Fedor Isakov 736e0c2470 Fix compilation. 2019-05-02 15:36:23 +02:00
Fedor Isakov 59b6fb09fe Rename some API interfaces to better reflect the intent. 2019-05-02 14:46:58 +02:00
Fedor Isakov e270655a7f Drop deprecated stuff in reactor. 2019-05-02 14:46:57 +02:00
Fedor Isakov 9db8bfcdca Minor code cleanup and documentation.
Switch Dispatcher to use tag as Rule's unique identifier.
De-couple RuleMatcherImpl from the Rule instance.

Rule instances are externally provided, and in case of incremental
Program update these will be all replaced with new ones.
Better to keep loose coupling between those and  the reactor implementation.
2019-05-01 15:36:59 +02:00
Fedor Isakov 7dcd683ba5 Enable EvaluationSession to have arbitrary parameters available at exec time.
Drop two obsolete interfaces.
2019-04-26 00:22:02 +02:00
Fedor Isakov a26dee8508 Merge API module into Core, drop API. Reactor lib to have only one jar. 2019-04-24 21:21:03 +02:00
Fedor Isakov a9a7f66a3a Refactorings and code cleanup in reactor lib. Documenting the code.
Breaking change: ReactorLifecycle to be used to initialize session
backend.

Remove deprecated stuff, deprecate some more.
Consolidate useless interfaces into bigger ones.
Extract interfaces for core classes, move implementation into "internal"
subpackage.
2019-04-24 21:21:03 +02:00
Fedor Isakov 3f930ba530 Introduce solver() method to PredicateSymbol.
Drop requirement to provide evaluation session with list of solvers; remove unnecessary configuration step.
Minor refactorings in tests.
2019-02-17 11:39:56 +01:00
Fedor Isakov c8d7e52b6f Introduce feedback handling API to facilitate processing of messages during program evaluation.
Minor refactorings in conreactor. Drop deprecated stuff. Default implementations for deprecated methods.
2019-02-15 17:15:09 +01:00
Fedor Isakov 5771d78b24 Logical with assigned value has higher rank. Notifications are to be dispatched accordingly. 2019-01-25 13:52:10 +01:00
Fedor Isakov e645ac8a70 Support for unassigned logical variables in unification. Fix cycle not detected. 2019-01-25 11:37:18 +01:00
Fedor Isakov b523467c5f Test a weird case of rule not triggered for a particular combination of constraints. 2019-01-24 16:01:55 +01:00
Fedor Isakov 181ccedd95 Establish the contract of OccurrenceMatcher to fail appropriately on unassigned logicals.
Fix processing of reactivated constraints in RuleMatcher, fix propagation history.
Minor code refactorings. Tests.
2019-01-24 12:03:04 +01:00
Fedor Isakov 087ccf4503 Fix matching single constraint on reactivation after a logical has been assigned. 2018-11-20 22:39:30 +01:00
Fedor Isakov 1b584d2825 Reactor API changes: EvaluationResult and FailureHandler.
Failures are no longer propagated as exceptions, instead evaluation
returns optional failure.
2018-11-04 12:54:32 +01:00
Fedor Isakov 388999833e Minor code optimization 2018-10-08 15:08:11 +02:00
Fedor Isakov bc69a2e291 Minor code reorganization and refactoring. Extract MatchingProbe interface. 2018-10-05 11:25:29 +02:00
Fedor Isakov 6627c06490 Fix matching of reactivated constraints. Fix REF-ed MetaLogical. Minor code cleanup. 2018-09-13 13:52:33 +02:00
Fedor Isakov a95b1c1311 Document and optimize implementation of PersistentTermTrie.
Introduce alternative "classic" implementation of TermTrie.
Switch to ClassicTermTrie.
2018-09-09 17:14:13 +02:00
Fedor Isakov 3bdcbc0aa8 Rename TermTrie -> PersistentTermTrie, remove dummy usages. 2018-09-08 13:16:43 +02:00
Fedor Isakov d26b7197fd Fix a bug in new matching algorithm that prevented correct matching of ref-ed metalogicals with terms. 2018-08-19 17:32:59 +02:00
Fedor Isakov faaa9f12d6 Cleanup reactor code, drop obsolete code:
old matching algorithm implementation,
store occurrences indexing,
propagation history.
2018-08-04 16:10:35 +02:00
Fedor Isakov d8c2310f98 Deprecate primary symbols in handler. All usages are safe to be dropped. 2018-08-04 16:10:35 +02:00
Fedor Isakov 74402a8a1c New rule matching algorithm 2018-08-03 11:48:23 +02:00
Fedor Isakov 11d87c7846 Minor performance tweaks. 2017-11-03 12:09:43 +01:00
Fedor Isakov c05dad493c Reimplement unification algorithm in Kotlin using jtrove lib. Add dependency on trove4. 2017-10-30 18:22:02 +01:00
Fedor Isakov bfd6010b7d Fix a bug in rule matching preventing good matches to be reported. Tests. 2017-10-06 12:09:57 +02:00
Fedor Isakov e72585aa65 Refactoring Matcher, MatchTrie. Trying to optimize calls to lookupAuxOccurrences() by reusing the previous searches. 2017-07-15 13:36:01 +02:00
Fedor Isakov 0dcf1ecd81 Rename API interfaces for better readability. 2017-06-05 13:37:56 +02:00
Fedor Isakov a23c0db226 Integrate unification into the Core module. Remove the unification lib and all its stuff. 2017-06-02 11:19:36 +02:00
Fedor Isakov c5c198cf8b Refactoring in the reactor API: move invocation/occurrence factory methods to evaluation session, enable access to logical context from an invocation. 2017-03-27 19:01:07 +02:00
Fedor Isakov cae150819f Introduce StoreView as a parameter to launching evaluation session. Minor code refactoring/extracting. 2017-01-10 20:19:59 +01:00
Fedor Isakov c68d9a0bd7 Refactoring the reactor API. Extract StoreView. Get rid of obsolete calls to SessionSolver, cleanup the interface. Introduce AbstractSolver. Move instantiation arguments to solver/program. Cleaning up the code. 2017-01-05 17:34:53 +01:00
Fedor Isakov ebfe680aae Refactoring the reactor API. Extract StoreView, get rid of obsolete calls to SessionSolver. Cleaning up the code. 2017-01-04 10:47:23 +01:00
Fedor Isakov 0771504044 Refactoring the reactor API, cleaning up the code. 2017-01-03 12:11:31 +01:00
Fedor Isakov 466c015263 Handlers to have multiple primary constraints. RuleIndex to select handlers with matching primary symbol, if a handler has one. Only "accept-all" handlers process non-primary constraints. 2016-12-28 12:54:19 +01:00
Fedor Isakov 26f12f187d Refactor the evaluation controller to have handlers. RuleIndex to select handlers with matching primary symbol first, then the "accept-all" handlers. Tests. 2016-12-23 16:50:31 +01:00
Fedor Isakov 49a6ee0bd0 New naming convention for test helper classes (prefix Mock-). 2016-12-22 15:56:23 +01:00
Fedor Isakov e6c7ee74f5 Renaming implementation classes to clean up the namespace. 2016-12-22 12:27:34 +01:00
Fedor Isakov b891f0fa47 Optimizing the aux lookup of constraints by moving the constraint symbol to the top of the search term. 2016-12-14 17:07:58 +01:00
Fedor Isakov b02f3d727b Fix infinite loop on cyclic terms. Detect term cycles while walking on put/remove/retrieve. 2016-12-06 16:58:15 +01:00
Fedor Isakov 7fe7662873 Fix the failing match if case of the wrong constraints order. Test. 2016-11-23 15:55:45 +01:00
Fedor Isakov b4e9d45f7e Enforce the constraint transparency contract on bound logicals: treat the value as the constraint argument. Remove misbehaving test. 2016-10-13 11:07:27 +02:00
Fedor Isakov 60cd075bf3 Specifying occurrence arguments to patternPredicates.
Correctly wrapping/unwrapping of arguments when matching rules.
Optimizing MatchTrie: process related occurrences first to avoid quadratic complexity.
2016-06-26 18:19:30 +02:00
Fedor Isakov 61ef4ff4af Refactor the way logical's parent update are handled in the occurrence store, fix the broken update leading to corrupted store.
Ensure constraint occurrences are alive before reactivating.
2016-06-16 11:48:06 +02:00
Fedor Isakov ed2ff61ec4 Reimplemented TermTrie using discrimination trees. 2016-06-06 16:18:49 +02:00
Fedor Isakov 57a76ad43c Fix memory leak 2016-06-02 12:20:00 +02:00
Fedor Isakov 8185605e99 Optimizing term trie and rules index. Using bitset to mark value tokens incidental with nodes in the "term superposition" of term trie. 2016-06-02 11:03:19 +02:00
Fedor Isakov 0f7ffd9141 Support for triggering arbitrary predicates on an occurrence match with a head's rule.
Properly handling constraint pattern/occurrence match with values/variables on either side using modal unificaiton.
2016-05-27 20:55:31 +02:00
Fedor Isakov 1652eacfe3 Integrating TermTrie in the occurrence store. 2016-05-22 17:09:02 +02:00
Fedor Isakov e9969b08b7 Integrating TermTrie in the rules index, tests. 2016-05-22 15:44:35 +02:00
Fedor Isakov 82d5763039 TermTrie: maintaining the order of the values. 2016-05-19 20:31:05 +02:00
Fedor Isakov b42f005c7e TermTrie: supporting term variables. 2016-05-19 16:39:52 +02:00
Fedor Isakov a44366921b TermTrie: building an index of rules/occurrences from term values. Term variables not yet supported. 2016-05-18 15:44:56 +02:00
Fedor Isakov 79e920c546 Refactoring utility classes to a separate package 2016-05-10 10:09:18 +02:00
Fedor Isakov b54673b5a8 Matcher optimizations: get rid of sequence and flatMap, re-implement iterating over MatchTrie using primitives, ensure no exponential search is necessary. 2016-05-10 10:04:32 +02:00
Fedor Isakov 43e9b35e1e Some more minor optimizations in the match processing. Minor code refactorings. 2016-04-24 17:53:49 +02:00
Fedor Isakov 2d46cd9542 Rewritten Matcher to not rely on Sequence and flatMap, instead using MatchTrie. OccurrenceIndex interface made clear. Some minor code optimizations. 2016-04-21 20:49:06 +02:00
Fedor Isakov d0bf94fc91 Support body alternation in Handler. Adopt the changes in the API. 2016-04-15 13:59:23 +02:00
Fedor Isakov e55108030b Avoid dependency of Handler onto Solver. Access solver via the evaluation session. 2016-04-07 11:40:50 +02:00
Fedor Isakov a1a17426b7 Extract PropagationHistory. Code refactoring and cleanup in preparation to switching to persistent OccurrenceStore and Handler. 2016-04-06 13:23:04 +02:00
Fedor Isakov 8c103ddbd1 Integrate changes in the API imported from the Logic project. Change the code accordingly. 2016-03-16 16:26:25 +01:00
Fedor Isakov 6089f8c5ff Optimize selection of rules to try based on the values in the constraint arguments 2016-03-09 15:14:51 +01:00
Fedor Isakov ec6ce31cc2 Propagation history feature, tests. Minor refactorings. 2016-03-07 15:23:57 +01:00
Fedor Isakov 63bb7f578d Ensure the null value is never exposed when merging variable (ground-free) 2016-03-03 16:42:09 +01:00
Fedor Isakov 701a434d69 Reactivate occurrences on union of var arguments. Tests. 2016-03-03 12:58:53 +01:00
Fedor Isakov 619337151f Updated API sources from the latest version of Logic. Adapted to the new API. LogicalPattern -> MetaLogical. Renamed all *pattern entities. RuleBuilder for tests. 2016-01-29 14:41:57 +01:00
Fedor Isakov 322485c046 Index occurrences by value.
Lookup of occurrences in the store is forced to match value OR logical (probably need both).
2016-01-25 18:00:18 +01:00
Fedor Isakov ed76bdae73 Optimizing looking up constraint occurrences to complete a match.
Parent observer for logicals, maintaining the logical-to-occurrence index in occurrence store.
Some code refactoring.
2016-01-24 20:45:46 +01:00
Fedor Isakov b8aa435eb4 Introduced Profiler to track bottlenecks. Some obvious optimizations. Refactoring for cleaner code. 2016-01-21 11:44:52 +01:00
Fedor Isakov caf7ba78f9 Make sure logical instances have unique symbols (a unification lib's requirement) 2016-01-19 12:03:55 +01:00
Fedor Isakov 3cf3f4b21d Updated API sources from the latest version of Logic. Adapted to the new API. Invocation/occurrence arguments. 2016-01-13 23:09:53 +01:00
Fedor Isakov bedb9592a0 Updated API sources from the latest version of Logic. Adapted to the new API. Activation stack. 2016-01-11 16:07:52 +01:00
Fedor Isakov e97b854f4c Updated API sources from the latest version of Logic. Adapted to the new API. 2016-01-09 02:14:10 +01:00
Fedor Isakov 057c4d7c69 Logical value observers. Testing reactivation of constraint occurrences. 2016-01-08 15:11:09 +01:00
Fedor Isakov b90bdc84c4 MemLogicalPattern. Switch to using MemLogical in tests. 2016-01-07 12:56:13 +01:00
Fedor Isakov 8aa6b04c70 Extract away program builder-related stuff: this part is going to be provided by the reactor's client 2016-01-07 12:07:55 +01:00
Fedor Isakov c3bfcc9311 Updated API sources from the latest version of Logic. Adapted to the new API. 2016-01-06 20:30:54 +01:00
Fedor Isakov 2f38824ed5 Updated API sources from the latest version of Logic. Adapted to the new API. 2015-12-27 23:42:58 +01:00
Fedor Isakov 4710c85124 Testing the primes generating program. 2015-12-27 00:51:39 +01:00
Fedor Isakov b80da31c1b Testing and fixing the handler semantics. Drop matches with occurrences that are no longer alive. 2015-12-27 00:18:26 +01:00
Fedor Isakov bc7f266997 A test of gcd program. 2015-12-25 13:31:59 +01:00
Fedor Isakov 20948a859c First real program working 2015-12-25 10:32:05 +01:00
Fedor Isakov 49ebcab10d Testing EvaluationSession and SessionSolver 2015-12-24 19:15:40 +01:00
Fedor Isakov a58af2c921 Upgraded to the latest Kotlin beta 2015-12-23 16:43:37 +01:00
Fedor Isakov a3346ae57f Adapting to changes in the API. Implemented LogicalContext. Generifying code in tests. Testing LogicalPattern. 2015-12-23 16:26:35 +01:00
Fedor Isakov 51bcebfc01 Small refactorings and code cleanup in tests 2015-12-22 18:42:06 +01:00
Fedor Isakov c04ecab6d0 Switched to using LogicalContext for the rule matching, tests 2015-12-22 11:08:00 +01:00
Fedor Isakov 03787eb8fe Implemented rule matcher using unification lib.
Refactor the code into handler and matcher.
Tests separation and cleanup.
2015-12-18 22:28:36 +01:00
Fedor Isakov 8f75050b2e Imported unification lib using maven via JitPack.io 2015-12-12 22:50:05 +01:00
Fedor Isakov 1c9ce1f5f5 Basic guards support. 2015-12-10 23:15:51 +01:00