Constraint : a function image is in an intervall

Hi,
I need an answer to a simple question.
I need to define constraints such as f(x) in [a,b].
Must I separe it into two different constraints f(x)>=a and f(x)<=b ?
Does Ibex consider it to be the same as f(x)=[a,b] ? Even though it is mathematically different, Ibex seems to do the same (considering lots of tests I made).
Thanks !

Hi Etienne,

Indeed, you don't need to separate f(x) in [a,b] into two constraints f(x)>=a and f(x)<=b because Ibex accepts interval constants in expression. So f(x)=[a,b] is correct. You can even directly use the CtcIn contractor instead of CtcFwdBwd. Here are the two variants:

With CtcFwdBwd:

Variable x;
Function f(x,x); // identity
NumConstraint c(x,f(x)=Interval(1,2));
CtcFwdBwd ctc(c);

IntervalVector box(1);
cout << "before contraction: " << box << endl;
ctc.contract(box);
cout << "after contraction: " << box << endl;

With CtcIn:

Variable x;
Function f(x,x); // identity

CtcIn ctc(f,Interval(1,2));

IntervalVector box(1);
cout << "before contraction: " << box << endl;
ctc.contract(box);
cout << "after contraction: " << box << endl;

 

In both cases the display is:

before contraction: ([-inf, inf])
after contraction: ([1, 2])
 

Gilles