gugarosa / opytimizer

🐦 Opytimizer is a Python library consisting of meta-heuristic optimization algorithms.
https://opytimizer.readthedocs.io
Apache License 2.0
599 stars 40 forks source link

[REG] What is the difference between grid space, and discrete space example? #29

Closed TamerAbdelmigid closed 2 years ago

TamerAbdelmigid commented 2 years ago

Greetings,

I have a mixed search space problem of five dimensions, 4 discrete and one continuous. how to implement a discrete search space, with these dimensions where the increment won't be the same. I found that grid space offer me the flexibility I need, yet I noticed you used a different implementation in discrete space example so which one should I use?

My search space:

step = [1, 1, 1, 1, 0.1]
lower_bound = [16, 3, 2, 0, 0]
upper_bound = [400, 20, 20, 1, 0.33]

Thanks in advance.

TamerAbdelmigid commented 2 years ago

I used this:

step = [1, 1, 1, 1, 1]
lower_bound = [16, 3, 2, 0, 0]
upper_bound = [400, 20, 20, 1, 33]

and divided by a hundred in my function. Sorry for the silly question.

gugarosa commented 2 years ago

Hello @TamerAbdelmigid! I hope everything is going well with you.

There is no such thing as a silly question, no worries. Essentially, the difference between Grid Search and Discrete Search is that while Grid Search will explore all the combinations between decision variables and their step increments, the Discrete Search is mainly a callback that can be used with a meta-heuristic technique.

Imagine that you want to perform an optimization over your variables but without at the expense of their fully combination; this is where Discrete Search comes in hand. You can define a set of values that are allowed in your Search Space (for example, integer values for the 1st decision variable, float values with increments of 0.1 for the 2nd decision variable, and so on) and let the meta-heuristic conduct the search for you. The advantage is to use a better-guided search algorithm than relying on the standard combinatorial approach.

Hope that clears somethings out!

Best regards, Gustavo.

TamerAbdelmigid commented 2 years ago

Hello @gugarosa, thank you for your response, it made it clear now. greatly appreciate it.