0
$\begingroup$

Many optimization packages provide several ways to find solutions, one of which is the choice between binary search and search for real values.

I have a real binary search task, but the search algorithm that I want to apply can only work with real values

Can I just convert the output from the search algorithm to binary form with the usual rounding, for example R code

out_real_val <- runif(20,1,5)
> out_real_val
 [1] 4.258845 4.062256 4.318080 1.446091 1.696332 3.841191 2.379701 1.795424
 [9] 1.815174 3.017192 2.872621 4.239992 1.847689 2.986606 1.420673 3.995540
[17] 4.822753 2.358454 4.808910 3.152754

convert to

to_bin_val <- round(out_real_val,0)
> to_bin_val
 [1] 4 4 4 1 2 4 2 2 2 3 3 4 2 3 1 4 5 2 5 3

Can I apply rounding, or will the search no longer be as effective? or something else?

I want to know what is the difference between binary search and real value search, as well as whether it is possible to apply rounding as in my example

UPD======================

I am using the grammatical evolution package where each expression is a binary code enter image description here

The package has a built-in genetic search algorithm, but nothing prevents you from using other algorithms ... I would like to try other optimization algorithms to find the best expression, such as multiobjective optimization from the GPareto package. But this package (like many others) only works with real values

I can't explain it clearly, but I have such a feeling that binary search is different from searching for real values ..

I may be confused but: For example, if we have two vectors of real values and they are very similar to each other, then the fitness function will most likely show a similar result. But if we have two very similar binary vectors, then these can be completely different expressions and the fitness function can be very different

$\endgroup$
2
  • $\begingroup$ Can you give us some context? $\endgroup$ Aug 9, 2021 at 5:50
  • $\begingroup$ yes of course i have updated the question $\endgroup$
    – mr.T
    Aug 9, 2021 at 7:04

1 Answer 1

1
$\begingroup$

In essence you are asking for the differences between https://en.wikipedia.org/wiki/Discrete_optimization and https://en.wikipedia.org/wiki/Continuous_optimization. As an example, linear programming is an optimization algorithm which can be formulated both as discrete and continous, having the same exact algorithm but the difference is that discrete version works iteratively until it finds only discrete values.

The results can vary dramatically between the two methods, and you should ideally use discrete optimization if your problem requires it. You could, as a dirty approximation, use continuous optimization and then round the results, however this can give suboptimal or even unfeasible results.

If you want to try other optimization techniques not provided by the package you should look at packages offering discrete optimization methods. I would forget about multi-objective optimization, as that is on a whole other level of difficulty.

See https://cran.r-project.org/web/views/Optimization.html#:~:text=The%20R%20Optimization%20Infrastructure%20%28ROI%29%20package%20provides%20a,problem%20classes%20%28e.g.%2C%20linear%2C%20quadratic%2C%20non-linear%20programming%20problems%29. for a comprehensive list of packages.

$\endgroup$
2
  • $\begingroup$ Thanks for the answer, it was helpful to me .. One more question (you can add it in your answer) why do you recommend to forget about multiobjective optimization? $\endgroup$
    – mr.T
    Aug 10, 2021 at 6:56
  • $\begingroup$ @mr.T I would recommend to you (not in general) to forget about multi-objective optimization because it is hard - to optimize and interpret. So try solving this using single-objective optimization, if possible. $\endgroup$ Aug 10, 2021 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.