jppbsi/LibOPT

Optimization for integer or binary variables

bhamadicharef opened this issue · 4 comments

For many problems one needs to optimize vectors or integers (from N1 to N2). I tried with many methods by casting the variables to integer e.g. (int) a->x[0]; for the objective function but using GA for example most value end-up becoming close to zero ... any suggestions ? For binaries variables I would try variables from 0.0 to 1.0 and taking 0.5 as threshold for 0 or 1.

Did you try to use round instead of casting?

You could also use a transfer function to map your real-valued variable to a closed interval, such as [0, 1], and then thresholding it with 0.5.

For example, the sigmoid function almost grapples the full transition between 0 and 1 when -6 < x < 6. That should give you a larger interval than using variables directly between 0 and 1.

Will try your suggestions, thanks.

Thanks. Let us know, please. Best.