def makeFMapReport(self):

        dict = {}
        dict["regions"] = []

        crossSections = []
        for word in self.words:

            #if word.isFPrimitive():
            if len(word.sequence) == 4:

                #new logic
                crossSection = word.set.standardCrossSection([0,'?','?',.4,.6])
                #crossSection = word.set.standardCrossSection([0,0.25,0.75,'?','?'])

                solution = cvxSolver.solve(crossSection)
                if solution["status"] == "optimal":
                    #somehow compute vertices of the set in 2d
                    #vertices = LocalReportBuilder.computeVertices(tempSet)
                    cxName = ""
                    for event in word.flips:
                        cxName += str(event)
                    cxName = cxName.replace(" ", "")
                    cxName = cxName.replace("/", "")
                    cxName = cxName.replace("[", "")
                    cxName = cxName.replace("]", "")
                    cxName = cxName.replace(",", "")
                    cxName = cxName.replace("'", "")


                    #crossSection.writeIne(cxName, "./data/" + cxName + ".ine")
                    #crossSection.writeVertices("./data/" + cxName + ".ver")
                    dict["regions"].append(crossSection.getDict(cxName))
                    print "vertices: "
                    print crossSection.getVertices()
                    temp = {}
                    temp["crossSection"] = crossSection
                    temp["eventLog"] = word.eventLog
                    temp["initialP"] = word.sequence[0].permutation
                    crossSections.append(temp)
        print ("Report on F map regions")
        print len(crossSections)
        for piece in crossSections:
            print piece["initialP"]
            print piece["eventLog"]

        f = open("data/fMap.js", "w")
        f.write("jsonObject = ")
        f.write(json.dumps(dict))
        f.close()
 def testPeriodic(self, word):
     #first decide whether the transpositions compose to an element of G
     netTrans = word.netTransposition()
     if not self.system.invariant(netTrans):
         return False
     #next compose the time map with the preserving permutation
     Fmap = AffineMap.compose(netTrans.mapRepresentation(), 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')
 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')