def test_sage_feasibility(self): s = Signomial({(-1, ): 1, (1, ): -1}) s = s**2 s.remove_terms_with_zero_as_coefficient() status = sage.sage_feasibility(s).solve(solver='ECOS') assert status == 0 s = s**2 status = sage.sage_feasibility(s).solve(solver='ECOS') assert status == -np.inf
def test_sage_multiplier_search(self): s = Signomial({(1, ): 1, (-1, ): -1})**4 s.remove_terms_with_zero_as_coefficient() val0 = sage.sage_multiplier_search(s, level=1).solve(solver='ECOS') assert val0 == -np.inf s_star = sage.sage_primal(s, level=1).solve(solver='ECOS') s = s - 0.5 * s_star val1 = sage.sage_multiplier_search(s, level=1).solve(solver='ECOS') assert val1 == 0