def test_encountered_bugs(self): lb, ub = interval._inverse_power1(88893.4225, 88893.4225, 2, 2, 298.15, 298.15, feasibility_tol=1e-8) self.assertAlmostEqual(lb, 298.15) self.assertAlmostEqual(ub, 298.15) lb, ub = interval._inverse_power1(2.56e-6, 2.56e-6, 2, 2, -0.0016, -0.0016, 1e-12) self.assertAlmostEqual(lb, -0.0016) self.assertAlmostEqual(ub, -0.0016) lb, ub = interval._inverse_power1(-1, -1e-12, 2, 2, -interval.inf, interval.inf, feasibility_tol=1e-8) self.assertAlmostEqual(lb, 0) self.assertAlmostEqual(ub, 0) lb, ub = interval.mul(0, 0, -interval.inf, interval.inf) self.assertEqual(lb, -interval.inf) self.assertEqual(ub, interval.inf)
def test_mul(self): xl = -2.5 xu = 2.8 yl = -3.2 yu = 2.7 zl, zu = interval.mul(xl, xu, yl, yu) x = np.linspace(xl, xu, 100) y = np.linspace(yl, yu, 100) for _x in x: _z = _x * y self.assertTrue(np.all(zl <= _z)) self.assertTrue(np.all(zu >= _z))
def _prop_bnds_leaf_to_root_ProductExpression(node, bnds_dict): """ Parameters ---------- node: pyomo.core.expr.expr_pyomo5.ProductExpression bnds_dict: ComponentMap """ assert len(node.args) == 2 arg1, arg2 = node.args lb1, ub1 = bnds_dict[arg1] lb2, ub2 = bnds_dict[arg2] bnds_dict[node] = interval.mul(lb1, ub1, lb2, ub2)
def _prop_bnds_leaf_to_root_ProductExpression(node, bnds_dict): """ Parameters ---------- node: pyomo.core.expr.numeric_expr.ProductExpression bnds_dict: ComponentMap """ assert len(node.args) == 2 arg1, arg2 = node.args lb1, ub1 = bnds_dict[arg1] lb2, ub2 = bnds_dict[arg2] bnds_dict[node] = interval.mul(lb1, ub1, lb2, ub2)