Example #1
0
int rp_operator_newton::reduce(rp_box b)
{
  bool proof = true;

  for (int i=0; i<_arity; ++i)
  {
    int v = _v[i];
    rp_interval aux, save;

    rp_interval_add(aux,rp_ivector_elem(_unknown,i),rp_box_elem(_midpoint,v));
    rp_interval_copy(save,rp_box_elem(b,v));

    if (!(rp_interval_strictly_included(aux,save))) proof = false;

    rp_interval_inter(rp_box_elem(b,v),save,aux);

    if (rp_interval_empty(rp_box_elem(b,v)))
    {
      return( 0 );
    }
  }

  if (proof) rp_box_set_safe(b);

  return( 1 );
}
Example #2
0
/* Returns true if no point of b is solution of c */
int rp_ctr_numeq_unfeasible(rp_ctr_num c, rp_box b)
{
  int res;
  if ((!rp_expression_eval(rp_ctr_num_left(c),b)) ||
      (!rp_expression_eval(rp_ctr_num_right(c),b)))
  {
    /* at least one expression has an empty range over b */
    res = 1;
  }
  else
  {
    /* unfeasible if empty intersection */
    rp_interval i;
    rp_interval_inter(i,rp_expression_val(rp_ctr_num_left(c)),
                        rp_expression_val(rp_ctr_num_right(c)));
    res = rp_interval_empty(i);
  }
  return( res );
}