Ejemplo n.º 1
0
def id_fix_list_fct(scenario_instance):
    """ specify tuples used by the fixer.

    Args:
        s (ConcreteModel): the sizes instance.
    Returns:
         i0, ik (tuples): one for iter 0 and other for general iterations.
             Var id,  threshold, nb, lb, ub
             The threshold is on the square root of the xbar squared differnce
             nb, lb an bu an "no bound", "upper" and "lower" and give the numver
                 of iterations or None for ik and for i0 anything other than None
                 or None. In both cases, None indicates don't fix.
    """
    import mpisppy.extensions.fixer as fixer

    iter0tuples = []
    iterktuples = []

    for b in sorted(scenario_instance.Buses):
        for t in sorted(scenario_instance.TimePeriods):
            for g in sorted(scenario_instance.ThermalGeneratorsAtBus[b]):

                iter0tuples.append(fixer.Fixer_tuple(scenario_instance.UnitOn[g,t],
                                                     th=0.01, nb=None, lb=0, ub=None))
                
                iterktuples.append(fixer.Fixer_tuple(scenario_instance.UnitOn[g,t],
                                                     th=0.01, nb=None, lb=6, ub=6))

    return iter0tuples, iterktuples
Ejemplo n.º 2
0
def id_fix_list_fct(s):
    """ specify tuples used by the fixer.

        Args:
            s (ConcreteModel): the sizes instance.
        Returns:
             i0, ik (tuples): one for iter 0 and other for general iterations.
                 Var id,  threshold, nb, lb, ub
                 The threshold is on the square root of the xbar squared differnce
                 nb, lb an bu an "no bound", "upper" and "lower" and give the numver
                     of iterations or None for ik and for i0 anything other than None
                     or None. In both cases, None indicates don't fix.
        Note:
            This is just here to provide an illustration, we don't run long enough.
    """

    # iter0tuples = [
    #     fixer.Fixer_tuple(s.FacilityOpen[i], th=None, nb=None, lb=None, ub=None)
    #     for i in s.FacilityOpen
    # ]
    iterktuples = [
        fixer.Fixer_tuple(s.FacilityOpen[i], th=0, nb=None, lb=20, ub=20)
        for i in s.FacilityOpen
    ]
    return None, iterktuples
Ejemplo n.º 3
0
def id_fix_list_fct(s):
    """ specify tuples used by the fixer.

    Args:
        s (ConcreteModel): the sizes instance.
    Returns:
         i0, ik (tuples): one for iter 0 and other for general iterations.
             Var id,  threshold, nb, lb, ub
             The threshold is on the square root of the xbar squared differnce
             nb, lb an bu an "no bound", "upper" and "lower" and give the numver
                 of iterations or None for ik and for i0 anything other than None
                 or None. In both cases, None indicates don't fix.
    """
    import mpisppy.extensions.fixer as fixer

    iter0tuples = []
    iterktuples = []
    for i in s.ProductSizes:
        iter0tuples.append(
            fixer.Fixer_tuple(s.NumProducedFirstStage[i],
                              th=0.01,
                              nb=None,
                              lb=0,
                              ub=0))
        iterktuples.append(
            fixer.Fixer_tuple(s.NumProducedFirstStage[i],
                              th=0.2,
                              nb=3,
                              lb=1,
                              ub=2))
        for j in s.ProductSizes:
            if j <= i:
                iter0tuples.append(
                    fixer.Fixer_tuple(s.NumUnitsCutFirstStage[i, j],
                                      th=0.5,
                                      nb=None,
                                      lb=0,
                                      ub=0))
                iterktuples.append(
                    fixer.Fixer_tuple(s.NumUnitsCutFirstStage[i, j],
                                      th=0.2,
                                      nb=3,
                                      lb=1,
                                      ub=2))

    return iter0tuples, iterktuples