uc_model.py
def solution_to_schedule(m, data):
    """
    Retrieve the binary schedule from a MILP solution object m, 
    with problem data (dict) in data.
    """
    num_gen = len(data['thermal_generators'])
    time_periods = data['time_periods']
    schedule = [[0]*time_periods for i in range(num_gen)]

    schedule = np.zeros((time_periods, num_gen))
    dispatch = np.zeros((time_periods, num_gen))

    for v in m.component_data_objects(Var):
        if 'ug' in str(v):
            split_v = str(v).split(',')
            gen = int("".join([s for s in split_v[0] if s.isdigit()]))
            time_period = int("".join([s for s in split_v[1] if s.isdigit()]))
            schedule[int(time_period-1), int(gen)] = int(v.value)

    return schedule

    Retrieve the binary schedule from a MILP solution object m, 
    with problem data (dict) in data.
    
Retrieve the binary schedule from a MILP solution object m,
with problem data (dict) in data.
Retrieve the binary schedule from a MILP solution object m with problem data ( dict ) in data .
def solution_to_schedule(m, data):
    num_gen = len(data['thermal_generators'])
    time_periods = data['time_periods']
    schedule = [[0]*time_periods for i in range(num_gen)]
    schedule = np.zeros((time_periods, num_gen))
    dispatch = np.zeros((time_periods, num_gen))
    for v in m.component_data_objects(Var):
        if 'ug' in str(v):
            split_v = str(v).split(',')
            gen = int("".join([s for s in split_v[0] if s.isdigit()]))
            time_period = int("".join([s for s in split_v[1] if s.isdigit()]))
            schedule[int(time_period-1), int(gen)] = int(v.value)
    return schedule
def solution_to_schedule ( m , data ) : num_gen = len ( data [ 'thermal_generators' ] ) time_periods = data [ 'time_periods' ] schedule = [ [ 0 ] * time_periods for i in range ( num_gen ) ] schedule = np . zeros ( ( time_periods , num_gen ) ) dispatch = np . zeros ( ( time_periods , num_gen ) ) for v in m . component_data_objects ( Var ) : if 'ug' in str ( v ) : split_v = str ( v ) . split ( ',' ) gen = int ( "" . join ( [ s for s in split_v [ 0 ] if s . isdigit ( ) ] ) ) time_period = int ( "" . join ( [ s for s in split_v [ 1 ] if s . isdigit ( ) ] ) ) schedule [ int ( time_period - 1 ) , int ( gen ) ] = int ( v . value ) return schedule
Retrieve the binary schedule from a MILP solution object m,
with problem data (dict) in data.
Retrieve the binary schedule from a MILP solution object m with problem data ( dict ) in data .
"""
    Retrieve the binary schedule from a MILP solution object m, 
    with problem data (dict) in data.
    """
m
data