-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement concurrent effects and autonomous evolution
- Loading branch information
1 parent
3715f42
commit 9f3838a
Showing
7 changed files
with
94 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
from pymerlin._internal._registrar import FunctionalEffect | ||
|
||
|
||
class EffectTrait: | ||
def empty(self): | ||
return 0 | ||
return FunctionalEffect(lambda x: x) | ||
def sequentially(self, prefix, suffix): | ||
return suffix | ||
def concurrently(self, left, right): | ||
return 0 | ||
def try_both(x): | ||
res1 = left.apply(right.apply(x)) | ||
res2 = right.apply(left.apply(x)) | ||
if res1 != res2: | ||
raise Exception("Concurrent composition of non-commutative effects") | ||
return res1 | ||
return FunctionalEffect(try_both) | ||
class Java: | ||
implements = ["gov.nasa.jpl.aerie.merlin.protocol.model.EffectTrait"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters