コード例 #1
0
    def __init__(self,
                 a=1.0,
                 b=5.1 / (4.0 * np.pi**2),
                 c=5 / np.pi,
                 r=6.0,
                 s=10.0,
                 t=1 / (8 * np.pi)):
        assert isinstance(a, float)
        assert isinstance(b, float)
        assert isinstance(c, float)
        assert isinstance(r, float)
        assert isinstance(s, float)
        assert isinstance(t, float)

        dim_bx = 2
        bounds = np.array([
            [-5, 10],
            [0, 15],
        ])
        global_minimizers = np.array([
            [-np.pi, 12.275],
            [np.pi, 2.275],
            [9.42478, 2.475],
        ])
        global_minimum = 0.397887
        function = lambda bx: fun_target(bx, dim_bx, a, b, c, r, s, t)

        Function.__init__(self, dim_bx, bounds, global_minimizers,
                          global_minimum, function)
コード例 #2
0
    def __init__(self):
        dim_bx = 1
        bounds = np.array([
            [0.5, 2.5],
        ])
        global_minimizers = np.array([
            [0.54856405],
        ])
        global_minimum = -0.86901113
        function = lambda bx: fun_target(bx, dim_bx)

        Function.__init__(self, dim_bx, bounds, global_minimizers,
                          global_minimum, function)
コード例 #3
0
    def __init__(self):
        dim_bx = 2
        bounds = np.array([
            [-100.0, 100.0],
            [-100.0, 100.0],
        ])
        global_minimizers = np.array([
            [0.0, 0.0],
        ])
        global_minimum = 0.0
        function = lambda bx: fun_target(bx, dim_bx)

        Function.__init__(self, dim_bx, bounds, global_minimizers,
                          global_minimum, function)
コード例 #4
0
    def __init__(self):
        dim_bx = 2
        bounds = np.array([
            [-3.0, 3.0],
            [-2.0, 2.0],
        ])
        global_minimizers = np.array([
            [0.0898, -0.7126],
            [-0.0898, 0.7126],
        ])
        global_minimum = -1.0316
        function = lambda bx: fun_target(bx, dim_bx)

        Function.__init__(self, dim_bx, bounds, global_minimizers,
                          global_minimum, function)
コード例 #5
0
    def __init__(self,
        bounds=np.array([
            [-10, 10],
        ]),
        slope=1.0
    ):
        assert isinstance(slope, float)
        assert isinstance(bounds, np.ndarray)
        assert len(bounds.shape) == 2
        assert bounds.shape[0] == 1
        assert bounds.shape[1] == 2
        assert bounds[0, 0] < bounds[0, 1]

        dim_bx = bounds.shape[0]
        global_minimizers = np.array([
            [slope * bounds[0, 0]],
        ])
        global_minimum = slope * bounds[0, 0]
        function = lambda bx: fun_target(bx, dim_bx, slope)

        Function.__init__(self, dim_bx, bounds, global_minimizers, global_minimum, function)
コード例 #6
0
    def __init__(self,
                 bounds=np.array(
                     [
                         [-512.0, 512.0],
                         [-512.0, 512.0],
                     ])):
        assert isinstance(bounds, np.ndarray)
        assert len(bounds.shape) == 2
        assert bounds.shape[1] == 2

        dim_bx = 2
        assert bounds.shape[0] == dim_bx

        global_minimizers = np.array([
            [512.0, 404.2319],
        ])
        global_minimum = -959.64066
        function = lambda bx: fun_target(bx, dim_bx)

        Function.__init__(self, dim_bx, bounds, global_minimizers,
                          global_minimum, function)
コード例 #7
0
    def __init__(self, dim_problem):
        assert isinstance(dim_problem, int)

        dim_bx = np.inf
        bounds = np.array([
            [-2.048, 2.048],
        ])
        global_minimizers = np.array([
            [1.0],
        ])
        global_minimum = 0.0
        dim_problem = dim_problem

        function = lambda bx: fun_target(bx, dim_problem)

        Function.__init__(self,
                          dim_bx,
                          bounds,
                          global_minimizers,
                          global_minimum,
                          function,
                          dim_problem=dim_problem)
コード例 #8
0
    def __init__(self,
        steps=[-10., -5., 0., 5., 10.],
        step_values=[-2., 0., 1., -1.],
    ):
        assert isinstance(steps, list)
        assert isinstance(step_values, list)
        assert len(steps) == len(step_values) + 1
        assert isinstance(steps[0], float)
        assert isinstance(step_values[0], float)
        assert np.all(np.sort(steps) == np.asarray(steps))

        dim_bx = 1
        bounds = np.array([
            [np.min(steps), np.max(steps)],
        ])
        global_minimizers = np.array([
            [steps[np.argmin(step_values)]],
        ])
        global_minimum = np.min(step_values)
        function = lambda bx: fun_target(bx, dim_bx, steps, step_values)

        Function.__init__(self, dim_bx, bounds, global_minimizers, global_minimum, function)
コード例 #9
0
    def __init__(self,
                 bounds=np.array([
                     [0.0, 1.0],
                     [0.0, 1.0],
                     [0.0, 1.0],
                     [0.0, 1.0],
                     [0.0, 1.0],
                     [0.0, 1.0],
                 ])):
        assert isinstance(bounds, np.ndarray)
        assert len(bounds.shape) == 2
        assert bounds.shape[1] == 2

        dim_bx = 6
        assert bounds.shape[0] == dim_bx

        global_minimizers = np.array([
            [0.20169, 0.150011, 0.476874, 0.275332, 0.311652, 0.6573],
        ])
        global_minimum = -3.322368
        function = lambda bx: fun_target(bx, dim_bx)

        Function.__init__(self, dim_bx, bounds, global_minimizers,
                          global_minimum, function)
コード例 #10
0
    def __init__(self,
        bounds = np.array([
            [-10.0, 10.0],
        ]),
        constant=0.0
    ):
        assert isinstance(constant, float)
        assert isinstance(bounds, np.ndarray)
        assert len(bounds.shape) == 2
        assert bounds.shape[0] == 1
        assert bounds.shape[1] == 2
        assert bounds[0, 0] < bounds[0, 1]

        dim_bx = bounds.shape[0]
        min_bx = bounds[0, 0]
        max_bx = bounds[0, 1]
        global_minimizers = np.array([
            [min_bx],
            [max_bx],
        ])
        global_minimum = constant
        function = lambda bx: fun_target(bx, dim_bx, constant)

        Function.__init__(self, dim_bx, bounds, global_minimizers, global_minimum, function)