示例#1
0
def generate_formulas():
    formulas = formula.Formulas()
    formu0 = formula.Formula(
        [[[0, 0]], [500]], formula.POLYHEDRON)
    # [[[-571, 31]], [445]], formula.POLYHEDRON)
    # [[[0, 0]], [500]], formula.POLYHEDRON)
    formulas.put(formu0.get_category(), formu0)
    # formulas.put([[[12,0],[-12,0]],[4,4]])

    formu1 = formula.Formula(
        [[[500, 0]], [100]], formula.POLYHEDRON)
    formulas.put(formu1.get_category(), formu1)
    return formulas
示例#2
0
def generate_specific_formula():
    formulas = formula.Formulas()
    formu = formula.Formula(
        # [[[-2, 60], [163, -899]], [485, 430]], formula.POLYHEDRON)
        # [[[-700, -700], [700, 700]], [300, 300]], formula.POLYHEDRON)
        [[[0, 0]], [500]],
        formula.POLYHEDRON)
    # [[[-571, 31]], [445]], formula.POLYHEDRON)
    # [[[0, 0]], [500]], formula.POLYHEDRON)
    formulas.put(formu.get_category(), formu)
    # formulas.put([[[12,0],[-12,0]],[4,4]])

    return formulas
def generate_polynomial(category, dimension):
    # TODO variable number is up to 10
    y = random.randint(-10, 10)
    variableNumber = dimension
    coefficientList = []
    for i in range(variableNumber):
        powerNumber = random.randint(1, 4)

        tmpList = []
        for j in range(powerNumber):
            tmpList.append(random.randint(-5, 5))
        coefficientList.append(tmpList)
    coefficientList.append(y)

    form = formula.Formula(coefficientList, category)
    return form
def generate_polyhedron(category, num_of_dimension):
    # generate center point and radius and number of circles
    num_of_center = random.randint(1, 5)
    centers = []
    radius_list = []
    for i in range(num_of_center):
        center = []
        for j in range(num_of_dimension):
            center_coordinate = random.randint(-1000, 1000)
            center.append(center_coordinate)
        radius = random.randint(100, 500)
        centers.append(center)
        radius_list.append(radius)
    formula_ = [centers, radius_list]

    form = formula.Formula(formula_, category)
    return form
def generate_specific_formula():
    formula_list = formula.Formulas()
    formu = formula.Formula(
        # [[[-2, 60], [163, -899]], [485, 430]], formula.POLYHEDRON)
        # [[[-700, -700], [700, 700], [-700, 700], [700, -700]], [300, 300, 300, 300]], formula.POLYHEDRON)
        # [[[-271, 95], [597, -840]], [423, 446]], formula.POLYHEDRON)
        [[[-430, 783], [100, 924], [-965, 489]], [485, 436, 435]],
        formula.POLYHEDRON)
    # [[[541, 133, -249, 364, 961], [-283, -165, -430, -849, -136]], [444, 429]], formula.POLYHEDRON)
    # [[-2, 0, -4, 1], [-5, 3, 4], [5, -2, 5], [-4, 5, -5], [1, -3, -3, 1], [1, -4], [-5, 5, 0, -2], [2, 4, -3, -5], [-4, 5, 5, -2], [1, 3, -3], [-1, 0], [-5], [-2, 2, 3], [3], [-5, 1], [-5, -3, -3, -2], [-1], [4, 3, -1, -4], [-2, 0, 2, -4], [1, 4, 0, 4], [-1, 5], [-1], [-1], [-4, -2, -4], [-1], [2], [4, 1, 1], [1, -4, 3, 0], [5, 0], [-3], [-5], [1], [4, 5], [-3], [-1, 0], [0, 1], [3, 4], [-2, 0, 2], [5, 5], [2, 0, -3], [1], [3, -1, 2, -4], [-1, 3, -2], [1, 3, 3], [-2, -2, -3, 2], [-3], [0, -5, -5], [3, -4], [-4, -3, 5, -1], [1, 2, 5], [-1, 0], [-1, 0, 4], [4, 5, -5], [3, 0, 0, -4], [-4, 4, 5, 5], [-1, -3, 5, 4], [-1, 4, 4, 0], [-2, -5, 5, -1], [1], [-1, -3], [3, 5, 3, -4], [0, -4, 3], [4], [-1, -3, -4], [-1, 1, -1, 4], [-3], [3, 0], [2], [-2, -4], [-2, 5, 5], [4, 4, 5], [-1, 0], [4, 3], [3, 1], [-1, 4, -4], [1, 4, -1], [-2, 4, -3], [4, 5, 2], [1, 2, -1, -5], [-5, 3, -5], [1, -4], [-3], [-3, 2], [1, -3, 0, 4], [5, 1], [0, -4, 0, 5], [-2, 0], [3, -5, 3, -2], [4, 4, 2], [-3, 4], [3], [0, 5], [-2], [2, 1, -5], [-1, 3, -1], [-4, 1], [-4, -3, 4], [3, 3, -3, 2], [-4], [-3, -1, 2], 8],formula.POLYNOMIAL)
    # [[5, -3, 5], [3], [-2], [-3, 4, -2], [3, -4], [-3, -5, -4], [-5], [1, 3], [-4, 3, -2], [1, 4, 1, 4], [-1, 0, -4], [-4, -5, -5], [4, -4, 1], [2, 1, 4, 4], [1, -4, 2, -1], [2, 1, 2], [4], [-3], [-5, 2, -3], [-5, 0], [0, -4], [4, 2], [0, -1, 3, 0], [3, 1], [4, -1, -4, 5], [-2, 5, 1], [0, -5], [2, 2, -4, 1], [-4], [-4, -4, 4, 0], [-3, -1, 3], [-2, 3], [-4, 1], [4], [5], [-3], [-1], [0, -4], [4, 0, 5], [-4, -5, -5, 5], [-2, 5], [-2, 4], [-3, 4], [5, 3, -1, 5], [4], [5, 0], [0, -3, 2, -5], [0, 5, 2, 1], [0, 3], [0, 5, 2], [3, -1, 2], [-2, 4, -3, 5], [-3, 1, -2], [-1, 5, -1, -1], [-3, 4, -2], [-1, -3], [-3, -2], [-2, -2], [4, -4, -3, -3], [5, -3, -3], [4, 4, 5, -1], [2, 4, -4], [1], [2], [4, 3], [5, 1], [-2, -3, -2], [0, 0, 5], [3, 5, 0, 2], [-4, -1, 0], [-4, -5], [-4, 0, 5], [-2, -4, -5, 3], [2, -3, -3], [1, -5, -2], [3], [-2], [5, -4, 0, 3], [3], [1, -3, -2], [4], [-3, 0, 0], [3, -4], [2, -3], [0, 2, 2], [-5, 3], [0, 1], [4, -2, 2], [-5, 1], [4, 1], [2, 4], [5], [-3, -4, -5, 3], [3, -3, 2], [2], [2, 2, -4, 4], [1], [1, -1], [4], [1, 3], 3],formula.POLYNOMIAL)
    # [[3, -5], [1, -3, 2], [-1], [1, 0], [5, -4, 3, 4], [5, -3, 1], [3], [5, -1, 1, -2], [-2, 2, -1, -5], [2, -2], [0], [3, -3], [-3, -1], [-2, 3], [-1], [-2], [-5, 1, -3], [0, 3], [-5, 5], [-4, -5, 3, 5], [-4], [2, 0, -1, -3], [4, -2], [4, 2, 0, -2], [1], [-1, 4, -1, 2], [-2, -2], [2], [-3], [2, -4, 5], [-3], [-1, -1, -3, 0], [-4, -4], [-3], [5, 2, 4], [3, 5, 1, -3], [-3, -5], [5, -5, 0], [-5, 2, 4], [-3, -3], [1], [5], [2, -3, 0, -2], [-2], [4, -1, 5, -5], [2, 2, 1], [4, 4], [0, 3, -5], [-4, 0, -3, -3], [-1], [5, -1, -1, -2], [5, 2, -5, 4], [-5, -3, -5, 4], [5, -2, 3, 4], [-5], [1, -4, 3, 5], [3, -3, -3], [-5, 1, -3], [-2, -1, 4], [0, 3], [4], [-2, -2, -1, -5], [-1, -3, -4], [-2, -3, 4, 3], [0], [-1], [-1], [-3, 1], [0, -3, -3, -2], [3, -3, 0, -3], [5, -5], [-4, -5, 2], [-1], [-4, 0, 1, -5], [2, 2, -5], [1, 5, 0, 3], [0, 2], [-4, 0, 0, -2], [2], [1, -2], [-1, -2, -3, 5], [1], [3], [-3, -2, 4, -5], [-2], [2], [3, 1], [3, 0, 5, 3], [5, -3, -1], [4, 3, 5], [2, 2, 0], [-4, -5, -1, 5], [0, 4, -1], [-1], [4, -3, -4], [2, 1, -5, 5], [4, 2, 0, 4], [1], [1, 0, -2], [2, -2, 5, -4], -8],formula.POLYNOMIAL)
    # [[[0, 0]], [500]], formula.POLYHEDRON)
    # [[[-571, 31]], [445]], formula.POLYHEDRON)
    # [[[0, 0]], [500]], formula.POLYHEDRON)
    formula_list.put(formu.get_category(), formu)
    # formulas.put([[[12,0],[-12,0]],[4,4]])

    return formula_list