<jupyter_start><jupyter_text>This notebook is for generating exploratory experiments for each SSPs under baseline and mitigation policy scenarios.<jupyter_code>import sys
sys.path.append(r'C:\Users\moallemie\EMAworkbench-master')
sys.path.append(r'C:\Users\moallemie\GitHub\SSPs_SDGs_Assessment')
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from ema_workbench import load_results, ema_logging<jupyter_output><empty_output><jupyter_text>Load the model, uncertainities, outcomes; Run the experiments<jupyter_code># Specify the SSP, number of parallel processors, and number of scenarios 
ssp_name = 'SSP2'
n_process = 100
n_scenario = 5000
# Open Excel input data from the notebook directory before runnign the code in multi-processing.
# This line must be at the beginning for multi processing. 
if __name__ == '__main__':
    
   
    ema_logging.log_to_stderr(ema_logging.INFO)
    
    #The model must be imported as .py file in parallel processing. Make sure the Venism package file and directory is correct 
    # in Model_init file in the Notebook directory.
    from Model_init import vensimModel
    
    from ema_workbench import (TimeSeriesOutcome, 
                                   perform_experiments,
                                   RealParameter, 
                                   CategoricalParameter,
                                   Constant,
                                   ema_logging, 
                                   save_results,
                                  load_results)

    directory = 'C:/Users/moallemie/GitHub/SSPs_SDGs_Assessment/Model/'
 
    # Specify uncertainties
    df_unc = pd.read_excel(directory+'ScenarioFramework.xlsx', sheet_name='Exploratory_analysis_'+ssp_name)
    vensimModel.uncertainties = [RealParameter(row['Uncertainty'], row['Min'], row['Max']) for index, row in df_unc.iterrows()]   
    
    # Override other parameters with the default related SSP values
    df_const = pd.read_excel(directory+'ScenarioFramework.xlsx', sheet_name='Exploratory_analysis_constants')
    vensimModel.constants = [Constant(row['Constant'], row[ssp_name]) for index, row in df_const.iterrows()]   
    
    # Specify outcomes
    df_ind1 = pd.read_excel(directory+'ScenarioFramework.xlsx', sheet_name='SDG_indicator_target')
    df_calout = pd.read_excel(directory+'ScenarioFramework.xlsx', sheet_name='Outcomes')
    vensimModel.outcomes = [TimeSeriesOutcome(out) for out in df_ind1['Target indicator']] + [TimeSeriesOutcome(out) for out in df_calout['Outcome']] 


    from ema_workbench import MultiprocessingEvaluator
    from ema_workbench.em_framework.evaluators import (MC, LHS, FAST, FF, PFF, SOBOL, MORRIS)

    import  time
    start = time.time()

    with MultiprocessingEvaluator(vensimModel, n_processes=n_process) as evaluator:
        results = evaluator.perform_experiments(scenarios=n_scenario, uncertainty_sampling=LHS)

    
    
    end = time.time()
    print("took {} seconds".format(end-start))
    
    fn = 'C:/Users/moallemie/GitHub/SSPs_SDGs_Assessment/Data/Exploration_results/SDG_{}_exploratory_sc{}.tar.gz'.format(ssp_name, n_scenario)

    save_results(results, fn)
experiments, outcomes = results
outcomes<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08256880733944955, 'fraction_numerical': 0.0030581039755351682, 'mean_word_length': 3.4685792349726774, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '87074', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1039, 'n_tokens_neox': 983, 'n_words': 230, 'path': 'Notebook/.ipynb_checkpoints/Exploratory_SDGs_experiments_run-Copy2-checkpoint.ipynb', 'repo_name': 'enayatmoallemi/Moallemi_et_al_SDG_SSP_Assessment', 'size': '3270'}