diff --git a/experiments/firefighter_problem/comparisons.py b/experiments/firefighter_problem/comparisons.py index 34fed01..eb5bd7b 100644 --- a/experiments/firefighter_problem/comparisons.py +++ b/experiments/firefighter_problem/comparisons.py @@ -328,7 +328,7 @@ def Compare_SpreadingMinBudget(): node_counts = [100, 200, 400] edge_probabilities = [0.1, 0.5, 0.8] - def multiple_runs(runs=10): + def multiple_runs(runs=1): for num_nodes in node_counts: for edge_prob in edge_probabilities: graph = generate_random_DiGraph(num_nodes=num_nodes, edge_probability=edge_prob, seed=None) @@ -385,14 +385,31 @@ def extract_budget_numeric(budget): save_to_file="./experiments/firefighter_problem/spreading_minbudget.png" ) - single_plot_results( + # ex3.clear_previous_results() # to clear previous experiments + + # single_plot_results( + # results_csv_file=preprocessed_csv_file, + # filter={"graph_nodes":400}, + # x_field="edge_probability", + # y_field="Budget_numeric", + # z_field="algorithm", + # mean=True, + # save_to_file="./experiments/firefighter_problem/spreading_minbudget_400_edge.png" + # ) + + multi_plot_results( results_csv_file=preprocessed_csv_file, - filter={"graph_nodes":400}, + filter={}, + subplot_rows=3, + subplot_cols=1, x_field="edge_probability", y_field="Budget_numeric", z_field="algorithm", + subplot_field="graph_nodes", + sharex=True, + sharey=True, mean=True, - save_to_file="./experiments/firefighter_problem/spreading_minbudget_400_edge.png" + save_to_file="./experiments/firefighter_problem/spreading_minbudget_edge_prob.png" ) print("\n DataFrame-NonSpread: \n", ex3.dataFrame) diff --git a/experiments/firefighter_problem/spreading_minbudget.csv b/experiments/firefighter_problem/spreading_minbudget.csv new file mode 100644 index 0000000..e596d4f --- /dev/null +++ b/experiments/firefighter_problem/spreading_minbudget.csv @@ -0,0 +1,20 @@ +algorithm,runtime,graph_nodes,edge_probability,Budget +spreading_minbudget,0.8782017999999425,100,0.1,"(3, [(16, 1), (28, 1), (8, 1), (26, 2), (30, 2), (1, 2)])" +heuristic_minbudget,0.14200389999996332,100,0.1,"(3, [(8, 1), (28, 1), (54, 1), (2, 2), (26, 2), (40, 2)])" +spreading_minbudget,0.9778630000000703,100,0.5,"(9, [(53, 1), (29, 1), (34, 1), (39, 1), (40, 1), (68, 1), (96, 1), (60, 1), (6, 1)])" +heuristic_minbudget,0.973450800000137,100,0.5,"(9, [(60, 1), (96, 1), (6, 1), (29, 1), (39, 1), (68, 1), (53, 1), (40, 1), (34, 1)])" +spreading_minbudget,1.0255027999996855,100,0.8,"(11, [(55, 1), (17, 1), (30, 1), (42, 1), (67, 1), (70, 1), (72, 1), (84, 1), (10, 1), (25, 1), (62, 1)])" +heuristic_minbudget,2.400494600000002,100,0.8,"(11, [(55, 1), (62, 1), (25, 1), (67, 1), (70, 1), (42, 1), (72, 1), (10, 1), (30, 1), (84, 1), (17, 1)])" +spreading_minbudget,2.8179470000000038,200,0.1,"(8, [(2, 1), (24, 1), (8, 1), (127, 1), (173, 1), (138, 1), (88, 1), (90, 1)])" +heuristic_minbudget,0.7053286999998818,200,0.1,"(7, [(127, 1), (88, 1), (90, 1), (2, 1), (199, 1), (68, 1), (116, 1), (177, 2), (101, 2), (37, 2), (180, 2), (46, 2), (18, 2), (167, 2)])" +spreading_minbudget,12.766175799999928,200,0.5,"(48, [(164, 1), (25, 1), (153, 1), (13, 1), (48, 1), (49, 1), (55, 1), (58, 1), (65, 1), (68, 1), (74, 1), (104, 1), (105, 1), (115, 1), (127, 1), (130, 1), (136, 1), (147, 1), (148, 1), (154, 1), (163, 1), (169, 1), (175, 1), (186, 1), (199, 1), (21, 1), (33, 1), (39, 1), (62, 1), (73, 1), (107, 1), (128, 1), (129, 1), (131, 1), (137, 1), (145, 1), (151, 1), (171, 1), (179, 1), (192, 1), (3, 1), (34, 1), (133, 1), (135, 1), (196, 1), (97, 1), (181, 1), (188, 1)])" +heuristic_minbudget,6.033393199999864,200,0.5,"(47, [(153, 1), (21, 1), (129, 1), (179, 1), (58, 1), (127, 1), (128, 1), (62, 1), (148, 1), (130, 1), (169, 1), (136, 1), (163, 1), (13, 1), (25, 1), (65, 1), (181, 1), (74, 1), (107, 1), (133, 1), (147, 1), (145, 1), (192, 1), (171, 1), (33, 1), (137, 1), (3, 1), (154, 1), (115, 1), (105, 1), (186, 1), (131, 1), (135, 1), (188, 1), (151, 1), (34, 1), (39, 1), (49, 1), (199, 1), (48, 1), (68, 1), (175, 1), (73, 1), (104, 1), (196, 1), (55, 1), (97, 1)])" +spreading_minbudget,0.9267372000003888,200,0.8,"(3, [(174, 1), (8, 1), (185, 1)])" +heuristic_minbudget,9.790458599999965,200,0.8,"(3, [(174, 1), (8, 1), (185, 1)])" +spreading_minbudget,24.848821499999758,400,0.1,"(24, [(386, 1), (17, 1), (112, 1), (179, 1), (90, 1), (47, 1), (186, 1), (314, 1), (180, 1), (197, 1), (96, 1), (116, 1), (3, 1), (227, 1), (6, 1), (133, 1), (219, 1), (296, 1), (353, 1), (177, 1), (370, 1), (206, 1), (152, 1), (130, 1)])" +heuristic_minbudget,2.065748699999858,400,0.1,"(16, [(227, 1), (296, 1), (130, 1), (219, 1), (370, 1), (177, 1), (152, 1), (353, 1), (116, 1), (206, 1), (133, 1), (3, 1), (6, 1), (121, 1), (162, 1), (390, 1), (309, 2), (161, 2), (203, 2), (290, 2), (28, 2), (166, 2), (31, 2), (327, 2), (346, 2), (98, 2), (178, 2), (188, 2), (18, 2), (26, 2), (64, 2), (71, 2)])" +spreading_minbudget,36.50080590000016,400,0.5,"(59, [(344, 1), (52, 1), (113, 1), (39, 1), (83, 1), (87, 1), (117, 1), (131, 1), (135, 1), (139, 1), (159, 1), (208, 1), (226, 1), (232, 1), (245, 1), (258, 1), (271, 1), (300, 1), (314, 1), (356, 1), (358, 1), (362, 1), (363, 1), (371, 1), (393, 1), (6, 1), (13, 1), (21, 1), (65, 1), (78, 1), (91, 1), (124, 1), (145, 1), (186, 1), (199, 1), (252, 1), (299, 1), (317, 1), (319, 1), (332, 1), (336, 1), (14, 1), (101, 1), (149, 1), (168, 1), (173, 1), (293, 1), (295, 1), (10, 1), (61, 1), (80, 1), (224, 1), (249, 1), (350, 1), (390, 1), (205, 1), (376, 1), (394, 1), (37, 1)])" +heuristic_minbudget,34.908457700000326,400,0.5,"(58, [(14, 1), (319, 1), (21, 1), (258, 1), (232, 1), (10, 1), (65, 1), (139, 1), (245, 1), (91, 1), (168, 1), (61, 1), (356, 1), (117, 1), (362, 1), (52, 1), (186, 1), (317, 1), (393, 1), (101, 1), (390, 1), (13, 1), (252, 1), (39, 1), (80, 1), (145, 1), (135, 1), (199, 1), (394, 1), (299, 1), (113, 1), (208, 1), (358, 1), (149, 1), (271, 1), (87, 1), (295, 1), (83, 1), (131, 1), (371, 1), (78, 1), (300, 1), (226, 1), (205, 1), (336, 1), (376, 1), (249, 1), (314, 1), (159, 1), (293, 1), (363, 1), (173, 1), (37, 1), (124, 1), (224, 1), (6, 1), (350, 1), (332, 1)])" +spreading_minbudget,49.45423810000011,400,0.8,"(100, [(99, 1), (13, 1), (19, 1), (27, 1), (31, 1), (34, 1), (40, 1), (51, 1), (52, 1), (57, 1), (60, 1), (77, 1), (82, 1), (85, 1), (90, 1), (94, 1), (102, 1), (105, 1), (106, 1), (107, 1), (108, 1), (109, 1), (113, 1), (120, 1), (121, 1), (128, 1), (131, 1), (132, 1), (142, 1), (150, 1), (153, 1), (157, 1), (159, 1), (169, 1), (171, 1), (174, 1), (177, 1), (184, 1), (188, 1), (194, 1), (201, 1), (202, 1), (203, 1), (208, 1), (223, 1), (230, 1), (236, 1), (239, 1), (247, 1), (258, 1), (271, 1), (272, 1), (274, 1), (275, 1), (279, 1), (282, 1), (293, 1), (296, 1), (298, 1), (300, 1), (307, 1), (311, 1), (313, 1), (314, 1), (318, 1), (321, 1), (322, 1), (324, 1), (325, 1), (337, 1), (343, 1), (346, 1), (347, 1), (350, 1), (351, 1), (359, 1), (363, 1), (371, 1), (375, 1), (386, 1), (387, 1), (392, 1), (396, 1), (398, 1), (2, 1), (4, 1), (48, 1), (56, 1), (80, 1), (101, 1), (125, 1), (141, 1), (262, 1), (268, 1), (327, 1), (340, 1), (380, 1), (246, 1), (304, 1), (195, 1)])" +heuristic_minbudget,115.43122799999992,400,0.8,"(100, [(101, 1), (107, 1), (371, 1), (85, 1), (174, 1), (300, 1), (318, 1), (150, 1), (392, 1), (350, 1), (142, 1), (201, 1), (208, 1), (325, 1), (13, 1), (153, 1), (131, 1), (48, 1), (258, 1), (380, 1), (132, 1), (106, 1), (298, 1), (40, 1), (275, 1), (105, 1), (157, 1), (202, 1), (113, 1), (80, 1), (346, 1), (268, 1), (52, 1), (19, 1), (169, 1), (120, 1), (82, 1), (102, 1), (159, 1), (274, 1), (262, 1), (304, 1), (351, 1), (396, 1), (296, 1), (246, 1), (272, 1), (141, 1), (51, 1), (128, 1), (60, 1), (99, 1), (188, 1), (230, 1), (271, 1), (236, 1), (77, 1), (109, 1), (94, 1), (314, 1), (322, 1), (108, 1), (387, 1), (327, 1), (313, 1), (2, 1), (34, 1), (279, 1), (340, 1), (343, 1), (398, 1), (239, 1), (293, 1), (57, 1), (363, 1), (194, 1), (386, 1), (171, 1), (195, 1), (203, 1), (375, 1), (247, 1), (177, 1), (311, 1), (337, 1), (324, 1), (321, 1), (125, 1), (184, 1), (347, 1), (31, 1), (359, 1), (121, 1), (307, 1), (282, 1), (4, 1), (56, 1), (90, 1), (223, 1), (27, 1)])" +,303.03000929999985,,, diff --git a/experiments/firefighter_problem/spreading_minbudget.png b/experiments/firefighter_problem/spreading_minbudget.png new file mode 100644 index 0000000..01a0384 Binary files /dev/null and b/experiments/firefighter_problem/spreading_minbudget.png differ diff --git a/experiments/firefighter_problem/spreading_minbudget_edge_prob.png b/experiments/firefighter_problem/spreading_minbudget_edge_prob.png new file mode 100644 index 0000000..b13c0ad Binary files /dev/null and b/experiments/firefighter_problem/spreading_minbudget_edge_prob.png differ diff --git a/experiments/firefighter_problem/spreading_minbudget_preprocessed.csv b/experiments/firefighter_problem/spreading_minbudget_preprocessed.csv new file mode 100644 index 0000000..4964da1 --- /dev/null +++ b/experiments/firefighter_problem/spreading_minbudget_preprocessed.csv @@ -0,0 +1,19 @@ +algorithm,runtime,graph_nodes,edge_probability,Budget,Budget_numeric +spreading_minbudget,0.8782017999999425,100.0,0.1,"(3, [(16, 1), (28, 1), (8, 1), (26, 2), (30, 2), (1, 2)])",3.0 +heuristic_minbudget,0.1420038999999633,100.0,0.1,"(3, [(8, 1), (28, 1), (54, 1), (2, 2), (26, 2), (40, 2)])",3.0 +spreading_minbudget,0.9778630000000704,100.0,0.5,"(9, [(53, 1), (29, 1), (34, 1), (39, 1), (40, 1), (68, 1), (96, 1), (60, 1), (6, 1)])",9.0 +heuristic_minbudget,0.973450800000137,100.0,0.5,"(9, [(60, 1), (96, 1), (6, 1), (29, 1), (39, 1), (68, 1), (53, 1), (40, 1), (34, 1)])",9.0 +spreading_minbudget,1.0255027999996855,100.0,0.8,"(11, [(55, 1), (17, 1), (30, 1), (42, 1), (67, 1), (70, 1), (72, 1), (84, 1), (10, 1), (25, 1), (62, 1)])",11.0 +heuristic_minbudget,2.400494600000002,100.0,0.8,"(11, [(55, 1), (62, 1), (25, 1), (67, 1), (70, 1), (42, 1), (72, 1), (10, 1), (30, 1), (84, 1), (17, 1)])",11.0 +spreading_minbudget,2.817947000000004,200.0,0.1,"(8, [(2, 1), (24, 1), (8, 1), (127, 1), (173, 1), (138, 1), (88, 1), (90, 1)])",8.0 +heuristic_minbudget,0.7053286999998818,200.0,0.1,"(7, [(127, 1), (88, 1), (90, 1), (2, 1), (199, 1), (68, 1), (116, 1), (177, 2), (101, 2), (37, 2), (180, 2), (46, 2), (18, 2), (167, 2)])",7.0 +spreading_minbudget,12.766175799999928,200.0,0.5,"(48, [(164, 1), (25, 1), (153, 1), (13, 1), (48, 1), (49, 1), (55, 1), (58, 1), (65, 1), (68, 1), (74, 1), (104, 1), (105, 1), (115, 1), (127, 1), (130, 1), (136, 1), (147, 1), (148, 1), (154, 1), (163, 1), (169, 1), (175, 1), (186, 1), (199, 1), (21, 1), (33, 1), (39, 1), (62, 1), (73, 1), (107, 1), (128, 1), (129, 1), (131, 1), (137, 1), (145, 1), (151, 1), (171, 1), (179, 1), (192, 1), (3, 1), (34, 1), (133, 1), (135, 1), (196, 1), (97, 1), (181, 1), (188, 1)])",48.0 +heuristic_minbudget,6.033393199999864,200.0,0.5,"(47, [(153, 1), (21, 1), (129, 1), (179, 1), (58, 1), (127, 1), (128, 1), (62, 1), (148, 1), (130, 1), (169, 1), (136, 1), (163, 1), (13, 1), (25, 1), (65, 1), (181, 1), (74, 1), (107, 1), (133, 1), (147, 1), (145, 1), (192, 1), (171, 1), (33, 1), (137, 1), (3, 1), (154, 1), (115, 1), (105, 1), (186, 1), (131, 1), (135, 1), (188, 1), (151, 1), (34, 1), (39, 1), (49, 1), (199, 1), (48, 1), (68, 1), (175, 1), (73, 1), (104, 1), (196, 1), (55, 1), (97, 1)])",47.0 +spreading_minbudget,0.9267372000003888,200.0,0.8,"(3, [(174, 1), (8, 1), (185, 1)])",3.0 +heuristic_minbudget,9.790458599999964,200.0,0.8,"(3, [(174, 1), (8, 1), (185, 1)])",3.0 +spreading_minbudget,24.84882149999976,400.0,0.1,"(24, [(386, 1), (17, 1), (112, 1), (179, 1), (90, 1), (47, 1), (186, 1), (314, 1), (180, 1), (197, 1), (96, 1), (116, 1), (3, 1), (227, 1), (6, 1), (133, 1), (219, 1), (296, 1), (353, 1), (177, 1), (370, 1), (206, 1), (152, 1), (130, 1)])",24.0 +heuristic_minbudget,2.065748699999858,400.0,0.1,"(16, [(227, 1), (296, 1), (130, 1), (219, 1), (370, 1), (177, 1), (152, 1), (353, 1), (116, 1), (206, 1), (133, 1), (3, 1), (6, 1), (121, 1), (162, 1), (390, 1), (309, 2), (161, 2), (203, 2), (290, 2), (28, 2), (166, 2), (31, 2), (327, 2), (346, 2), (98, 2), (178, 2), (188, 2), (18, 2), (26, 2), (64, 2), (71, 2)])",16.0 +spreading_minbudget,36.50080590000016,400.0,0.5,"(59, [(344, 1), (52, 1), (113, 1), (39, 1), (83, 1), (87, 1), (117, 1), (131, 1), (135, 1), (139, 1), (159, 1), (208, 1), (226, 1), (232, 1), (245, 1), (258, 1), (271, 1), (300, 1), (314, 1), (356, 1), (358, 1), (362, 1), (363, 1), (371, 1), (393, 1), (6, 1), (13, 1), (21, 1), (65, 1), (78, 1), (91, 1), (124, 1), (145, 1), (186, 1), (199, 1), (252, 1), (299, 1), (317, 1), (319, 1), (332, 1), (336, 1), (14, 1), (101, 1), (149, 1), (168, 1), (173, 1), (293, 1), (295, 1), (10, 1), (61, 1), (80, 1), (224, 1), (249, 1), (350, 1), (390, 1), (205, 1), (376, 1), (394, 1), (37, 1)])",59.0 +heuristic_minbudget,34.908457700000326,400.0,0.5,"(58, [(14, 1), (319, 1), (21, 1), (258, 1), (232, 1), (10, 1), (65, 1), (139, 1), (245, 1), (91, 1), (168, 1), (61, 1), (356, 1), (117, 1), (362, 1), (52, 1), (186, 1), (317, 1), (393, 1), (101, 1), (390, 1), (13, 1), (252, 1), (39, 1), (80, 1), (145, 1), (135, 1), (199, 1), (394, 1), (299, 1), (113, 1), (208, 1), (358, 1), (149, 1), (271, 1), (87, 1), (295, 1), (83, 1), (131, 1), (371, 1), (78, 1), (300, 1), (226, 1), (205, 1), (336, 1), (376, 1), (249, 1), (314, 1), (159, 1), (293, 1), (363, 1), (173, 1), (37, 1), (124, 1), (224, 1), (6, 1), (350, 1), (332, 1)])",58.0 +spreading_minbudget,49.45423810000011,400.0,0.8,"(100, [(99, 1), (13, 1), (19, 1), (27, 1), (31, 1), (34, 1), (40, 1), (51, 1), (52, 1), (57, 1), (60, 1), (77, 1), (82, 1), (85, 1), (90, 1), (94, 1), (102, 1), (105, 1), (106, 1), (107, 1), (108, 1), (109, 1), (113, 1), (120, 1), (121, 1), (128, 1), (131, 1), (132, 1), (142, 1), (150, 1), (153, 1), (157, 1), (159, 1), (169, 1), (171, 1), (174, 1), (177, 1), (184, 1), (188, 1), (194, 1), (201, 1), (202, 1), (203, 1), (208, 1), (223, 1), (230, 1), (236, 1), (239, 1), (247, 1), (258, 1), (271, 1), (272, 1), (274, 1), (275, 1), (279, 1), (282, 1), (293, 1), (296, 1), (298, 1), (300, 1), (307, 1), (311, 1), (313, 1), (314, 1), (318, 1), (321, 1), (322, 1), (324, 1), (325, 1), (337, 1), (343, 1), (346, 1), (347, 1), (350, 1), (351, 1), (359, 1), (363, 1), (371, 1), (375, 1), (386, 1), (387, 1), (392, 1), (396, 1), (398, 1), (2, 1), (4, 1), (48, 1), (56, 1), (80, 1), (101, 1), (125, 1), (141, 1), (262, 1), (268, 1), (327, 1), (340, 1), (380, 1), (246, 1), (304, 1), (195, 1)])",100.0 +heuristic_minbudget,115.43122799999992,400.0,0.8,"(100, [(101, 1), (107, 1), (371, 1), (85, 1), (174, 1), (300, 1), (318, 1), (150, 1), (392, 1), (350, 1), (142, 1), (201, 1), (208, 1), (325, 1), (13, 1), (153, 1), (131, 1), (48, 1), (258, 1), (380, 1), (132, 1), (106, 1), (298, 1), (40, 1), (275, 1), (105, 1), (157, 1), (202, 1), (113, 1), (80, 1), (346, 1), (268, 1), (52, 1), (19, 1), (169, 1), (120, 1), (82, 1), (102, 1), (159, 1), (274, 1), (262, 1), (304, 1), (351, 1), (396, 1), (296, 1), (246, 1), (272, 1), (141, 1), (51, 1), (128, 1), (60, 1), (99, 1), (188, 1), (230, 1), (271, 1), (236, 1), (77, 1), (109, 1), (94, 1), (314, 1), (322, 1), (108, 1), (387, 1), (327, 1), (313, 1), (2, 1), (34, 1), (279, 1), (340, 1), (343, 1), (398, 1), (239, 1), (293, 1), (57, 1), (363, 1), (194, 1), (386, 1), (171, 1), (195, 1), (203, 1), (375, 1), (247, 1), (177, 1), (311, 1), (337, 1), (324, 1), (321, 1), (125, 1), (184, 1), (347, 1), (31, 1), (359, 1), (121, 1), (307, 1), (282, 1), (4, 1), (56, 1), (90, 1), (223, 1), (27, 1)])",100.0