Commit Graph

594 Commits

Author SHA1 Message Date
Grigorii Kirgizov 9aaf35561a Mem opt: store RuleMatchers only for principal rules between sessions. Add a test for incr processing.
The number of preserved matchers is around 4-10 times less.
The added test is an example of programs handled incorrectly with this opt. Fails now.
2020-02-05 12:29:33 +03:00
Fedor Isakov e763b0a3eb Fix maven source plugin's version 2020-01-20 19:43:56 +01:00
Fedor Isakov 8af582f9b2 Refactoring: simplify contract b/w controller and logical state. 2020-01-14 15:34:54 +01:00
Fedor Isakov d208e802b9 Remove unnecessary feature: StateFrameStack is no longer used.
StateFrameStack adds no functionality but requires too much processing.
Rename StateFrameStack -> LogicalState.
Rename ProcessingStateImpl -> ConstraintsProcessing.
Simplify occurrence's logical observer.
Introduce transient dependency on controller to LogicalState.
Keep logical state as part of session token, avoid re-initializing
all logical observers.
Make replaying of match journal independent of controller.
2020-01-10 13:51:07 +01:00
Fedor Isakov 01195cb1ac Drop unused methods from Rule interface. To be reinstated in RuleEx. 2020-01-02 17:20:13 +01:00
Grigorii Kirgizov ecc948c1fc Add, remove and merge observers on Logical always on their roots. Fixes MPSCR-28 2019-12-23 21:13:07 +03:00
Grigorii Kirgizov 1f69ff7d57 Reproduce MPSCR-28 with a test in Reactor 2019-12-23 18:14:41 +03:00
Fedor Isakov 271df160bb Optimize rete rule matcher for dropping occurrences.
Introduce a reactive scheme: alpha node has "dependent" nodes which
it can invalidate transitively. Drop block initiates invalidation,
intro block actually drops the nodes.
2019-12-08 17:48:01 +01:00
Fedor Isakov 2199905ea2 Enhance profiler to report actual time spent at probe locations.
Instead of just reporting the times each probe has been called,
collect and calculate the actual time taken by each probe location from
the whole backtrace pool.
2019-12-08 16:28:31 +01:00
Fedor Isakov 4eb93f20f9 Re-organize places in reactor to gather profiling information. 2019-12-08 15:44:36 +01:00
Fedor Isakov 5d63ec31e1 Remember probes for activated occurrences, optimize drop time.
Avoid searching for matching rules again when discarding occurrence.
2019-12-08 15:37:56 +01:00
Fedor Isakov 818d1a4dbc Fix linked list implementation. Fixes MPSCR-18
New implementation enables the previously failing tests to pass.
2019-11-26 23:07:42 +01:00
Fedor Isakov 65daa76c6b Remove droppedTrail. Optimize operation with consumed signatures. Restore test.
It appears the feature that tracks the occurrences that have been
dropped
requires too much memory.
2019-11-26 11:26:42 +01:00
Fedor Isakov 9fab2e9d34 Refactor and redesign ReteRuleMatcher for better memory footprint.
Drop layer prototype, make layer mutable.
Keep nodes in a layer in a linked list with fail-safe iterator.
Introduce update queue for update blocks.
Update blocks run incrementally unless reset.
Maintain trail of introduced and dropped occurrences.
Generation iterates over nodes in the last (final) layer incrementally,
unless reset.
Introduce new test.
2019-11-24 13:34:59 +01:00
Fedor Isakov 65f7b493be Revert "Add ReactivateBlock in Rete Matcher to correctly handle reactivation. Fixes MPSCR-17"
This reverts commit f96155496f.
I need to revert this commit to avoid merging problems. Going to reapply
it later if necessary.
2019-11-24 13:34:07 +01:00
Grigorii Kirgizov f96155496f Add ReactivateBlock in Rete Matcher to correctly handle reactivation. Fixes MPSCR-17 2019-11-19 15:43:15 +03:00
Grigorii Kirgizov 32a1ef77c9 Add test (fails now) for a new bug MPSCR-17 in Rete Matcher concerned with reactivation 2019-11-19 15:43:15 +03:00
Grigorii Kirgizov e7b374ce50 Fix calls to trace.reactivate (there were extra calls in some exec paths) 2019-11-19 15:43:15 +03:00
Grigorii Kirgizov 716e285c0c Small cleanup of EvaluationTrace usage 2019-11-07 17:14:40 +03:00
Grigorii Kirgizov f80371e148 MPSCR-14: Correctly trace incrementally reactivated occurrences. Fixes the bug. 2019-11-07 15:43:02 +03:00
Grigorii Kirgizov 45df4d845f Minor cleanup: remove DependentRulesSpec and its usages in RulesDiff
for historical documentation purposes, why it was needed:
It was used for specifying and handling rules which must be simply removed
without all related incremental invalidation machinery.
Long time ago some of these dependencies weren't captured
and such "simply dependent" rules must have been handled separately.
Currently it's handled by general invalidation case.
2019-11-06 19:10:29 +03:00
Grigorii Kirgizov 572a2cbfd5 Revert "Revert "MPSCR-4: Upd refs to new RuleIndex on Dispatcher construction in incremental case.""
This reverts commit a0b2af95
This together with preceding changes concerned with preserving Rules finally fixes MPSCR-4.
2019-11-06 19:10:29 +03:00
Grigorii Kirgizov 95214fcae9 Rename 'handlers' in Program to 'rulesLists' 2019-11-06 19:10:29 +03:00
Grigorii Kirgizov 87e9251242 Add RulesDiff.getPreserved() accessor to preserved rules 2019-11-06 19:10:29 +03:00
Grigorii Kirgizov f343ba0d3b Adjust to changes in SessionToken & RulesDiff interfaces 2019-11-06 19:10:29 +03:00
Grigorii Kirgizov bfcee33ec9 Modify SessionToken to preserve old rules instead of tags & RulesDiff to also distinguish preserved rules 2019-11-06 19:10:29 +03:00
Grigorii Kirgizov 3caeddcb63 Upd docs for StateFrame & add docs for StateFrameStack 2019-11-06 12:43:03 +03:00
Grigorii Kirgizov 510c3cd479 MPSCR-5: Clear all logicals from current StateFrameStack observer on incremental session teardown. 2019-11-06 12:16:11 +03:00
Fedor Isakov a0b2af95c9 Revert "MPSCR-4: Upd refs to new RuleIndex on Dispatcher construction in incremental case."
This reverts commit 0dd7f8c70f.
2019-11-04 15:58:54 +01:00
Grigorii Kirgizov 0dd7f8c70f MPSCR-4: Upd refs to new RuleIndex on Dispatcher construction in incremental case.
Slightly extend RuleMatcher interface.
Store RuleMatcher instances instead of RuleMatcherProbe in SessionToken.
2019-10-31 22:20:19 +03:00
Grigorii Kirgizov a095b2e222 Provide better (hopefully) name & explanation, undeprecate and provide missing impl for 'forgetSeen' method 2019-10-15 21:17:24 +03:00
Fedor Isakov 17f5bd64b0 Optimize Dispatcher: ensure allMatches are calculated lazily on request. 2019-10-08 13:20:40 +02:00
Fedor Isakov 445108da74 Fix RuleIndex returning too many matches for a constraint w/wildcard arg. 2019-10-08 13:16:56 +02:00
Fedor Isakov b283f657cf Fix a nasty bug in logical context.
A meta logical within a pattern was not properly initialized before the rule body is processed.
2019-10-02 13:54:11 +02:00
Fedor Isakov e69909f3be Some more optimizations in Rete rule matcher. 2019-10-01 16:25:12 +02:00
Fedor Isakov 31c95cd069 Bump up reactor version to 0.9.14. 2019-09-30 16:31:59 +02:00
Fedor Isakov c7b07f3b1a Adapt to the new persistent collections API. 2019-09-30 16:31:59 +02:00
Fedor Isakov 8ce96ec41e Introduce an abstraction layer of type aliases for persistent collections. 2019-09-30 16:31:59 +02:00
Fedor Isakov 04164e1039 Add some more profiling blocks. 2019-09-30 16:31:59 +02:00
Fedor Isakov 38e71db7e8 Revive and refactor ReteNetwork-based rule matching algorithm.
ReteNetwork is faster on large samples.
RuleMatchingProbe is mutable and not persistent, no need to update value.
2019-09-30 16:31:59 +02:00
Fedor Isakov f9b38113f5 Refactor and cleanup Dispatcher for better readability. Drop hacky stuff. 2019-09-30 16:31:59 +02:00
Fedor Isakov 60c39f2811 Add a test for a peculiar use case. Only triggered in production. 2019-09-30 16:31:59 +02:00
Fedor Isakov f21c01246f Introduce feature: optimize rule index for arguments matching.
RuleIndex indexes rules by constraint arguments value.
The additional feature allows to keep indexed also the head position
of the matched constraint.
2019-09-30 16:31:59 +02:00
Fedor Isakov 7d308cb0e3 Experimental feature: Rules segmentation.
The rules index is extended to observe the segment path a rule belongs to.
An occurrence is bound to the rule that activated it and thus has an
associated segment path.
Rules to be picked for activation can be selected on the basis
of matched segment path.
2019-09-27 21:59:58 +02:00
Fedor Isakov 6b2a14511f A little documentation for RuleMatcher. 2019-09-27 21:59:57 +02:00
Fedor Isakov d5bdcc971f Remove accidental modules from the project. 2019-09-27 21:59:57 +02:00
Fedor Isakov 3ff016d989 Optimizing rule matching algorithm for performance. 2019-09-23 11:27:54 +02:00
Fedor Isakov b8cf79e8e2 Renamed JB SDK to JB JDK 2019-09-23 11:27:54 +02:00
Grigorii Kirgizov 0f1460bb67 Add typechecking of array literals handling nested literals
Array literals always belong to some variable decl and their elements
are recursively checked against declared component type [JLS 10.6].
2019-09-11 13:24:01 +03:00
Fedor Isakov 1c61352068 Bump up reactor lib's version to 0.9.13. 2019-09-10 13:21:07 +02:00
Fedor Isakov 5cb4e0b289 Deprecate getting "current" EvaluationSession. 2019-09-10 13:19:59 +02:00
Fedor Isakov 487df639e5 Drop unused methods from EvaluationSession.
Having unused methods is confusing.
2019-09-10 13:17:34 +02:00
Fedor Isakov af212ca92e Refactoring EvaluationSession(Ex): drop controller accessor.
The inverse reference to controller from Evaluation session considered harmful.
Drop controller from EvaluationSession, drop ask/tell from EvaluationSession, extend InvocationContext with controller and supervisor accessors.
2019-09-10 13:08:53 +02:00
Fedor Isakov 279678b219 Ensure all feedback gets reported to trace. 2019-09-03 14:53:11 +02:00
Fedor Isakov a6aed2c22c Bump up the reactor lib version to 0.9.12. 2019-09-02 17:27:47 +02:00
Fedor Isakov 4080ab519a Extend EvaluationFeedback with specific methods for creating details feedback; introduce details parameter. 2019-09-02 17:18:02 +02:00
Fedor Isakov 13526ded21 Prevent ephemeral messages caused by failed ask to propagate.
A failed ask predicate constitutes normal evaluation flow, no need to report
this to the user.
2019-08-28 17:46:34 +02:00
Grigorii Kirgizov 98356f25cc rebase on master. remove extra deps in coderules generator 2019-08-22 15:16:17 +02:00
Grigorii Kirgizov 906f919e16 Run coderules program analyses at generation stage. Extend Rule with basetag(). Adjust how rule_tag is generated for reuse in generator.
basetag() returns name of ConstraintRule without node id.
Check on whether Rule is principal are now done through basetag(), it's sufficient.
Add part of future analysis: CallerTableBuilder.
2019-08-22 15:16:17 +02:00
Grigorii Kirgizov b4a012c61b fix type error in kotlin smart cast 2019-08-22 15:16:17 +02:00
Grigorii Kirgizov 9b472f5c15 Fix last() behavior for history: use constant-time getLast() in case of LinkedList 2019-08-22 15:16:17 +02:00
Fedor Isakov ed79a8b9b9 Fix TermTrie not processing correctly ref to a Nil.
The code in ClassicTermTrie that is responsible for recursion guarding
when processing cyclic terms, used to mismatch valid pattern term
containing ref to a Nil term, which is a constant.
2019-08-10 15:18:04 +02:00
Fedor Isakov a74831ad95 Bump up reactor version to 0.9.11. 2019-07-30 13:28:31 +02:00
Fedor Isakov d647a31e1d Switch reactor to JDK 11, kotlin lib to 1.3.31. 2019-07-30 13:27:27 +02:00
Grigorii Kirgizov b7b5ece832 Adjust notion of principal rule in analysis. Reenable assert in ProcessingStateImpl.
Now any rule matching on or activating principal constraints counts as principal.
2019-07-29 20:25:25 +03:00
Fedor Isakov 9a5b9f0b51 Temporarily disable failing assertion. 2019-07-29 13:42:33 +02:00
Fedor Isakov ba604c2f80 Use ArrayList for history, avoid linear time for last() method. 2019-07-29 13:42:33 +02:00
Grigorii Kirgizov cf5d2ae712 Fix incorrect behavior in journal.reset() in some cases, reenable tests for that. 2019-07-26 17:00:31 +02:00
Grigorii Kirgizov fb384dab39 Use embedded profiling for incremental passes 2019-07-26 17:00:31 +02:00
Grigorii Kirgizov 8ed7eb3c02 Change signature of Supervisor to handle RuleMatch instead of Rule 2019-07-26 17:00:31 +02:00
Grigorii Kirgizov be7283190f Propagate FeedbackStatus out of reactivate for incremental execution. 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov f7ea5f7a0d Add entries to ExecutionQueue only once 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov 2dba8890f3 Refactor ProcessingStateImpl: move logic related to execution queue to its own class 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov 577662e202 Fix problem with some recovering rules not being reexecuted 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov 5414fe7e67 Move RulesDiff construction from reactor to coderules runtime. 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov d96ef01f98 Extend ProcessingStateImpl & RulesDiff for additional part of invalidation stage 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov 769e7fd2ba Fix small issue related to mutable justifications in Occurrence. Upd tests with latest changes. 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov ef2627cab4 MatchJournal now adds chunks for principal occurrences: search is simplified, case of several principal occs in rule is handled. 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov b560bbbd30 Separate incremental tests on testlang and baselang into their own models. 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov ed93865359 Refactor MatchJournal.Pos. Make RulesDiff usable in coderules mps code. Extend EvaluationTrace. 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov 49aa913556 Move MatchJournalImpl to its own file. Some docs for it. Hide underlying mutable history behind immutable List. Add string tag() to Rule. 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov 6c4667e066 Add basic coderules program analysis for determining principal constraints 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov 155266d8ca Abstract java interfaces for incrementality-related classes for interop between reactor and coderules 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov 5995b3a2f9 Simplify last test in TestStoreAwareJournal 2019-06-17 19:31:43 +03:00
Grigorii Kirgizov 022a9c372e Avoid searches of principal occurrence by utilizing MatchJournal.Index 2019-06-13 21:30:20 +03:00
Grigorii Kirgizov 65f1198a60 Prune the whole related state in RuleMatchers on removal-phase. Add test case. 2019-06-13 20:10:08 +03:00
Grigorii Kirgizov 7acbbc3988 Fix tests 2019-06-13 18:01:35 +03:00
Grigorii Kirgizov d1152128da Remove kotlin imports 2019-06-13 18:00:04 +03:00
Grigorii Kirgizov 9863569323 Tests for incrementally removing and removing+adding rules 2019-06-12 19:09:06 +03:00
Grigorii Kirgizov d7b7d40f8a Don't expose InitialRule to RuleDiff. Add first test for rm algo stage. 2019-06-12 14:56:57 +03:00
Grigorii Kirgizov 0bfe9e8a47 minor: remove usages of Constraint.isPrincipal in ProcessingStateImpl, use IncrementalProgramSpec instead 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov ae20c334b4 Discern incremental reactivation from usual one. Fix postponedMatches logic. 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov b3e0770939 minor: slightly rearrange code in ProcessingStateImpl 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov a5a46d6c67 Add incrementality test for one nontrivial case in RuleMatchFront.expand 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov db80dc7ab6 Extract rule ordering logic from ProcessingStateImpl 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 175d9f7623 Move StateFrameStack class to its own file 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov a2d55e92b9 Remove accidental line duplication 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 2a5f9e28dc Fix handling of postponed matches (match order comparison was slightly wrong) 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 5a9019e85c Fix bits of logic responsible for launching 'at-start' rules through 'main'. Fix handling of discarded occs 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 767eb057f5 Add helper method in Tests builder, adjust few tests with it 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 50fcfd0d8a Add initial version of logic for handling future matches in processActivated() 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov fa380c9f36 Fix failing build of coderules because of changed interfaces 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 3e50f47f73 Add MatchJournal.Index for additional queries and operations involving ordering of occurrences 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov eec343f902 Add stub code for handling case of adding headless ('at-start') rules 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov c0cb26d598 Add two more tests for addition phase. Handle one additional case and make one test pass. 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov ddb67690f4 Add partial sketch of removal phase of incremental algorithm.
For that: Extend DispatchingFront and RuleMatcherImpl interface with
'forget' methods which completely drops related matches from matchers' state;
Extend MatchJournal & Chunk interfaces with helper methods.
2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 8b4d98f6e2 Add few more checks in TestIncrementalProgram tests and one test in TestStoreAwareJournal 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 5b500340e5 Make StoreAwareJournal a pure interface, move delegated inheritance to StoreAwareJournalImpl (hide journal) 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 71eac08775 Move replayOccurrences back to MatchJournal again, fix tests 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 8d615852c6 Remove Controller from Occurrence and instead pass a new one each time through OccurrenceObserver
It caused a situation when on the very next incremental evaluation session
occurrences carried a stale Controller along with all the state from previous session.
As a result, incorrect logic of program evaluation.
2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 4e60ef9909 Add tests for incremental additions (one fails for now). Don't log reactivations in journal. 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 95b5f97869 Add equals() to MatchJournal.Pos. Handle corner case in 'replay', when it happens to the same pos. Same for 'reset'. 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov e33df7aac2 Hide mutable collection of occurrences in Chunk and add 'principleConstraint' fun to its interface 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov c9b486c170 Fix StoreAwareJournal test given updated journal's iterator starting pos 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 97d36d8d1f Fix corner case in algo stage. Add test for it. 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 6a3aad364c Add SessionToken to preserve eval state between sessions. Add IncrementalProgramSpec. Add impl of one algo stage, in ProcessingStateImpl.
SessionToken includes MatchJournal.View and a state of all RuleMatchers.
IncrementalProgramSpec specifies information needed for incremental evaluation.
In essence, it answers on queries of type 'isPrincipal' for Rules and Constraints.
It decouples specific incremental info from entities, allows to inject it easily in tests.
Its presence also enables incremental version of evaluation, in EvaluationSessionImpl.
2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 6932e99774 Enable tracking justification in Controller for principal constraints' occ-s 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 76194a62ae Refactor tests to make them more readable. Remove unsafe cast from journal's reset. 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 11bec29410 Use journal for aborting execution of alternative branches, fix 'reset' method
All tests for Controller pass, but one test from StoreAwareJournal fails, mute for now
2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 0fb54fc5ba Add invariant to Journal that it always has at least initial chunk, with EmptyRuleMatch
Also slightly fix tests and add tracking (i.e. using journal) to ProcessingStateImpl
2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 225bd9861e Separate concerns b/w ProcessingStateImpl and StateAwareJournal, construct in a new way
ProcessingStateImpl has only processing logic and inherits frame stack logic from StateAwareJournal
2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 77bc7538a4 Prepare before merging StoreAwareJournal & ProcessingStateImpl: extract FrameStack from ProcState, inherit StoreAwareJ from MatchJ by delegation 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 799b57c74e minor: remove usages of rule.tag() in tests 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 0cbc32d4a0 Get rid off nullability of Justs 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 52fd54afce Hide use of TIntSet from trove behind typealias; one usage in ConstraintOccurrence.java is left 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov f8b7ac1d50 Few renames in MatchJournal; throw exceptions at invalid iteration states 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov d3883effaf Extract frame-independent logic from MatchHistory to its base class MatchJournal
Small changes: rename MatchHistory -> StateAwareJournal; use referential
eq when iterating through chunks; provide only Pos, not Chunk from
current()/currentPos(); fix tests according to all this.
2019-06-12 13:28:05 +03:00
Grigorii Kirgizov e5942d2c77 Fix MatchHistory tests: fix impl of storeView, taking into account current pos in history (not all of it) 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov c4309084c5 Refactor: remove match-logic from StateFrame (now it's only about Observers), mvoe it to ProcessingState 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov b2f65e1510 Implement storeView() method to MatchHistory, remove it from ProcessingImpl (but not its single usage yet) and stored occurrences from StateFrame 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov cbddd108bb Subst FrameStack in MatchHistory for ProcessingImpl 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov cd5ad91caf minor: fix type in 'logOccurence' method 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov c322cf5c70 Add test with more complex and representative manipulation of MatchHistory 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov a360abc59e Add MatchHistory.View class (snapshot of history), refine one test, fix mistake in history.reset() 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 612f0a212c Refine MatchHistory impl, extract interface for tests, add several tests. 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 9a7838fdc7 Add initial sketch of MatchHistory; add justifications to ConstraintOccurence interface 2019-06-12 13:28:05 +03:00
Fedor Isakov eba51e8a9b Bump up conreactor's version to 0.9.10 in anticipation of new features. 2019-06-04 18:24:31 +02:00
Fedor Isakov c051542440 Replace usages of java.util.HashMap with persistent map to optimize
memory allocation.
2019-05-17 18:01:34 +02:00
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 0697437ec7 Optimize code for fewer transient memory allocations. 2019-05-17 17:10:20 +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 b482de1ce5 Rename reactor classes: Handler -> RulesList, IdWrapper -> Id 2019-05-10 12:00:02 +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 915bc1442a Update project structure after API pom has been deleted. 2019-05-09 14:22:23 +02:00
Fedor Isakov fa2476fabb Drop deprecated stuff from conreactor API. 2019-05-05 14:30:19 +02:00
Fedor Isakov 7e7dba455e Move Kotlin compiler to "process-source" phase of Maven build. 2019-05-05 14:29:51 +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 3163324661 Deprecate unused Program's methods, remove unused code.
Amend the API to support justifications.
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 f5449801f6 Auto-updated copyright headers. 2019-04-24 21:21:03 +02:00
Fedor Isakov f3d45d3a7b Bump up Reactor lib's version to 0.9.9. 2019-04-24 21:21:03 +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 19a096b12f Drop obsolete code. 2019-04-24 21:21:03 +02:00
Fedor Isakov 116359ef2a Switch to using IDEA 2019.1. 2019-04-19 11:50:03 +02:00
Fedor Isakov cc1a98fa6d Report tracing event "trying" after all pattern match predicates. 2019-04-19 11:50:03 +02:00
Fedor Isakov 109be1e564 Switch reactor to use Kotlin 1.3. 2019-04-11 11:05:11 +02:00
Fedor Isakov 8c25d50ea5 Introduce InvocationParameter to instantiateArguments. 2019-02-17 14:41:36 +01: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 dc8638996d Bump up the conreactor version to 0.9.4. 2019-02-15 17:15:16 +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 32601dc96a Deprecate unused methods in conreactor. 2019-01-03 17:16:47 +01:00
Fedor Isakov 6e9966fe9d Bump up conreactor version to 0.9.3. 2018-12-28 11:57:27 +01:00
Fedor Isakov 6953939e4a Report unification of a logical with itself as a failure. 2018-12-28 11:57:27 +01:00
Fedor Isakov 6c0a9d404b Properly process failed guard 2018-12-28 11:57:26 +01:00
Fedor Isakov d61e8e1370 Ensure matched rule logical context provides all logicals with corresponding prototype meta-logicals. 2018-12-28 11:57:26 +01:00
Fedor Isakov 666f406335 Introduce VarSymbol interface to classify terms with "logical" symbol as wildcards in the term trie. 2018-12-28 11:57:26 +01:00
Fedor Isakov 8db1aead11 Fix propagate failure on on reactivated constraint. Always report a failure to avoid confusion with the trace view. 2018-11-20 22:39:30 +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 72e7fdfbfc Ensure FailureHandler is consulted only if there are no more alternatives. 2018-11-20 22:39:29 +01:00
Fedor Isakov 7762095b8d Bump up reactor version to 0.9.2 2018-11-04 12:54:32 +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 d091b291c3 Experimental alternative implementation of rule matching algo 2018-10-08 15:08:36 +02: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 55801449fe Ignore IDEA's shelf files 2018-09-10 10:54:38 +02:00
Fedor Isakov 0d88525aa7 Optimize and reorganize occurrence matching 2018-09-10 10:16:34 +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 56bed6d03d Some more minor optimisations 2018-09-06 18:28:45 +02:00
Fedor Isakov 59a0d958d7 Minor optimisations and code cleanup 2018-09-05 17:14:24 +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 75c6dff551 Optimizing new matching algorithm. Keep an index of occurrence slots for each rule. 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 d023cf8466 Change reactor library version to 0.9.1 (new matching algo) 2018-08-03 11:48:35 +02:00
Fedor Isakov 862f7182ff Fix double exec of rule builders. Ensure all rules have unique tags. 2018-08-03 11:48:35 +02:00
Fedor Isakov 44b2004091 Experimentally switch to the new matching algorithm 2018-08-03 11:48:31 +02:00
Fedor Isakov 74402a8a1c New rule matching algorithm 2018-08-03 11:48:23 +02:00
Fedor Isakov 1609b5838d Correct the path to git root 2018-07-26 16:12:31 +02:00
Fedor Isakov 814baf4bce Update readme files. 2018-07-19 15:12:34 +02:00
Fedor Isakov a3f431b6b8 Fix a concurrent modification problem introduced inadvertently. 2018-06-22 15:27:17 +02:00
Fedor Isakov 558b068895 Disable an awkward optimization that had caused problems (failure to yield a correct match). 2018-06-20 17:51:22 +02:00
Fedor Isakov 6e0b9dee50 Switch to latest Kotlin release. 2018-03-05 12:02:37 +01:00
Fedor Isakov 4ea4b5cae5 Automatically update files in .idea folder. 2018-03-05 11:56:32 +01:00
Fedor Isakov 3a4d1bf7ae Another config file. 2017-11-09 12:02:59 +01:00
Fedor Isakov 7b113d5a21 Roll back an optimisation discriminating non-primary constraint symbols.
Doing so would change the semantics too much without apparent gains.
2017-11-09 12:02:27 +01:00
Fedor Isakov 2fb1f25d4c Minor code cleanup 2017-11-06 16:37:37 +01:00
Fedor Isakov 11d87c7846 Minor performance tweaks. 2017-11-03 12:09:43 +01:00
Fedor Isakov 741a803553 Code cleanup in matcher. 2017-11-02 14:51:57 +01:00
Fedor Isakov 1b809205e5 Minor optimization and refactoring in rule matcher. 2017-10-31 12:27:39 +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 d5cd9b825c Avoid including value of a Logical into toString() results, as it may cause infinite loop. 2017-10-13 11:53:40 +02:00
Fedor Isakov f65c0ce56e Update kotlin version to 1.1.4. 2017-10-06 12:10:42 +02: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 3c96e3d36c Rewrite TermTrie to not use recursion. Optimize put/lookup for speed. 2017-07-16 14:43:46 +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 f8970f7825 Refactoring and reorganizing the matcher code, preparing for incremental matches search. 2017-07-11 14:21:25 +02:00
Fedor Isakov f3544af05a Publishing the build artefacts to github releases. 2017-06-07 12:38:47 +02:00
Fedor Isakov 10d855c3fa Update gitignore. 2017-06-07 11:51:05 +02:00
Fedor Isakov 43ae109f4b Add the build status badge. 2017-06-07 11:42:55 +02:00
Fedor Isakov 74553153ea Drop dependency on Kotlin EAP. 2017-06-07 11:37:56 +02:00
Fedor Isakov b5ec22be79 Travis to test on Java8 2017-06-07 11:18:40 +02:00
Fedor Isakov 6658214546 Travis CI manifest 2017-06-07 11:13:17 +02:00
Fedor Isakov 90044e69c7 Update the copyright notice with the license. Remove obsolete artefacts and "generated" markings. 2017-06-05 15:16:19 +02:00
Fedor Isakov 7c5274aacb Rename the maven projects and artefacts. 2017-06-05 13:38:31 +02:00
Fedor Isakov 0dcf1ecd81 Rename API interfaces for better readability. 2017-06-05 13:37:56 +02:00
Fedor Isakov 58eea099f1 Readme file. 2017-06-05 10:48:29 +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 8f0ce2aad6 Delete deprecated interface. 2017-06-02 10:53:48 +02:00
Fedor Isakov 77662be281 Auto-changed .iml files. Switch to Kotlin 1.1.2. Switch to Dexx collection 0.7. 2017-06-01 15:11:54 +02:00
Fedor Isakov 89018e7fb6 Updated the javadoc. Removed unused class. 2017-06-01 10:42:41 +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 a70c5f6f02 Ensure the failure is only reported to the trace once. 2017-03-22 10:50:05 +01:00
Fedor Isakov cab0931cc1 Report failure to the trace. 2017-02-27 16:06:32 +01:00
Fedor Isakov 6cac64b6bd Fix and simplify the unification algorithm. Drop support for cyclic terms. Correctly report cycles. 2017-02-25 18:36:56 +01:00
Fedor Isakov c687908e1e Fix copying occurrences from the store view 2017-02-25 18:35:37 +01: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 e80818607c Introduce the Handler API. 2016-12-22 12:39:28 +01:00
Fedor Isakov e6c7ee74f5 Renaming implementation classes to clean up the namespace. 2016-12-22 12:27:34 +01:00