Exemple #1
0
# test for pareto.py

from game.state import State, Config
from game.reader import StateReader
from game.pareto import is_pareto_efficient_k0, is_pareto_sets_efficient
import numpy as np
import time
import random

# read and write existing state
reader = StateReader()
state = State(Config())
reader.write_state(state)
state.print_graph()
action_att = 0


def calc_score(state_x, action_a, action_d):
    """Read the data file and reset the score"""
    state_x = reader.read_state()
    score = state_x.make_move(action_a, action_d)
    return score


# choose an attack action
start_time = time.time()
actions = []
for i in range(6):
    for j in range(100):
        action_att = np.random.randint(0, state.size_graph)
        if state.actions_att[action_att] == 1: