예제 #1
0
/**
   \brief return the complement of variables that are currently assigned.
*/
void theory_wmaxsat::get_assignment(svector<bool>& result) {
    result.reset();
    
    if (!m_found_optimal) {
        for (unsigned i = 0; i < m_vars.size(); ++i) {
            result.push_back(false);
        }
    }
    else {
        std::sort(m_cost_save.begin(), m_cost_save.end());
        for (unsigned i = 0,j = 0; i < m_vars.size(); ++i) {
            if (j < m_cost_save.size() && m_cost_save[j] == static_cast<theory_var>(i)) {
                result.push_back(false);
                ++j;
            }
            else {
                result.push_back(true);
            }
        }
    }
    TRACE("opt",
          tout << "cost save: ";
          for (unsigned i = 0; i < m_cost_save.size(); ++i) {
              tout << m_cost_save[i] << " ";
          }
          tout << "\nvars: ";
          for (unsigned i = 0; i < m_vars.size(); ++i) {
              tout << mk_pp(m_vars[i].get(), get_manager()) << " ";
          }
          tout << "\nassignment: ";
          for (unsigned i = 0; i < result.size(); ++i) {
              tout << result[i] << " ";
          }
          tout << "\n";);                  
예제 #2
0
 // return true if n contains a variable in the range [begin, end]
 bool operator()(expr * n, unsigned begin = 0, unsigned end = UINT_MAX) {
     m_contains   = false;
     m_window     = end - begin;
     m_todo.reset();
     m_cache.reset();
     m_todo.push_back(expr_delta_pair(n, begin));
     while (!m_todo.empty()) {
         expr_delta_pair e = m_todo.back();
         if (visit_children(e.m_node, e.m_delta)) {
             m_cache.insert(e);
             m_todo.pop_back();
         }
         if (m_contains) {
             return true;
         }
     }
     SASSERT(!m_contains);
     return false;
 }
예제 #3
0
 virtual void prepare(cmd_context & ctx) { m_cmds.reset(); }
예제 #4
0
 virtual void prepare(cmd_context & ctx) {
     m_arg_idx = 0; 
     m_query_arg_idx = 0; 
     m_domain = 0;
     m_kinds.reset();
 }
예제 #5
0
 void prepare(cmd_context & ctx) override { m_cmds.reset(); }