MRS  1.0
A C++ Class Library for Statistical Set Processing
subpavings::BooleanValueImageExpanderEstimator Class Reference
+ Inheritance diagram for subpavings::BooleanValueImageExpanderEstimator:
+ Collaboration diagram for subpavings::BooleanValueImageExpanderEstimator:

List of all members.

Public Member Functions

 BooleanValueImageExpanderEstimator (const MappedFobj &f, const cxsc::interval &crit, cxsc::real tol)
 Constructor.
BooleanMappedValue visit (SPnode *spn) const
 The visit operation.

Constructor & Destructor Documentation

subpavings::BooleanValueImageExpanderEstimator::BooleanValueImageExpanderEstimator ( const MappedFobj f,
const cxsc::interval &  crit,
cxsc::real  tol 
)

Constructor.

Parameters:
fdescribes a function to be estimated.
toldescribes the tolerance to be used in making the estimate.
Precondition:
tol >= cxsc::MinReal.
                : fobj(f), supCriterion(Sup(crit)), infCriterion(Inf(crit)),
          tolerance(tol) 
  {
    if (tolerance < cxsc::MinReal) 
      throw std::invalid_argument(
        "BooleanValueImageExpanderEstimator::BooleanValueImageExpanderEstimator(MappedFobj&, cxsc::real) : tol < cxsc::MinReal");
  }

Member Function Documentation

The visit operation.

Checks whether the interval image under the function whose boolean image is to be estimated of the box of spn is contained in, overlaps with, or is completely outside the interval criterion of this.

If the image is outside, returns false; If the image is inside, returns true; If the image is not completely inside or outside but the maximum width of the box of spn is < the tolerance of this, returns true; Else (the image is not completely inside or outside and the maximum width of the box of spn is >= the tolerance of this), splits spn and returns true.

Parameters:
spna pointer to an SPnode to be visited.
Returns:
BooleanMappedValue(true) if there is some overlap between the interval image under the function whose boolean image is to be estimated of the box of spn and the criterion interval of this.
Postcondition:
spn will have been expanded if the return value is BooleanMappedValue(true) and the maximum width of the box of spn is >= the tolerance of this.

Implements subpavings::SPExpandVisitor< BooleanMappedValue >.

    {
    #ifdef MYDEBUG
      std::cout << "in BooleanValueImageExpanderEstimator::visit, for " << spn->getNodeName() << std::endl;
    #endif
    
        // check if we need to split
        ivector box = spn->getBox();
    
    #ifdef MYDEBUG
      std::cout << "this box is " << box << std::endl;
        #endif
    
    #ifdef MYDEBUG
      std::cout << "this tolerance is " << tolerance << std::endl;
    #endif
    
    interval thisRange = fobj(box);
    
    #ifdef MYDEBUG
      std::cout << "this range is " << thisRange << std::endl;
    #endif
    
    
    bool retValue = false;
    
    if ( !(Sup(thisRange) < infCriterion) 
            && !(Inf(thisRange) > supCriterion) ) { // overlap
      retValue = true;
      #ifdef MYDEBUG_MIN
        std::cout << "overlap, returning true" << std::endl;
      
      #endif
      
      if ( (Sup(thisRange) > supCriterion) 
        || (Inf(thisRange) < infCriterion) ) { //indet
        
        int maxdiamcomp;
        double maxDiam = MaxDiam (box, maxdiamcomp);
        // check if box max width is < tolerance, expand if not
        if (!(maxDiam < tolerance)) {
          spn->nodeExpand();
          #ifdef MYDEBUG_MIN
            std::cout << "and max width >= tolerance " << std::endl;
          
          #endif
        }
        
      }
      // else thisRange is inside criterion       
    }
    
    
    return BooleanMappedValue(retValue);
    }

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends