def testPeriodic(self): #first decide whether the transpositions compose to an element of G netTrans = self.netTransposition() if not self.system.invariant(netTrans): return False #next compose the time map with the preserving permutation Fmap = AffineMap.compose(netTrans.mapRepresentation(), self.map) #construct the set of constraints for fixed point A1 = add(Fmap.A, -1.0 * AffineMap.identity(self.system.dim).A) A2 = add(AffineMap.identity(self.system.dim).A, -1 * Fmap.A) b2 = Fmap.b b1 = -1.0 * b2 A = concatenate((A1,A2)) b = concatenate((b1,b2)) cs = ConvexSet(A,b) FixedPoints = cs.intersect(cs, self.set()) #test feasibility solution = cvxSolver.solve(FixedPoints) return (solution['status']=='optimal')
def deserialize(representation): sequence = [] for p in representation["sequence"]: sequence.append(Permutation.deserialize(p)) newWord = Word(sequence) newWord.flips = representation["flips"] newWord.feasible = representation["feasible"] newWord.map = AffineMap.deserialize(representation["map"]) newWord.set = ConvexSet.deserialize(representation["set"]) return newWord
def testStrictPeriodic(self, word): #first decide whether the transpositions compose to identity netTrans = word.netTransposition() if not netTrans.isIdentity(): return False #next, obtain the full poincare map Fmap = word.map #construct the set of constraints for fixed point A1 = add(Fmap.A, -1.0 * AffineMap.identity(self.system.dim).A) A2 = add(AffineMap.identity(self.system.dim).A, -1 * Fmap.A) b2 = Fmap.b b1 = -1.0 * b2 A = concatenate((A1, A2)) b = concatenate((b1, b2)) cs = ConvexSet(A, b) FixedPoints = cs.intersect(cs, word.set()) #test feasibility solution = cvxSolver.solve(FixedPoints) return (solution['status']=='optimal')