Ctc* DefaultSolver::ctc (System& sys, double prec) { Array<Ctc> ctc_list(4); // first contractor : non incremental hc4 ctc_list.set_ref(0, rec(new CtcHC4 (sys.ctrs,0.01))); // second contractor : acid (hc4) ctc_list.set_ref(1, rec(new CtcAcid (sys, rec(new CtcHC4 (sys.ctrs,0.1,true))))); int index=2; // if the system is a sqare system of equations, the third contractor is Newton System* eqs=get_square_eq_sys(sys); if (eqs) { ctc_list.set_ref(index,rec(new CtcNewton(eqs->f_ctrs,5e8,prec,1.e-4))); index++; } // the last contractor is XNewton // ctc_list.set_ref(index,*new CtcXNewtonIter(sys, // new CtcHC4 (sys.ctrs,0.01), //*(default_corners()))); System& norm_sys=rec(new NormalizedSystem(sys)); ctc_list.set_ref(index,rec(new CtcFixPoint(rec(new CtcCompo( rec(new CtcPolytopeHull(rec(new LinearizerCombo(norm_sys,LinearizerCombo::XNEWTON)))), rec(new CtcHC4 (sys.ctrs,0.01))))))); ctc_list.resize(index+1); // in case the system is not square. return new CtcCompo (ctc_list); }
contractor_ibex_polytope::contractor_ibex_polytope( double const prec, vector<Enode *> const & vars, vector<shared_ptr<nonlinear_constraint>> const & ctrs) : contractor_cell{contractor_kind::IBEX_POLYTOPE, extract_bitset(vars, ctrs)}, m_ctrs{ctrs}, m_prec{prec} { // Trivial Case if (m_ctrs.size() == 0) { return; } m_sf.reset(build_system_factory(vars, m_ctrs)); try { m_sys.reset(new ibex::System(*m_sf)); } catch (ibex::EmptySystemException & e) { DREAL_LOG_INFO << "contractor_ibex_polytope::contractor_ibex_polytope: empty ibex::system"; return; } unsigned index = 0; ibex::Array<ibex::Ctc> ctc_list(2); m_sys_eqs = square_eq_sys(*m_sys); if (m_sys_eqs) { DREAL_LOG_INFO << "contractor_ibex_polytope: SQUARE SYSTEM"; unique_ptr<ibex::CtcNewton> ctc_newton(new ibex::CtcNewton(m_sys_eqs->f)); ctc_list.set_ref(index++, *ctc_newton); m_sub_ctcs.push_back(move(ctc_newton)); } m_lrc.reset(new ibex::LinearRelaxCombo(*m_sys, ibex::LinearRelaxCombo::XNEWTON)); unique_ptr<ibex::CtcPolytopeHull> ctc_ph( new ibex::CtcPolytopeHull(*m_lrc, ibex::CtcPolytopeHull::ALL_BOX)); unique_ptr<ibex::CtcHC4> ctc_hc4(new ibex::CtcHC4(m_sys->ctrs, m_prec)); unique_ptr<ibex::CtcCompo> ctc_combo(new ibex::CtcCompo(*ctc_ph, *ctc_hc4)); unique_ptr<ibex::CtcFixPoint> ctc_fp(new ibex::CtcFixPoint(*ctc_combo)); ctc_list.set_ref(index++, *ctc_fp); m_sub_ctcs.push_back(move(ctc_ph)); m_sub_ctcs.push_back(move(ctc_hc4)); m_sub_ctcs.push_back(move(ctc_combo)); m_sub_ctcs.push_back(move(ctc_fp)); ctc_list.resize(index); m_ctc.reset(new ibex::CtcCompo(ctc_list)); for (shared_ptr<nonlinear_constraint> ctr : ctrs) { unordered_set<Enode *> const & vars_in_ctr = ctr->get_enode()->get_vars(); m_vars_in_ctrs.insert(vars_in_ctr.begin(), vars_in_ctr.end()); } DREAL_LOG_INFO << "contractor_ibex_polytope: DONE" << endl; }