Exemple #1
0
  //select bisection ratio for interval
double box::get_bisection_ratio(int i) const {
  if (is_time_variable(i) && m_values[i].contains(0.0)) {
    DREAL_LOG_DEBUG << "Splitting time variable";
    return 0.0001;
  } else {
    return 0.5;
  }
}
Exemple #2
0
void rp_splitter_time::apply(rp_box_set& bs, int var) {
  rp_interval i1, i2;
  rp_box b1 = bs.remove_insert();
  this->observe(b1, var);
  rp_box b2 = bs.insert(b1);

  if (quick_split_vars[&b1] == NULL){
    quick_split_vars[&b1] = new std::set<int>();
  }
  quick_split_vars[&b2] = new std::set<int>(*quick_split_vars[&b1]);

  if (is_time_variable(var) && !did_quick_split(&b1, var)){
    if (this->real_hole(rp_box_elem(b1, var),
                        rp_variable_domain(rp_problem_var(*_problem, var)),
                        i1, i2)){
      rp_interval_copy(rp_box_elem(b1, var), i1);
      rp_interval_copy(rp_box_elem(b2, var), i2);
    } else {
      // std::cout << "TIME SPLIT" << std::endl;
      rp_interval &vi = rp_box_elem(b1, var);
      double split =  std::min(rp_binf(vi) + precision, rp_split_point(rp_binf(vi), rp_bsup(vi), 1000, 1));

      // Real variable: [a,b] --> [center,b] and [a,center]
      rp_binf(rp_box_elem(b1, var)) =
        rp_bsup(rp_box_elem(b2, var)) =
        split;

      quick_split_vars[&b1]->insert(var);
      quick_split_vars[&b2]->insert(var);
        // rp_interval_midpoint(rp_box_elem(b1,var));
    }
  } else if (rp_variable_integer(rp_problem_var(*_problem, var))){
    if (this->integer_hole(rp_box_elem(b1, var),
                           rp_variable_domain(rp_problem_var(*_problem, var)),
                           i1, i2)) {
      rp_interval_copy(rp_box_elem(b1, var), i1);
      rp_interval_copy(rp_box_elem(b2, var), i2);
    } else { // no hole found
      // Integer variable: [a,b] --> [a+1,b] and [a,a]
      ++rp_binf(rp_box_elem(b1, var));
      rp_bsup(rp_box_elem(b2, var)) = rp_binf(rp_box_elem(b2, var));
    }
  } else {
    if (this->real_hole(rp_box_elem(b1, var),
                        rp_variable_domain(rp_problem_var(*_problem, var)),
                        i1, i2)) {
      rp_interval_copy(rp_box_elem(b1, var), i1);
      rp_interval_copy(rp_box_elem(b2, var), i2);
    } else {
      // Real variable: [a,b] --> [center,b] and [a,center]
      rp_binf(rp_box_elem(b1, var)) =
        rp_bsup(rp_box_elem(b2, var)) =
          rp_interval_midpoint(rp_box_elem(b1, var));
    }
  }
}