예제 #1
0
def _prop_bnds_root_to_leaf_PowExpression(node, bnds_dict):
    """

    Parameters
    ----------
    node: pyomo.core.expr.expr_pyomo5.ProductExpression
    bnds_dict: ComponentMap
    """
    assert len(node.args) == 2
    arg1, arg2 = node.args
    lb0, ub0 = bnds_dict[node]
    lb1, ub1 = bnds_dict[arg1]
    lb2, ub2 = bnds_dict[arg2]
    _lb1a, _ub1a = interval.log(lb0, ub0)
    _lb1a, _ub1a = interval.div(_lb1a, _ub1a, lb2, ub2)
    _lb1a, _ub1a = interval.exp(_lb1a, _ub1a)
    _lb1b, _ub1b = interval.sub(0, 0, _lb1a, _ub1a)
    _lb1 = min(_lb1a, _lb1b)
    _ub1 = max(_ub1a, _ub1b)
    _lb2a, _ub2a = interval.log(lb0, ub0)
    _lb2b, _ub2b = interval.log(lb1, ub1)
    _lb2, _ub2 = interval.div(_lb2a, _ub2a, _lb2b, _ub2b)
    if _lb1 > lb1:
        lb1 = _lb1
    if _ub1 < ub1:
        ub1 = _ub1
    if _lb2 > lb2:
        lb2 = _lb2
    if _ub2 < ub2:
        ub2 = _ub2
    bnds_dict[arg1] = (lb1, ub1)
    bnds_dict[arg2] = (lb2, ub2)
예제 #2
0
 def test_log(self):
     x_bounds = [(np.random.uniform(0, 2), np.random.uniform(2, 5)),
                 (0, np.random.uniform(2, 5)), (0, 0)]
     for xl, xu in x_bounds:
         zl, zu = interval.log(xl, xu)
         x = np.linspace(xl, xu, 100)
         _z = np.log(x)
         self.assertTrue(np.all(zl <= _z))
         self.assertTrue(np.all(zu >= _z))
예제 #3
0
 def test_log(self):
     x_bounds = [(np.random.uniform(0, 2), np.random.uniform(2, 5)),
                 (0, np.random.uniform(2, 5)),
                 (0, 0)]
     for xl, xu in x_bounds:
         zl, zu = interval.log(xl, xu)
         x = np.linspace(xl, xu, 100)
         _z = np.log(x)
         self.assertTrue(np.all(zl <= _z))
         self.assertTrue(np.all(zu >= _z))
예제 #4
0
def _prop_bnds_leaf_to_root_log(node, bnds_dict):
    """

    Parameters
    ----------
    node: pyomo.core.expr.expr_pyomo5.UnaryFunctionExpression
    bnds_dict: ComponentMap
    """
    assert len(node.args) == 1
    arg = node.args[0]
    lb1, ub1 = bnds_dict[arg]
    bnds_dict[node] = interval.log(lb1, ub1)
예제 #5
0
파일: fbbt.py 프로젝트: mskarha/pyomo
def _prop_bnds_leaf_to_root_log(node, bnds_dict):
    """

    Parameters
    ----------
    node: pyomo.core.expr.numeric_expr.UnaryFunctionExpression
    bnds_dict: ComponentMap
    """
    assert len(node.args) == 1
    arg = node.args[0]
    lb1, ub1 = bnds_dict[arg]
    bnds_dict[node] = interval.log(lb1, ub1)
예제 #6
0
def _prop_bnds_root_to_leaf_exp(node, bnds_dict):
    """

    Parameters
    ----------
    node: pyomo.core.expr.expr_pyomo5.ProductExpression
    bnds_dict: ComponentMap
    """
    assert len(node.args) == 1
    arg = node.args[0]
    lb0, ub0 = bnds_dict[node]
    lb1, ub1 = bnds_dict[arg]
    _lb1, _ub1 = interval.log(lb0, ub0)
    if _lb1 > lb1:
        lb1 = _lb1
    if _ub1 < ub1:
        ub1 = _ub1
    bnds_dict[arg] = (lb1, ub1)
예제 #7
0
파일: fbbt.py 프로젝트: mskarha/pyomo
def _prop_bnds_root_to_leaf_exp(node, bnds_dict):
    """

    Parameters
    ----------
    node: pyomo.core.expr.numeric_expr.ProductExpression
    bnds_dict: ComponentMap
    """
    assert len(node.args) == 1
    arg = node.args[0]
    lb0, ub0 = bnds_dict[node]
    lb1, ub1 = bnds_dict[arg]
    _lb1, _ub1 = interval.log(lb0, ub0)
    if _lb1 > lb1:
        lb1 = _lb1
    if _ub1 < ub1:
        ub1 = _ub1
    bnds_dict[arg] = (lb1, ub1)