
import ec

NUM_EC = 4
EXPLORATION_SPACE = [NUM_EC]*NUM_EC

class Model:
	state, funs = [], []
	out_i = None
	schd = None

	def __init__(self):
		self.state = [None]*NUM_EC
		for i in range(NUM_EC):
			self.funs.append(ec.EC(i))
		self.out_i = None
		self.schd = range(NUM_EC)
		self.schd.reverse()

	def set_out_id(self, i):
		self.out_i = i

	def set_schedule(self, s):
		self.schd = s
	
	def run(self):
		for it in self.schd:
			output = self.funs[it].run(self.state[it-1])
			if output != None:
				self.state[it] = output 

	def trsfun(self, input):
		self.state = input
		self.run()
		if self.out_i == None:
			return self.state
		else:
			return self.state[self.out_i]


