10#ifndef __IBEX_SEP_PROJ_H__
11#define __IBEX_SEP_PROJ_H__
14#include <ibex_IntervalVector.h>
17#include <ibex_LargestFirst.h>
22using ibex::IntervalVector;
25using ibex::LargestFirst;
29typedef std::pair<IntervalVector, IntervalVector> TwoItv;
31typedef struct ImpactStatus_{
34 IntervalVector *first_cin_boxes, *first_cout_boxes;
37 ImpactStatus_ () : impact_cin(false), impact_cout(false),
38 first_cin_boxes(NULL), first_cout_boxes(NULL){
43 ImpactStatus_(IntervalVector& x_in, IntervalVector& x_out):
44 impact_cin(false), impact_cout(false),
45 first_cin_boxes(NULL), first_cout_boxes(NULL){
48 if( !( x_in == x_out) ){
49 IntervalVector x0(x_in | x_out);
50 setCinFlags(x_in, x0);
51 setCoutFlags(x_out, x0);
84 if (first_cin_boxes != NULL)
delete[] first_cin_boxes;
85 if (first_cout_boxes != NULL)
delete[] first_cout_boxes;
86 first_cin_boxes = NULL;
87 first_cout_boxes = NULL;
93 void setCinFlags(IntervalVector& x_in, IntervalVector& x0){
97 n_in = x0.diff(x_in,first_cin_boxes);
102 void setCoutFlags(IntervalVector& x_out, IntervalVector& x0){
104 if ( !(x_out == x0)){
106 n_out = x0.diff(x_out,first_cout_boxes);
111 void reset_and_setCoutFlags(IntervalVector& x_out, IntervalVector& x0){
113 if (first_cout_boxes != NULL){
114 delete[] first_cout_boxes;
115 first_cout_boxes = NULL;
117 setCoutFlags(x_out, x0);
120 void reconstrut_v2(IntervalVector &x_in, IntervalVector& x_out, IntervalVector& x_old){
123 if (x_out.is_empty() && impact_cout && impact_cin){
127 if (!x_in.is_empty() && !x_out.is_empty()){
128 if (impact_cin ==
true){
129 if (impact_cout ==
false){
132 for(
int i = 0; i < n_in; i++){
133 x_out |= first_cin_boxes[i];
137 if(impact_cout ==
true){
138 if(impact_cin ==
false){
141 for(
int i = 0; i < n_out; i++){
142 x_in |= first_cout_boxes[i];
146 }
else if (x_in.is_empty() && impact_cin ==
true){
147 if(impact_cout ==
false){
150 for(
int i = 0; i < n_in; i++){
151 x_out |= first_cin_boxes[i];
154 }
else if (x_out.is_empty() && impact_cout ==
true){
155 if(impact_cin ==
false){
158 for(
int i = 0; i < n_out; i++){
159 x_in |= first_cout_boxes[i];
163 std::cout <<
"#########################################################\n";
164 std::cout <<
"x_in " << x_in <<
" x_out " << x_out <<
"\n";
165 std::cout <<
"x_old " << x_old <<
"n_in " << n_in <<
" n_out " << n_out;
166 std::cout <<
" impact_cin " << impact_cin <<
" ";
167 std::cout <<
" impact_cout " << impact_cout <<
" ";
169 std::cout <<
"#########################################################\n";
175 void reconstrut(IntervalVector &x_in, IntervalVector& x_out, IntervalVector& x_old){
176 IntervalVector x = x_in & x_out;
177 IntervalVector *rest;
179 if (x == x_old)
return;
180 if (impact_cin ==
true && impact_cout ==
false){
183 }
else if (impact_cin ==
false && impact_cout ==
true){
186 }
else if (impact_cin ==
true && impact_cout ==
true){
187 int n = x_old.diff(x, rest);
198 std::cerr << n_in <<
" " << n_out <<
" " << n <<
"\n";
202 for (
int i = 0; i < n; i++){
203 for(
int j = 0; j < n_in; j++){
204 if(first_cin_boxes[j].intersects(rest[i])){
209 for(
int j = 0; j < n_out; j++){
210 if(first_cout_boxes[j].intersects(rest[i])){
285 void separate(IntervalVector &x_in, IntervalVector &x_out);
301 bool process(IntervalVector &x_in, IntervalVector &x_out, IntervalVector &y, ImpactStatus &impact,
bool use_point);
304 bool separate_fixPoint(IntervalVector& x_in, IntervalVector& x_out, IntervalVector &y);
352 bool fixpoint(IntervalVector &x, IntervalVector &x_out_res, IntervalVector &y);
Projection of a separator.
Definition codac_SepProj.h:245
void separate(IntervalVector &x_in, IntervalVector &x_out)
Separate method.
IntervalVector y_init
Initial box of the parameters (can be set dynamically)
Definition codac_SepProj.h:315
Sep & sep
The Separator.
Definition codac_SepProj.h:309
bool process(IntervalVector &x_in, IntervalVector &x_out, IntervalVector &y, ImpactStatus &impact, bool use_point)
SepProj::process Separate cartesian product [x_in].[y] and [x_out].[y] if an inner (or outer) contrac...
SepProj(Sep &sep, const Interval &y_init, double prec)
Construct a new Sep Proj object.
SepProj(Sep &sep, const IntervalVector &y_init, double prec)
Construct a new Sep Proj object.
~SepProj()
Destroy the Sep Proj object.
double prec
precision
Definition codac_SepProj.h:320
LargestFirst * bsc
internal variable used to count the number of call of the SepProj::process method
Definition codac_SepProj.h:343
FixPoint of a separator The fixpoint of a separator is computed by calling the "::"separate function ...
Definition codac_capd_helpers.h:9