Skip to content

is_integer_variable is not working for find_min_global. #1947

@thummarprashant42

Description

@thummarprashant42

For dlib.find_min_global argument is_integer_variable is not give the optimum parameter.
I tried my function with Floating variables and this work Super.
But with is_integer_variable = True, it seems not working or have bug.
Here I tried with small function.

import dlib
import numpy as np

def funcToOptimize(*args):
    return np.sum(np.square(np.array(args)))

LB = [0 for i in range(10)]
UB = [65000 for i in range(10)]

x_opt, y_opt = dlib.find_min_global(funcToOptimize, LB, UB, 100) #First Option with Floating variables and max_function_calls=100
print(x_opt, y_opt)

Output : [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]  0.0 # almost Zero

IsInteger = [True for i in range(10)]
x_opt, y_opt = dlib.find_min_global(funcToOptimize, LB, UB, IsInteger, 300) #Second Option with Integer variables and max_function_calls=300
print(x_opt, y_opt)

Output : [510.0, 90.0, 46.0, 4318.0, 3745.0, 2197.0, 11329.0, 646.0, 9873.0, 9572.0]  355630144.0

x_opt, y_opt = dlib.find_min_global(funcToOptimize, LB, UB, IsInteger, 400) #Third Option with Integer variables and max_function_calls=400
print(x_opt, y_opt)

Output : [510.0, 90.0, 46.0, 4318.0, 3745.0, 2197.0, 11329.0, 646.0, 9873.0, 9572.0]  355630144.0

So you can see when I call the Function with floating variables 100 times. It work and give the optimal parameters.
And also you can see when I call the Function with Integer variables 300 and 400 times. But it holds the value of parameters and gives the same Output. I expect it to be nearly Zero.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions