Esempio n. 1
0
def run_jc_sample(layers, judge_types, auction_type, valuation_type):
    interdep_net = indp.initialize_sample_network(layers=layers)
    params = {
        "NUM_ITERATIONS": 7,
        "OUTPUT_DIR": '../results/jc_sample_12Node_results',
        "V": len(layers),
        "T": 1,
        "L": layers,
        "WINDOW_LENGTH": 1,
        "ALGORITHM": "JC",
        "N": interdep_net,
        "MAGNITUDE": 0,
        "SIM_NUMBER": 0,
        "JUDGMENT_TYPE": judge_types,
        "RES_ALLOC_TYPE": auction_type,
        "VALUATION_TYPE": valuation_type
    }
    dindputils.run_judgment_call(params, save_jc_model=True, print_cmd=False)
    for jt, rst, vt in itertools.product(judge_types, auction_type,
                                         valuation_type):
        print('\n\nPlot restoration plan by JC', jt, rst, vt)
        if rst == 'UNIFORM':
            indp.plot_indp_sample(params,
                                  folderSuffix='_' + jt + '_' + rst,
                                  suffix="real")
        else:
            indp.plot_indp_sample(params,
                                  folderSuffix='_' + jt + '_AUCTION_' + rst +
                                  '_' + vt,
                                  suffix="real")
        plt.show()
Esempio n. 2
0
def run_indp_sample(layers):
    interdep_net = indp.initialize_sample_network(layers=layers)
    params = {
        "NUM_ITERATIONS": 0,
        "OUTPUT_DIR": '../results/indp_sample_12Node_results',
        "V": {
            '': len(layers)
        },
        "T": 1,
        "L": layers,
        "WINDOW_LENGTH": 1,
        "ALGORITHM": "INDP",
        "N": interdep_net,
        "MAGNITUDE": 0,
        "SIM_NUMBER": 0,
        'DYNAMIC_PARAMS': None
    }
    indp.run_indp(params,
                  layers=layers,
                  T=params["T"],
                  suffix="",
                  save_model=True,
                  print_cmd_line=True)
    print('\n\nPlot restoration plan by INDP')
    indp.plot_indp_sample(params)
    plt.show()
Esempio n. 3
0
def run_game_sample(layers,
                    judge_types,
                    auction_type,
                    valuation_type,
                    game_type="NORMALGAME",
                    signals=None,
                    beliefs=None,
                    reduced_act=None):
    interdep_net = indp.initialize_sample_network(layers=layers)
    if game_type == "NORMALGAME":
        out_dir = '../results/ng_sample_12Node_results'
    elif game_type == "BAYESGAME":
        out_dir = '../results/bg' + ''.join(signals.values()) + ''.join(beliefs.values()) + \
                  '_sample_12Node_results'
    params = {
        "NUM_ITERATIONS": 7,
        "OUTPUT_DIR": out_dir,
        "V": {
            '': len(layers)
        },
        "T": 1,
        "L": layers,
        "WINDOW_LENGTH": 1,
        "ALGORITHM": game_type,
        'EQUIBALG': 'enumerate_pure',
        "N": interdep_net,
        "MAGNITUDE": 0,
        "SIM_NUMBER": 0,
        "JUDGMENT_TYPE": judge_types,
        "RES_ALLOC_TYPE": auction_type,
        "VALUATION_TYPE": valuation_type,
        'DYNAMIC_PARAMS': None,
        'PAYOFF_DIR': None,
        "SIGNALS": signals,
        "BELIEFS": beliefs,
        'REDUCED_ACTIONS': reduced_act
    }
    gameutils.run_game(params,
                       save_results=True,
                       print_cmd=True,
                       save_model=True,
                       plot2D=True)
    for jt, rst, vt in itertools.product(judge_types, auction_type,
                                         valuation_type):
        print('\n\nPlot restoration plan by Game', jt, rst, vt)
        if rst == 'UNIFORM' or 'FIXED_LAYER':
            indp.plot_indp_sample(params,
                                  folder_suffix='_' + jt + '_' + rst,
                                  suffix="")
        else:
            indp.plot_indp_sample(params,
                                  folder_suffix='_' + jt + '_AUCTION_' + rst +
                                  '_' + vt,
                                  suffix="")
        plt.show()
Esempio n. 4
0
def run_tdindp_sample(layers):
    interdep_net = indp.initialize_sample_network(layers=layers)
    params = {
        "OUTPUT_DIR": '../results/tdindp_sample_12Node_results',
        "V": len(layers),
        "T": 7,
        "L": layers,
        "ALGORITHM": "INDP",
        "WINDOW_LENGTH": 3,
        "N": interdep_net,
        "MAGNITUDE": 0,
        "SIM_NUMBER": 0
    }  #"WINDOW_LENGTH":6,
    indp.run_indp(params,
                  layers=layers,
                  T=params["T"],
                  suffix="",
                  saveModel=True,
                  print_cmd_line=True)
    print('\n\nPlot restoration plan by INDP')
    indp.plot_indp_sample(params)
    plt.show()