def __init__(self,sys = dynsys(),
              params=np.zeros((dynsys().gmat.shape[1],
                               dynsys().gmat.shape[0]))):
     """
     goal_seq determines the order in which goals are visited,
     goal_seq = (1,2,3,4) implies that the system is to visit the north,
     east,south,west quadrants in that order.  Each time, the system
     is to visit the central, purple region first before moving to the
     next, desired goal location.  The purple region is denoted by the
     0th column in bmat.  If Ax<b for an appropriate column, then the system
     occupies the appropriate region
     """
     self.system = sys
     self.params = params
     self.A = np.array([
             [1,0,0,0],
             [0,1,0,0],
             [-1,0,0,0],
             [0,-1,0,0]])
     self.bmat = np.array([
             [3,3,5,3,1],
             [3,5,3,1,3],
             [-2,-2,-4,-2,0],
             [-2,-4,-2,0,-2],])
     self.goals = np.array([
             [2.5,2.5,0,0],
             [2.5,4.5,0,0],
             [4.5,2.5,0,0],
             [2.5,0.5,0,0],
             [0.5,2.5,0,0]]).transpose()
     self.counter = 0
     copy = self.system.x
     self.xhist = copy
     self.goal_semantics = ['Middle','Top','Right','Bottom','Left']
コード例 #2
0
 def test_run(self, x):
     #print(x) # remove afterwards
     self.example = switch_ctrl(
         sys=dynsys(x=np.array([[2.5, 0.5, 0, 0]]).transpose()),
         params=1.2 * np.array([[1, 0, 1, 0], [0, 1, 0, 1]]))
     self.example.surveil(t_switch1=x[0], t_switch2=x[0] + x[1])
     return reward_fun(self.example.xhist)