Commit 89fffa9f authored by Martin Řepa's avatar Martin Řepa

Update experiments #1

parent 6f258ef5
experiments_per_setup: 3 # 6
legacy_folder: /home/ignac/experiments/learning_epochs/2000to14000by4000_3times # Change in regards with configuration
experiments_per_setup: 8 # 6
legacy_folder: /home/ignac/experiments/learning_epochs/2000to14000by4000_8times # Change in regards with configuration
epochs:
lower_bound: 2000
number_of_steps: 4 # 8 (6-8 should be enough)
......
......@@ -32,6 +32,7 @@ class DefenderAction:
@dataclass
class SubResult:
iterations: int
legacy_folder: str
time: float
zero_sum_game_value: float
......@@ -88,7 +89,8 @@ def exec_new_setup(conf: RootConfig, folder: str, iterations: int) -> Setup:
torch.save(p2_action.model.state_dict(),
f'{folder}/{i}/{p2_action.id}.pt')
sub_result = SubResult(str(i),
sub_result = SubResult(result.iterations,
str(i),
time_taken,
result.zero_sum_nash_val,
result.attacker_value,
......@@ -170,4 +172,4 @@ if __name__ == "__main__":
sys.stderr = log
sys.stdout = log
main(experiment_conf, base_dir)
# main(experiment_conf, base_dir)
......@@ -16,6 +16,7 @@ logger = logging.getLogger(__name__)
@attr.s
class Result:
iterations: int
zero_sum_nash_val: int = attr.ib()
attacker_value: int = attr.ib()
defender_value: int = attr.ib()
......@@ -96,7 +97,7 @@ class GameSolver:
# If there is no new action in best responses, algorithm ends
if br_p1_exists and br_p2_exists:
return Result(zero_sum_nash_val, attacker_value,
return Result(i, zero_sum_nash_val, attacker_value,
defender_value, played_actions_p1, probs_p1,
played_actions_p2, probs_p2)
......
......@@ -70,13 +70,13 @@ class NeuralNetwork:
def __init__(self, input_features=2,
nn_conf: NeuralNetworkConfig = NeuralNetworkConfig()):
self.model = nn.Sequential(
nn.Linear(input_features, 20),
nn.Linear(input_features, 5),
nn.ReLU(),
nn.Linear(20, 10),
nn.Linear(5, 5),
nn.ReLU(),
nn.Linear(10, 13),
nn.Linear(5, 5),
nn.ReLU(),
nn.Linear(13, 1),
nn.Linear(5, 1),
nn.Tanh(),
SoftClip(50)
# nn.Sigmoid()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment