Exemple #1
0
from harvestscheduler import schedule, prep_data
from harvestscheduler.utils import print_results, write_stand_mgmt_csv

if __name__ == '__main__':

    #----------- STEP 1: Read source data -------------------------------------#
    # 4D: stands, rxs, time periods, variables
    stand_data, axis_map, valid_mgmts = prep_data.from_random(1000, 50, 20, 3)

    #----------- STEP 2: Identify and configure variables ---------------------#
    # ORDER MUST MATCH THE DATA COMING FROM prep_data!!!
    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
        },
        {
"""
Tests for `harvestscheduler` module.
"""
import pytest
from harvestscheduler import schedule, prep_data

# Create a random 4D array
# stands, mgmts, timeperiods, numvars
STAND_DATA, AXIS_MAP, VALID_MGMTS = prep_data.from_random(100, 25, 20, 3)


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
"""
Tests for `harvestscheduler` module.
"""
import pytest
from harvestscheduler import schedule, prep_data


# Create a random 4D array
# stands, mgmts, timeperiods, numvars
STAND_DATA, AXIS_MAP, VALID_MGMTS = prep_data.from_random(100, 25, 20, 3)

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',
from harvestscheduler import schedule, prep_data
from harvestscheduler.utils import print_results, write_stand_mgmt_csv

if __name__ == '__main__':
 
    #----------- STEP 1: Read source data -------------------------------------#
    # 4D: stands, rxs, time periods, variables
    stand_data, axis_map, valid_mgmts = prep_data.from_random(1000, 50, 20, 3)

    #----------- STEP 2: Identify and configure variables ---------------------#
    # ORDER MUST MATCH THE DATA COMING FROM prep_data!!!
    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
        },