import amachine as am
from pprint import pprint
import matplotlib.pyplot as plt
import numpy as np


am.srand_global( 42 )

# May have multiple recurrent subgraphs, terminal states, or tranistory states
m = am.random_machine( 
	n_states=23, 
	symbols=[ '0', '1' ],
	connectedness=0.35,
	randomness=0.25 )

# # Collapse to the largest recurrent subgraph
m.collapse_to_largest_strongly_connected_subgraph()

# # Minimize the machine -> epsilon-machine.
m.minimize()

print( f"E    : {m.E():.3f}" )
print( f"T    : {m.T_inf():.3f}" )
print( f"S    : {m.S():.3f}" )
print( f"h_mu : {m.h_mu():.3f}" )

h_mu=m.h_mu() 

C = m.block_convergence()


print(type(C))
print( type( C.E ) )
print( type( C.H_L ) )
print(C)


m.draw_block_entropy_curve()
m.draw_block_measure_curves()