def infer_domain(f, gts, eqs, check_feas=True): """ Identify a subset of the constraints in ``gts`` and ``eqs`` which can be incorporated into conditional SAGE relaxations for signomials. Construct a SigDomain object from the inferred constraints. Parameters ---------- f : Signomial The objective in a desired SAGE relaxation. This parameter is only used to determine the dimension of the set defined by constraints in ``gts`` and ``eqs``. gts : list of Signomials For every ``g in gts``, there is a desired constraint that variables ``x`` satisfy ``g(x) >= 0``. eqs : list of Signomials For every ``g in eqs``, there is a desired constraint that variables ``x`` satisfy ``g(x) == 0``. check_feas : bool Indicates whether or not to verify that the returned SigDomain is nonempty. Returns ------- X : SigDomain or None """ conv_gt = con_gen.valid_posynomial_inequalities(gts) conv_eqs = con_gen.valid_monomial_equations(eqs) cl_cons = con_gen.clcons_from_standard_gprep(f.n, conv_gt, conv_eqs) if len(cl_cons) > 0: sigdom = SigDomain(f.n, coniclifts_cons=cl_cons, gts=conv_gt, eqs=conv_eqs, check_feas=check_feas) return sigdom else: return None
def infer_domain(f, gts, eqs, check_feas=True): """ Identify a subset of the constraints in ``gts`` and ``eqs`` which can be incorporated into conditional SAGE relaxations for polynomials. Construct a PolyDomain object from the inferred constraints. Parameters ---------- f : Polynomial The objective in a desired optimization problem. This parameter is only used to determine the dimension of the set defined by constraints in ``gts`` and ``eqs``. gts : list of Polynomials For every ``g in gts``, there is a desired constraint that variables ``x`` satisfy ``g(x) >= 0``. eqs : list of Polynomials For every ``g in eqs``, there is a desired constraint that variables ``x`` satisfy ``g(x) == 0``. check_feas : bool Indicates whether or not to verify that the returned PolyDomain is nonempty. Returns ------- X : PolyDomain or None """ # GP-representable inequality constraints (recast as "Signomial >= 0") gp_gts = con_gen.valid_gp_representable_poly_inequalities(gts) gp_gts_sigreps = [Signomial(g.alpha, g.c) for g in gp_gts] gp_gts_sigreps = con_gen.valid_posynomial_inequalities(gp_gts_sigreps) # ^ That second call is to convexify the signomials. # GP-representable equality constraints (recast as "Signomial == 0") gp_eqs = con_gen.valid_gp_representable_poly_eqs(eqs) gp_eqs_sigreps = [Signomial(g.alpha, g.c) for g in gp_eqs] gp_eqs_sigreps = con_gen.valid_monomial_equations(gp_eqs_sigreps) # ^ That second call is to make sure the nonconstant term has # a particular sign (specifically, a negative sign). clcons = con_gen.clcons_from_standard_gprep(f.n, gp_gts_sigreps, gp_eqs_sigreps) if len(clcons) > 0: polydom = PolyDomain(f.n, logspace_cons=clcons, gts=gp_gts, eqs=gp_eqs, check_feas=check_feas) return polydom else: return None