Commit Graph

368 Commits

Author SHA1 Message Date
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
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 3dd42efe32 Include information of the parent activations in the profiling data. 2016-12-14 12:34:18 +01:00
Fedor Isakov 90640f1d3d Bumped up the kotlin version in maven project file. Switch to the latest dexx collections. Drop google collections (unused). Re-imported all maven projects. 2016-12-13 10:31:16 +01:00
Fedor Isakov bdc4701b23 Uptimizing the profiler. Ensure only the top 98% of the durations get reported. 2016-12-12 15:42:06 +01:00
Fedor Isakov cb7dc76aa5 Simplify MatchTrie: no more additional nextSibling calculation, which had caused exponential search (yikes!); code cleanup. 2016-12-06 16:58:21 +01:00
Fedor Isakov 76fa878518 Report profiling results even on evaluation failure. 2016-12-06 16:58:21 +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 030d474727 Itegrating the reactor API changes from the typechecker project. 2016-08-29 11:21:23 +02:00
Fedor Isakov f1238b4e30 Implement missing methods. 2016-08-29 10:53:44 +02:00
Fedor Isakov 5ed7b207ca Minor optimizations. Avoid calling toString() on symbols.
Avoid notifying on logical's value updated if the value is same.
Avoid calling unification on constraint/occurrence terms.
Some code cleanup.
2016-06-30 09:45:45 +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 71810025e1 Itegrating the reactor API changes from the typechecker project. 2016-06-26 12:52:54 +02:00
Fedor Isakov 735c6b20e8 Switch to using JDK 1.8 for the project. 2016-06-24 14:22:22 +02:00
Fedor Isakov 34dc1208f3 Avoid runnig potentially unsafe code in finally{}, which can mask the original exception. 2016-06-24 14:21:36 +02:00
Fedor Isakov 2ae25c6756 Make use of LogicalOwner interface to avoid creating logicals that have other logical as value. 2016-06-24 14:20:42 +02:00
Fedor Isakov 64f332f5b0 Integrate the reactor API (imported from the typechecker project). 2016-06-24 14:17:54 +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 0699c7f6ad Move IdHashSet to util. 2016-06-16 11:46:39 +02:00
Fedor Isakov 8300fbb817 Optimization in occurrence store: avoid calling remove on TermTrie: very expensive. Some code cleanup and refactoring. 2016-06-08 11:17:38 +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 ab23988887 Profiling processing of occurrences. 2016-06-02 11:57:12 +02:00
Fedor Isakov 61b488aebd Cleaning up TermTrie code. 2016-06-02 11:56:14 +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