def __init__(self, Candidate): # The 'index' remains None, as long as the TemplateState is not an # accepted element of a state machine. This makes sense, in particular # for TemplateStateCandidates (derived from TemplateState). StateA = Candidate.state_a StateB = Candidate.state_b my_index = index.get() self.__state_a = StateA self.__state_b = StateB self.__state_index_sequence = StateA.state_index_sequence() + StateB.state_index_sequence() self.__state_index_to_state_key_db = dict((state_index, i) for i, state_index in enumerate(self.__state_index_sequence)) # Combined DropOut and Entry schemes are generated by the same function entry = TemplateState_Entry(my_index, self.__state_index_to_state_key_db, StateA.entry, StateB.entry) drop_out = MegaState_DropOut(StateA, StateB) MegaState.__init__(self, entry, drop_out, my_index) self.__transition_map, \ self.__target_scheme_n = combine_maps(self.__state_a, self.__state_b) # Compatible with AnalyzerState # (A template state can never mimik an init state) self.__engine_type = None # StateA.engine_type # self.input = None # StateA.input # get_input_action(StateA.engine_type, InitStateF=False) MegaState.bad_company_set(self, self.__state_a.bad_company().union(self.__state_b.bad_company()))
def __init__(self, Candidate): StateA = Candidate.state_a StateB = Candidate.state_b my_index = index.get() self.__state_a = StateA self.__state_b = StateB self.__state_index_sequence = StateA.state_index_sequence( ) + StateB.state_index_sequence() self.__state_index_to_state_key_db = dict( (state_index, i) for i, state_index in enumerate(self.__state_index_sequence)) # Combined DropOut and Entry schemes are generated by the same function entry = TemplateState_Entry(my_index, self.__state_index_to_state_key_db, StateA.entry, StateB.entry) drop_out = MegaState_DropOut(StateA, StateB) MegaState.__init__(self, entry, drop_out, my_index) self.__transition_map, \ self.__target_scheme_n = combine_maps(self.__state_a, self.__state_b) # Compatible with AnalyzerState # (A template state can never mimik an init state) self.__engine_type = None # StateA.engine_type # self.input = None # StateA.input # get_input_action(StateA.engine_type, InitStateF=False) MegaState.bad_company_set( self, self.__state_a.bad_company().union(self.__state_b.bad_company()))
def __init__(self, FirstPath, TheAnalyzer): my_index = index.get() ski_db = StateKeyIndexDB([x.state_index for x in FirstPath.step_list], IgnoredListIndex=len(FirstPath.step_list)-1) MegaState.__init__(self, my_index, FirstPath.transition_map, ski_db, TheAnalyzer.dial_db) # Uniform OpList along entries on the path (optional) self.uniform_entry_OpList = FirstPath.uniform_entry_OpList.clone() self.__path_list = [ FirstPath.step_list ] # Following is set by 'finalize()'. self.__finalized = None # <-- ._finalize_content()
def __init__(self, FirstPath, TheAnalyzer): my_index = index.get() ski_db = StateKeyIndexDB([x.state_index for x in FirstPath.step_list], IgnoredListIndex=len(FirstPath.step_list)-1) MegaState.__init__(self, my_index, FirstPath.transition_map, ski_db) # Uniform OpList along entries on the path (optional) self.uniform_entry_OpList = FirstPath.uniform_entry_OpList.clone() self.__path_list = [ FirstPath.step_list ] # Following is set by 'finalize()'. self.__finalized = None # <-- ._finalize_content()
def __init__(self, FirstPath, TheAnalyzer, CompressionType): self.__path_list = [ FirstPath.sequence() ] entry = PathWalkerState.adapt_path_walker_id_and_path_id(FirstPath.index, FirstPath.entry, PathID=0) drop_out = FirstPath.drop_out # map: drop_out --> state_index_list MegaState.__init__(self, entry, drop_out, FirstPath.index) # original_transition_map: interval --> DoorID # transition_map: interval --> MegaState_Target self.__original_transition_map = FirstPath.transition_map self.transition_map = PathWalkerState.prepare_transition_map(self.__original_transition_map) self.__uniformity_required_f = (CompressionType == E_Compression.PATH_UNIFORM) self.__uniform_entry_command_list_along_path = FirstPath.get_uniform_entry_command_list_along_path() self.__state_index_sequence = None # Computed on demand
def __init__(self, Candidate): StateA = Candidate.state_a StateB = Candidate.state_b # Combined DropOut and Entry schemes are generated by the same function transition_map, target_scheme_n = combine_maps(StateA.transition_map, StateB.transition_map) ski_db = StateKeyIndexDB(StateA.state_index_sequence() + StateB.state_index_sequence()) MegaState.__init__(self, index.get(), transition_map, ski_db) self.uniform_entry_OpList = UniformObject.from_iterable(( StateA.uniform_entry_OpList, StateB.uniform_entry_OpList)) self.__target_scheme_n = target_scheme_n self.__engine_type = None # StateA.engine_type MegaState.bad_company_set(self, StateA.bad_company().union(StateB.bad_company()))
def __init__(self, Represented_AnalyzerState, DropOutCatcher): assert not isinstance(Represented_AnalyzerState, MegaState) state_index = Represented_AnalyzerState.index transition_map = Represented_AnalyzerState.transition_map adapted_transition_map = transition_map.relate_to_TargetByStateKeys(state_index, DropOutCatcher) ski_db = StateKeyIndexDB([state_index]) MegaState.__init__(self, state_index, adapted_transition_map, ski_db) # Uniform Entry: In contrast to path compression, here we consider # all entries into the MegaState. self.uniform_entry_OpList = UniformObject() for action in Represented_AnalyzerState.entry.itervalues(): self.uniform_entry_OpList <<= action.command_list if self.uniform_entry_OpList.is_uniform() == False: break # No more need to investigate self.entry.absorb(Represented_AnalyzerState.entry)
def __init__(self, Represented_AnalyzerState, DropOutCatcher): assert not isinstance(Represented_AnalyzerState, MegaState) state_index = Represented_AnalyzerState.index transition_map = Represented_AnalyzerState.transition_map adapted_transition_map = transition_map.relate_to_TargetByStateKeys( state_index, DropOutCatcher) ski_db = StateKeyIndexDB([state_index]) MegaState.__init__(self, state_index, adapted_transition_map, ski_db) # Uniform Entry: In contrast to path compression, here we consider # all entries into the MegaState. self.uniform_entry_OpList = UniformObject() for action in Represented_AnalyzerState.entry.itervalues(): self.uniform_entry_OpList <<= action.command_list if self.uniform_entry_OpList.is_uniform() == False: break # No more need to investigate self.entry.absorb(Represented_AnalyzerState.entry)
def __init__(self, Candidate): StateA = Candidate.state_a StateB = Candidate.state_b # Combined DropOut and Entry schemes are generated by the same function transition_map, target_scheme_n = combine_maps(StateA.transition_map, StateB.transition_map) ski_db = StateKeyIndexDB(StateA.state_index_sequence() + StateB.state_index_sequence()) MegaState.__init__(self, index.get(), transition_map, ski_db, dial_db=StateA.entry.dial_db) self.uniform_entry_OpList = UniformObject.from_iterable(( StateA.uniform_entry_OpList, StateB.uniform_entry_OpList)) self.__target_scheme_n = target_scheme_n self.__engine_type = None # StateA.engine_type MegaState.bad_company_set(self, StateA.bad_company().union(StateB.bad_company()))
def __init__(self, Candidate): StateA = Candidate.state_a StateB = Candidate.state_b my_index = index.get() self.__state_a = StateA self.__state_b = StateB self.__state_index_sequence = StateA.state_index_sequence() + StateB.state_index_sequence() self.__state_index_to_state_key_db = dict((state_index, i) for i, state_index in enumerate(self.__state_index_sequence)) # Combined DropOut and Entry schemes are generated by the same function entry = TemplateState_Entry(my_index, self.__state_index_to_state_key_db, StateA.entry, StateB.entry) drop_out = MegaState_DropOut(StateA, StateB) MegaState.__init__(self, entry, drop_out, my_index) self.__transition_map, \ self.__target_scheme_n = combine_maps(self.__state_a, self.__state_b) # Compatible with AnalyzerState # (A template state can never mimik an init state) self.__engine_type = None # StateA.engine_type # self.input = None # StateA.input # get_input_action(StateA.engine_type, InitStateF=False) MegaState.bad_company_set(self, self.__state_a.bad_company().union(self.__state_b.bad_company()))
def __init__(self, FirstPath, TheAnalyzer, CompressionType): self.__path_list = [ FirstPath.sequence() ] entry = PathWalkerState.adapt_path_walker_id_and_path_id(FirstPath.index, FirstPath.entry, PathID=0) drop_out = FirstPath.drop_out # map: drop_out --> state_index_list MegaState.__init__(self, entry, drop_out, FirstPath.index) # original_transition_map: interval --> DoorID # # '.accept(...)' requires a 'DoorID - transition_map' for # comparison. Thus, keep original transition map as reference. # # transition_map: interval --> MegaState_Target self.__original_transition_map = FirstPath.transition_map self.transition_map = PathWalkerState.prepare_transition_map(self.__original_transition_map) self.__uniformity_required_f = (CompressionType == E_Compression.PATH_UNIFORM) self.__uniform_entry_command_list_along_path = FirstPath.get_uniform_entry_command_list_along_path() self.__state_index_sequence = None # Computed on demand