Optimization - 2 ratios which should sum to 1

I have the following statement to optimize my multiplier parameters:

ratio_1 = Optimize("ratio_1",1,0,1,0.1);
ratio_2 = Optimize("ratio_2",1,0,1,0.1);

Is there any way I can make script use two fractions of 1, rather than these <0,1> range ratios? I mean I would like to have 0.1 and 0.9 or 0.7 and 0.3 etc. The way ratios are optimized at the moment, I can get ratios which don't sum up to 1, for example 0.7 and 0.8, which also could be duplicates, for example 0.2 and 0.2 vs 0.5 and 0.5 and this is another thing I wouldn't want.

Maybe using exclude ? http://www.amibroker.com/kb/2015/02/05/using-exclude-statement-to-skip-unwanted-optimization-steps/

or maybe

ratio_1 = Optimize("ratio_1",1,0,1,0.1);
ratio_2 = abs(1 - ratio_1);
2 Likes

Many thanks, exactly what I needed!

Example from my post was a simplification, I use 4 ratios and in the end the statement is:

Exclude = ratio_1 + ratio_2 + ratio_3 + ratio_4 !=1;