Пример #1
0
tuple<int, box, box> box::bisect_int_at(int const i) const {
    assert(0 <= i && i < m_values.size());
    assert(!m_values[i].is_empty());
    assert(m_values[i].is_bisectable());
    box b1(*this);
    box b2(*this);
    ibex::Interval const iv = ibex::integer(b1.m_values[i]);
    double const lb = iv.lb();
    double const ub = iv.ub();
    double const mid = iv.mid();
    double const mid_floor = floor(mid);
    double const mid_ceil  = ceil(mid);
    if (!iv.is_bisectable()) {
        DREAL_LOG_FATAL << "NOT BISECTABLE = " << iv;
    }
    pair<ibex::Interval, ibex::Interval> new_intervals = iv.bisect();
    b1.m_values[i] = ibex::Interval(lb, mid_floor);
    b2.m_values[i] = ibex::Interval(mid_ceil, ub);
    b1.m_idx_last_branched = i;
    b2.m_idx_last_branched = i;
    DREAL_LOG_DEBUG << "box::bisect on " << (*m_vars)[i] << " : int = " << m_values[i]
                    << " into " << b1.m_values[i] << " and " << b2.m_values[i];
    return make_tuple(i, b1, b2);
}
Пример #2
0
Tube::Tube(const ibex::Interval &intv_t, unsigned int slices_number)
{
  if((slices_number == 0) || (slices_number & (slices_number - 1))) // decrement and compare
    cout << "Warning Tube::Tube(): slices number (" << slices_number << ") not a power of 2." << endl;

  m_intv_t = intv_t;
  m_intv_y = ibex::Interval::EMPTY_SET;
  m_slices_number = slices_number;

  if(slices_number == 1)
  {
    m_first_subtube = NULL;
    m_second_subtube = NULL;
  }

  else
  {
    pair<ibex::Interval,ibex::Interval> bisection = intv_t.bisect(0.5);
    m_first_subtube = new Tube(bisection.first, slices_number / 2);
    m_second_subtube = new Tube(bisection.second, slices_number / 2);
  }

  update();
}