Skip to content

Commit

Permalink
Downgrading current simulator module classes to stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsekar committed Mar 25, 2022
1 parent e73310b commit 8503381
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 188 deletions.
3 changes: 2 additions & 1 deletion tests/test_action_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from wc_rules.schema.attributes import *
from wc_rules.schema.actions import *
from wc_rules.simulator.simulator import SimulationState
from wc_rules.matcher.core import default_rete_net
#from wc_rules.matcher.core import default_rete_net
import unittest


Expand All @@ -25,6 +25,7 @@ def string_to_action_object(s,_locals):
fn = eval('lambda: ' + s,_locals)
return fn()

@unittest.skip('Add this back after simulator module is ready')
class TestActionObjects(unittest.TestCase):

def setUp(self):
Expand Down
3 changes: 3 additions & 0 deletions wc_rules/matcher/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def make_edge_token(_class1,ref1,attr1,_class2,ref2,attr2,action):
data = {'ref1':ref1,'attr1':attr1,'ref2':ref2,'attr2':attr2}
return BasicToken(classref=_class1,data=data,action=action)

def make_attr_token(_class,ref,attr,value,action):
return BasicToken(classref=_class,data={'attr':attr},action=action)

# def make_node_token(_class,ref,action):
# return dict(_class=_class,ref=ref,action=action)

Expand Down
2 changes: 2 additions & 0 deletions wc_rules/simulator/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ def update(self,time,variables={}):
self.insert(event,time + tau)
return self




12 changes: 6 additions & 6 deletions wc_rules/simulator/simulator.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from collections import deque
from ..utils.collections import DictLike, subdict
from ..matcher.core import default_rete_net
from ..matcher.tokens import make_node_token, make_edge_token, make_attr_token
from .scheduler import default_sampler
from ..matcher.core import build_rete_net_class
from ..matcher.token import make_node_token, make_edge_token, make_attr_token
from .scheduler import NextReactionMethod
from attrdict import AttrDict
from ..schema.actions import PrimaryAction, CompositeAction


ReteNet = build_rete_net_class()

class SimulationState:
def __init__(self,nodes=[],**kwargs):
Expand All @@ -15,11 +15,11 @@ def __init__(self,nodes=[],**kwargs):
self.rollback = kwargs.get('rollback',False)
self.action_stack = deque()
self.rollback_stack = deque()
self.matcher = kwargs.get('matcher',default_rete_net())
self.matcher = ReteNet()

self.start_time = kwargs.get('start_time',0.0)
self.end_time = kwargs.get('end_time',0.0)
self.sampler = kwargs.get('sampler',default_sampler(time=kwargs.get('start_time',0.0)))
self.sampler = NextReactionMethod()

# These are elementary methods, used as
# the final step in adding/removing a node
Expand Down
91 changes: 0 additions & 91 deletions wc_rules/simulator/simulator2.py

This file was deleted.

78 changes: 0 additions & 78 deletions wc_rules/simulator/utils.py

This file was deleted.

12 changes: 0 additions & 12 deletions wc_rules/simulator/writer.py

This file was deleted.

0 comments on commit 8503381

Please sign in to comment.