예제 #1
0
def test_schedule_random():
    axis_map = AXIS_MAP.copy()

    axis_map['variables'] = [
        {
            'name':
            'timber',
            'strategy':
            'within_bounds',  # Stay within range
            'targets': (
                [45.0] * 20,  # 1 x time periods array of lower bounds
                [55.0] * 20  # 1 x time periods array of upper bounds
            ),
            'weight':
            1.0
        },
        {
            'name': 'carbon',
            'strategy':
            'cumulative_maximize',  # target the max cumulative value
            'weight': 1.0
        },
        {
            'name': 'cost proxy',
            'strategy':
            'cumulative_minimize',  # target the min cumulative value
            'weight': 1.0
        },
    ]

    best, optimal_stand_rxs, vars_over_time = schedule(STAND_DATA,
                                                       axis_map,
                                                       VALID_MGMTS,
                                                       steps=15000,
                                                       report_interval=5000,
                                                       temp_min=0.006,
                                                       temp_max=20)

    # stochastic process, just make sure it's in the ballpark
    assert 5000 < best and 6000 > best
예제 #2
0
def test_schedule_random():
    axis_map = AXIS_MAP.copy()	

    axis_map['variables'] = [  
        {   
            'name': 'timber',
            'strategy': 'within_bounds',  # Stay within range
            'targets': (
            	[45.0] * 20, # 1 x time periods array of lower bounds
            	[55.0] * 20  # 1 x time periods array of upper bounds
            ),
            'weight': 1.0
        },
        {   
            'name': 'carbon',
            'strategy': 'cumulative_maximize', # target the max cumulative value
            'weight': 1.0
        },
        {   
            'name': 'cost proxy',
            'strategy': 'cumulative_minimize', # target the min cumulative value
            'weight': 1.0
        },
    ]  

    best, optimal_stand_rxs, vars_over_time = schedule(
        STAND_DATA,
        axis_map,
        VALID_MGMTS,
        steps=15000,
        report_interval=5000,
        temp_min=0.006,
        temp_max=20   
    )

    # stochastic process, just make sure it's in the ballpark
    assert 5000 < best and 6000 > best
예제 #3
0
            'weight':
            1.0
        },
        {
            'name': 'carbon',
            'strategy':
            'cumulative_maximize',  # target the max cumulative value
            'weight': 1.0
        },
        {
            'name': 'cost proxy',
            'strategy':
            'cumulative_minimize',  # target the min cumulative value
            'weight': 1.0
        },
    ]

    #----------- STEP 3: Optimize (annealing over objective function) ---------#
    best, optimal_stand_rxs, vars_over_time = schedule(stand_data,
                                                       axis_map,
                                                       valid_mgmts,
                                                       steps=250000,
                                                       report_interval=5000,
                                                       temp_min=0.0006,
                                                       temp_max=2,
                                                       live_plot=True)

    #----------- STEP 4: output results ---------------------------------------#
    print_results(axis_map, vars_over_time)
    write_stand_mgmt_csv(optimal_stand_rxs, axis_map, filename="_results.csv")
예제 #4
0
            'strategy': 'cumulative_minimize',
            'weight': 1.0 },

    ]


    #----------- STEP 3: Optimize (annealing over objective function) ---------#

    # Do a quick run to get a good starting condition
    best_start = float("inf")
    for i in range(1):
        best, optimal_stand_rxs, vars_over_time = schedule(
            stand_data,
            axis_map,
            valid_mgmts,
            steps=5000 + (1000*i),
            report_interval=1000,
            temp_min=1e-5,
            temp_max=5.0
        )
        if best < best_start:
            best_start = best
            best_mgmts = optimal_stand_rxs

    # Now run the full schedule
    best, optimal_stand_rxs, vars_over_time = schedule(
        stand_data,
        axis_map,
        valid_mgmts,
        steps=295000,
        report_interval=5000,
예제 #5
0
        {
            'name': 'cost proxy',
            'strategy': 'cumulative_minimize',
            'weight': 1.0
        },
    ]

    #----------- STEP 3: Optimize (annealing over objective function) ---------#

    # Do a quick run to get a good starting condition
    best_start = float("inf")
    for i in range(1):
        best, optimal_stand_rxs, vars_over_time = schedule(
            stand_data,
            axis_map,
            valid_mgmts,
            steps=5000 + (1000 * i),
            report_interval=1000,
            temp_min=1e-5,
            temp_max=5.0)
        if best < best_start:
            best_start = best
            best_mgmts = optimal_stand_rxs

    # Now run the full schedule
    best, optimal_stand_rxs, vars_over_time = schedule(
        stand_data,
        axis_map,
        valid_mgmts,
        steps=295000,
        report_interval=5000,
        temp_min=0.00005,
예제 #6
0
            ),
            'weight': 1.0
        },
        {   
            'name': 'carbon',
            'strategy': 'cumulative_maximize', # target the max cumulative value
            'weight': 1.0
        },
        {   
            'name': 'cost proxy',
            'strategy': 'cumulative_minimize', # target the min cumulative value
            'weight': 1.0
        },
    ]

    #----------- STEP 3: Optimize (annealing over objective function) ---------#
    best, optimal_stand_rxs, vars_over_time = schedule(
        stand_data,
        axis_map,
        valid_mgmts,
        steps=250000,
        report_interval=5000,
        temp_min=0.0006,
        temp_max=2,
        live_plot=True
    )

    #----------- STEP 4: output results ---------------------------------------#
    print_results(axis_map, vars_over_time)
    write_stand_mgmt_csv(optimal_stand_rxs, axis_map, filename="_results.csv")