Skip to content

Commit

Permalink
OA-Systems: Online Adaptive Systems #612
Browse files Browse the repository at this point in the history
  • Loading branch information
laxmikantbaheti committed May 17, 2023
1 parent 35e6175 commit a39ebe2
Showing 1 changed file with 53 additions and 24 deletions.
77 changes: 53 additions & 24 deletions src/mlpro/oa/systems/basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _run( self,

## -------------------------------------------------------------------------------------------------
## -------------------------------------------------------------------------------------------------
class OAFctBase(OAWorkflow):
class OAFctBase():


## -------------------------------------------------------------------------------------------------
Expand All @@ -84,7 +84,6 @@ def __init__(self):

self._processing_wf: OAWorkflow = None
self._first_fct_run:bool = True
OATask.__init__(self)


## -------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -185,7 +184,8 @@ def __init__(self,
p_logging=p_logging,
**p_kwargs)

self._processing_wf = p_processing_wf
OAFctBase.__init__(self)

self._strans_task:StreamTask = None
self._instance: Instance = None
self._shared = p_class_shared
Expand Down Expand Up @@ -281,8 +281,13 @@ def _adapt(self, **p_kwargs) -> bool:
-------
"""
pass

adapted = False
adapted = self._processing_wf.adapt(**p_kwargs) or adapted
try:
adapted = AFctSTrans._adapt(self, **p_kwargs) or adapted
except:
pass
return adapted

## -------------------------------------------------------------------------------------------------
def _adapt_on_event(self, p_event_id:str, p_event_object:Event) -> bool:
Expand Down Expand Up @@ -371,10 +376,9 @@ def __init__(self,
p_logging=p_logging,
**p_kwargs)

Model.__init__()
OAFctBase.__init__(self)

self._shared = p_class_shared
self._processing_wf = p_processing_wf
self._success_task = None
self._instance:Instance = None
self._state:State = None
Expand Down Expand Up @@ -454,12 +458,13 @@ def _compute_success(self, p_state: State) -> bool:


## -------------------------------------------------------------------------------------------------
def _adapt(self, **p_kwargs) -> bool:
def _adapt_on_event(self, p_event_id:str, p_event_object:Event) -> bool:
"""
Parameters
----------
p_kwargs
p_event_id
p_event_object
Returns
-------
Expand All @@ -469,13 +474,12 @@ def _adapt(self, **p_kwargs) -> bool:


## -------------------------------------------------------------------------------------------------
def _adapt_on_event(self, p_event_id:str, p_event_object:Event) -> bool:
def _add_task(self, p_task:StreamTask):
"""
Parameters
----------
p_event_id
p_event_object
p_task
Returns
-------
Expand All @@ -485,36 +489,41 @@ def _adapt_on_event(self, p_event_id:str, p_event_object:Event) -> bool:


## -------------------------------------------------------------------------------------------------
def _add_task(self, p_task:StreamTask):
def _run(self, p_inst_new, p_inst_del):
"""
Parameters
----------
p_task
p_inst_new
p_inst_del
Returns
-------
"""
pass
self.get_so().add_result(self.get_id(), FctSuccess.compute_success(self,
p_state=self._state))


## -------------------------------------------------------------------------------------------------
def _run(self, p_inst_new, p_inst_del):
def _adapt(self, **p_kwargs) -> bool:
"""
Parameters
----------
p_inst_new
p_inst_del
p_kwargs
Returns
-------
"""
self.get_so().add_result(self.get_id(), FctSuccess.compute_success(self,
p_state=self._state))

adapted = False
adapted = self._processing_wf.adapt(**p_kwargs) or adapted
try:
adapted = AFctBroken._adapt(self, **p_kwargs) or adapted
except:
pass
return adapted



Expand Down Expand Up @@ -555,9 +564,8 @@ def __init__(self,
p_logging=p_logging,
**p_kwargs)

Model.__init__()
OAFctBase.__init__(self)

self._processing_wf = p_processing_wf
self._broken_task:StreamTask = None
self._shared = p_class_shared
self._instance:Instance = None
Expand Down Expand Up @@ -651,7 +659,7 @@ def _adapt(self, **p_kwargs) -> bool:
-------
"""
pass
self._processing_wf._


## -------------------------------------------------------------------------------------------------
Expand All @@ -667,6 +675,7 @@ def _adapt_on_event(self, p_event_id:str, p_event_object:Event) -> bool:
-------
"""
pass


## -------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -701,6 +710,26 @@ def _run(self, p_inst_new, p_inst_del):
p_state=self._state))


## -------------------------------------------------------------------------------------------------
def _adapt(self, **p_kwargs) -> bool:
"""
Parameters
----------
p_kwargs
Returns
-------
"""
adapted = False
adapted = self._processing_wf.adapt(**p_kwargs) or adapted
try:
adapted = AFctBroken._adapt(self, **p_kwargs) or adapted
except:
pass
return adapted




Expand Down

0 comments on commit a39ebe2

Please sign in to comment.