codac icon indicating copy to clipboard operation
codac copied to clipboard

Error in gates result of contraction by Lohner Contractor

Open bneveu opened this issue 3 years ago • 4 comments

Le contracteur CtcLohner perd les portes initiales et finales ponctuelles du premier tube d'un tube vector de dimension 2 (BVP) pendant la contraction. la porte initiale [1,1] devient [-92.35, 94.85] la porte finale [0,0] devient [-93.6, 93.6]

code


#include #include #include "codac.h" #include "ibex.h"

using namespace std; using namespace ibex; using namespace codac;

int main(){

IntervalVector bounds (2);

bounds[0]=Interval(-100,100);
bounds[1]=Interval(-100,100);

Interval domain(0.,1);

TubeVector x(domain,0.5,bounds);
Function f("x1", "x2" ,"(x2;x1)");

IntervalVector v(2);
v[0]=Interval(1.,1.);
v[1]=Interval(-100,100);

x.set(v, 0.); // ini

v[0]=Interval(0.,0.);
v[1]=Interval(-100,100);
x.set(v, 1.); // ini
cout << " x avant " << x << endl;

CtcLohner ctclohner(f);
cout << " x before Lohner " << x << endl;
for (int k=0; k< x.size(); k++){

 const Slice *slice = x[k].first_slice();
 while(slice != NULL){
  cout << " slice " << k << *slice << endl;
  slice = slice->next_slice();
 }

} ctclohner.contract(x); cout << " x after Lohner " << x << endl; for (int k=0; k< x.size(); k++){

 const Slice *slice = x[k].first_slice();
 while(slice != NULL){
   cout << " slice " << k << *slice << endl;
   slice = slice->next_slice();
 }

} cout << " x " << x << endl; return 0; }


voici les résultats x avant TubeVector (dim 2) [0, 1]↦([-100, 100] ; [-100, 100]), 2 slices x before Lohner TubeVector (dim 2) [0, 1]↦([-100, 100] ; [-100, 100]), 2 slices slice 0Slice [0, 0.5]↦([1, 1])[-100, 100]([-100, 100]) slice 0Slice [0.5, 1]↦([-100, 100])[-100, 100]([0, 0]) slice 1Slice [0, 0.5]↦([-100, 100])[-100, 100]([-100, 100]) slice 1Slice [0.5, 1]↦([-100, 100])[-100, 100]([-100, 100]) x after Lohner TubeVector (dim 2) [0, 1]↦([-93.6, 94.85] ; [-100, 100]), 2 slices slice 0Slice [0, 0.5]↦([-92.35, 94.85])[-92.35, 94.85]([-92.35, 93.6]) slice 0Slice [0.5, 1]↦([-92.35, 93.6])[-93.6, 93.6]([-93.6, 93.6]) slice 1Slice [0, 0.5]↦([-100, 100])[-100, 100]([-100, 100]) slice 1Slice [0.5, 1]↦([-100, 100])[-100, 100]([-100, 100]) x TubeVector (dim 2) [0, 1]↦([-93.6, 94.85] ; [-100, 100]), 2 slices

bneveu avatar Mar 23 '22 10:03 bneveu

This should correct the bug: 044535fcf63c5bb506ef63458d2c50a960b1ff46

I add @AugusteBourgois (main developer of the Lohner) to this conversation.

SimonRohou avatar Mar 23 '22 14:03 SimonRohou

OK for this correction; I have now another problem where the solution of the BVP is lost when the Lohner Contractor is applied in a fixed-point loop. the firrst tube becomes empty. The code of the is the following :

int main(){

Interval domain(0.,1);

TubeVector x(domain,0.03125,2);
Function f("x1", "x2" ,"(x2;x1)");




IntervalVector v(2);
v[0]=Interval(1.,1.);
v[1]=Interval(-100,100);

x.set(v, 0.); // ini

v[0]=Interval(0.,0.);
v[1]=Interval(-100,100);
x.set(v, 1.); // ini
for (int i=0; i<10;i++){
  cout << " x avant " << x << endl;

 CtcLohner ctclohner(f);
 cout << " x before Lohner " << x << endl;
 for (int k=0; k< x.size(); k++){

  const Slice *slice = x[k].first_slice();
  while(slice != NULL){
  cout << " slice " << k << *slice << endl;
  slice = slice->next_slice();
   } 
 }
 ctclohner.contract(x);
 cout <<" i " << i << " x after Lohner " << x << endl;
 for (int k=0; k< x.size(); k++){

   const Slice *slice = x[k].first_slice();
   while(slice != NULL){
 cout << " slice " << k << *slice << endl;
 slice = slice->next_slice();
   }
 }
 
}
return 0;

}


results at the iteration 9 i 9 x after Lohner TubeVector (dim 2) [0, 1]↦([-3.60482, 0.0271986] ; [5.82926, 9.75906]), 32 slices slice 0Slice [0, 0.03125]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.03125, 0.0625]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.0625, 0.09375]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.09375, 0.125]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.125, 0.15625]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.15625, 0.1875]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.1875, 0.21875]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.21875, 0.25]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.25, 0.28125]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.28125, 0.3125]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.3125, 0.34375]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.34375, 0.375]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.375, 0.40625]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.40625, 0.4375]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.4375, 0.46875]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.46875, 0.5]↦([ empty ])[ empty ]([ empty ]) slice 0Slice [0.5, 0.53125]↦([ empty ])[-0.302171, -0.199592]([ empty ]) slice 0Slice [0.53125, 0.5625]↦([ empty ])[-1.25698, -0.338892]([-1.25698, -0.863086]) slice 0Slice [0.5625, 0.59375]↦([-1.25698, -0.863086])[-2.25302, -0.863086]([-2.25302, -1.13284]) slice 0Slice [0.59375, 0.625]↦([-2.25302, -1.13284])[-2.93505, -1.13284]([-2.93505, -1.13284]) slice 0Slice [0.625, 0.65625]↦([-2.93505, -1.13284])[-3.3586, -1.13169]([-3.3586, -1.13169]) slice 0Slice [0.65625, 0.6875]↦([-3.3586, -1.13169])[-3.53808, -0.954964]([-3.53808, -0.954964]) slice 0Slice [0.6875, 0.71875]↦([-3.53808, -0.954964])[-3.60482, -0.82612]([-3.24533, -0.82612]) slice 0Slice [0.71875, 0.75]↦([-3.24533, -0.82612])[-3.24533, -0.705014]([-2.88235, -0.705014]) slice 0Slice [0.75, 0.78125]↦([-2.88235, -0.705014])[-2.88235, -0.591248]([-2.51596, -0.591248]) slice 0Slice [0.78125, 0.8125]↦([-2.51596, -0.591248])[-2.51596, -0.484293]([-2.14636, -0.484293]) slice 0Slice [0.8125, 0.84375]↦([-2.14636, -0.484293])[-2.14636, -0.383486]([-1.77387, -0.383486]) slice 0Slice [0.84375, 0.875]↦([-1.77387, -0.383486])[-1.77387, -0.288028]([-1.39898, -0.288028]) slice 0Slice [0.875, 0.90625]↦([-1.39898, -0.288028])[-1.39898, -0.196996]([-1.01103, -0.196996]) slice 0Slice [0.90625, 0.9375]↦([-1.01103, -0.196996])[-1.01103, -0.12059]([-0.625276, -0.12059]) slice 0Slice [0.9375, 0.96875]↦([-0.625276, -0.12059])[-0.625276, -0.0618176]([-0.299184, -0.0618176]) slice 0Slice [0.96875, 1]↦([-0.299184, -0.0618176])[-0.299184, 0.0271986]([0, 0])


the solution of this problem is found using capd in the solver

nb sol 1 TubeVector (dim 2) [0, 1]↦([-5.18293e-20, 1] ; [-1.31807, -0.850177]), 40000 slices ti-> ([1, 1] ; [-1.31807, -1.31189]) tf -> ([0, 0] ; [-0.858027, -0.850177]) max diam : 1, 0.467892 volume : 1.46789 ti (diam) -> (0 ; 0.00617769) tf (diam) -> (0 ; 0.00784996)

bneveu avatar Mar 24 '22 10:03 bneveu

Does this problem appears before 044535fcf63c5bb506ef63458d2c50a960b1ff46? Or this commit was already necessary for allowing propagations in your solver?

SimonRohou avatar Mar 24 '22 10:03 SimonRohou

Without this commit, the problem does not appear, but the propagation stops after a few steps and does not reach the solution, the initial and final gates have been enlarged.

bneveu avatar Mar 24 '22 10:03 bneveu