예제 #1
0
파일: servers.py 프로젝트: ptkhoa1984/CNO
def test4():
    n = Network("../Networks/isno_5_2")
    filename = "../DataComposite/linear_structure.txt"
    loops = False
    t = ServicesTree(loops, filename)
    s = Servers(t, n, "../DataComposite/test-cost.txt")
    print(s)
예제 #2
0
파일: servers.py 프로젝트: ptkhoa1984/CNO
def test2():
    filename = "../DataComposite/linear_structure.txt"
    loops = False
    t = ServicesTree(loops, filename)
    s = Servers(t, None, "../DataComposite/isno_30_4-costs.txt")
    ## no capacities defined
    print(s)
예제 #3
0
def test_germany():
    network_file = "../Networks/germany50.txt"
    n = Network(network_file, "sndlib")

    filename_tree = "../DataComposite/linear_structure.txt"
    loops = False
    t = ServicesTree(loops, filename_tree)

    servers_file = "../DataComposite/germany50-cost.txt"
    s = Servers(t, n, servers_file)

    users_dem_file = "../DataComposite/germany50-users.txt"
    users_top_file = "../DataComposite/germany50-user_topo.txt"
    u = Users(n, users_dem_file, users_top_file)

    cs = CompositeServices(n, t, s, u, opt_cong=True, congestion_cost=True)

    print("Starting EA:")
    ea = EACompositeServices(cs)

    #bestsol = ea.run_evol_alg()
    bestsol = ea.run_evol_alg(True, max_cpus=50)

    of = cs.of_normalized_penalty(bestsol, True)
    print("Objective function:", of)
예제 #4
0
def test_sp():
    network_file = "../Networks/isno_30_4"
    #network_file = "../Networks/isno_5_2"
    n = Network(network_file)

    filename_tree = "../DataComposite/linear_structure.txt"
    loops = False
    t = ServicesTree(loops, filename_tree)

    #servers_file = "../DataComposite/test-cost.txt"
    servers_file = "../DataComposite/isno_30_4-t2-costs.txt"
    s = Servers(t, n, servers_file)

    #users_dem_file = "../DataComposite/test-users.txt"
    #users_top_file = "../DataComposite/test-user_topo.txt"
    users_dem_file = "../DataComposite/isno_30_4-t2-users.txt"
    users_top_file = "../DataComposite/isno_30_4-t2-user_topo.txt"
    u = Users(n, users_dem_file, users_top_file)

    cs = CompositeServices(n,
                           t,
                           s,
                           u,
                           opt_cong=True,
                           congestion_cost=True,
                           cong_opt_method="sp",
                           cong_of="fortz")

    print("Starting EA:")
    ea = EACompositeServices(cs, optimize_routing_weights=True)

    ea_par = {"max_evaluations": 50000}
    #bestsol = ea.run_evol_alg(ea_pars = ea_par)

    ea.run_evol_alg(True, max_cpus=4, ea_pars=ea_par)
예제 #5
0
def test_mo():
    network_file = "../Networks/geant.txt"
    n = Network(network_file, "sndlib")

    filename_tree = "../DataComposite/linear_structure.txt"
    loops = False
    t = ServicesTree(loops, filename_tree)

    servers_file = "../DataComposite/geant-t2-costs.txt"
    s = Servers(t, n, servers_file)

    users_dem_file = "../DataComposite/geant-t2-users.txt"
    users_top_file = "../DataComposite/geant-t2-user_topo.txt"
    u = Users(n, users_dem_file, users_top_file)

    cs = CompositeServices(n,
                           t,
                           s,
                           u,
                           opt_cong=True,
                           congestion_cost=True,
                           cong_of="fortz")

    ea_par = {"max_evaluations": 10000}
    ea = EACompositeServices(cs)
    #ea = EACompositeServices(cs,optimize_routing_weights = True)

    ea.run_mo(ea_pars=ea_par, plot=True)
예제 #6
0
def test1():
    n = Network("../Networks/isno_5_2")
    filename_tree = "../DataComposite/linear_structure.txt"
    loops = False
    t = ServicesTree(loops, filename_tree)
    s = Servers(t, n, "../DataComposite/isno_5_2-costs.txt")
    u = Users(n, "../DataComposite/isno_5_2-users.txt",
              "../DataComposite/isno_5_2-user_topo.txt")

    cs = CompositeServices(n,
                           t,
                           s,
                           u,
                           opt_cong=False,
                           congestion_cost=True,
                           cong_of="fortz")

    hcs = CompositeHeuristic(cs)

    order = list(range(len(cs.users)))

    sol = hcs.heuristic(order)

    print(sol)

    of = cs.of_normalized_penalty(sol, True)
    print("Objective function:", of)
예제 #7
0
def test_germany():
    network_file = "../Networks/germany50.txt"
    n = Network(network_file, "sndlib")

    filename_tree = "../DataComposite/linear_structure.txt"
    loops = False
    t = ServicesTree(loops, filename_tree)

    servers_file = "../DataComposite/germany50-cost.txt"
    s = Servers(t, n, servers_file)

    users_dem_file = "../DataComposite/germany50-users.txt"
    users_top_file = "../DataComposite/germany50-user_topo.txt"
    u = Users(n, users_dem_file, users_top_file)

    cs = CompositeServices(n, t, s, u, opt_cong=False, congestion_cost=False)

    hcs = CompositeHeuristic(cs)

    order = list(range(len(cs.users)))

    sol = hcs.heuristic(order)
    print(sol)

    of = cs.of_normalized_penalty(sol, True)
    print("Objective function:", of)
예제 #8
0
def test_tree():
    network_file = "../Networks/test_tree"
    n = Network(network_file)

    filename_tree = "../DataComposite/tree_structure.txt"
    loops = False
    t = ServicesTree(loops, filename_tree)

    servers_file = "../DataComposite/test_tree-cost.txt"
    s = Servers(t, n, servers_file)

    users_dem_file = "../DataComposite/test_tree-users.txt"
    users_top_file = "../DataComposite/test_tree-user_topo.txt"
    u = Users(n, users_dem_file, users_top_file)

    cs = CompositeServices(n, t, s, u, opt_cong=True, congestion_cost=True)

    print(cs)

    print("Starting EA:")
    ea = EACompositeServices(cs)
    ea_par = {"max_evaluations": 5000}
    bestsol = ea.run_evol_alg(ea_pars=ea_par)
    #bestsol = ea.run_evol_alg(True, max_cpus = 50)

    of = cs.of_normalized_penalty(bestsol, True)
    print("Objective function:", of)
예제 #9
0
파일: composite.py 프로젝트: 5g-media/CNO
def test4():
    filename_tree = "../DataComposite/linear_structure.txt"
    loops = True
    t = ServicesTree(loops, filename_tree)
    n = Network("../Networks/geant.txt", "sndlib")
    u = Users(n)
    u.generate_users(len(t), target_alu=0.3, target_delay=1.0)
    u.write_demands("../DataComposite/geant-lin-alu30-del10-users.txt")
예제 #10
0
파일: servers.py 프로젝트: ptkhoa1984/CNO
def test3():
    n = Network("../Networks/isno_5_2")
    filename = "../DataComposite/linear_structure.txt"
    loops = False
    t = ServicesTree(loops, filename)
    s = Servers(t, n)
    s.generate_servers(0.4, 100.0, 1.0)
    print(s)
    s.write_servers("../DataComposite/test-cost.txt")
예제 #11
0
파일: servers.py 프로젝트: ptkhoa1984/CNO
def test_germany():
    n = Network("../Networks/germany50.txt", "sndlib")
    filename = "../DataComposite/linear_structure.txt"
    loops = False
    t = ServicesTree(loops, filename)
    s = Servers(t, n)
    s.generate_servers(0.2, 100.0, 1.0)
    print(s)
    s.write_servers("../DataComposite/germany50-cost.txt")
예제 #12
0
파일: servers.py 프로젝트: ptkhoa1984/CNO
def test_tree_syn_geant():
    n = Network("./Networks/geant.txt", "sndlib")
    filename = "./DataComposite/tree_syn_structure.txt"
    loops = False
    t = ServicesTree(loops, filename)
    s = Servers(t, n)
    s.generate_servers(0.5, 20000.0, 1.0)
    print(s)
    s.write_servers("./DataComposite/geant-tree-syn-costs.txt")
예제 #13
0
파일: composite.py 프로젝트: 5g-media/CNO
def test2():
    n = Network("../Networks/isno_5_2")
    filename_tree = "../DataComposite/linear_structure.txt"
    loops = False
    t = ServicesTree(loops, filename_tree)
    s = Servers(t, n, "../DataComposite/test-cost.txt")
    u = Users(n, "../DataComposite/test-users.txt",
              "../DataComposite/test-user_topo.txt")

    cs = CompositeServices(n, t, s, u, opt_cong=True, congestion_cost=True)
    print(cs)
예제 #14
0
파일: composite.py 프로젝트: 5g-media/CNO
def test_tree_syn_structure():
    filename_tree = "../DataComposite/tree_syn_structure.txt"
    loops = False
    t = ServicesTree(loops, filename_tree)
    n = Network("../Networks/geant.txt", "sndlib")
    u = Users(n)
    u.generate_users(len(t), target_alu=0.25, target_delay=0.8)
    u.write_demands("../DataComposite/geant-treesyn-alu25-del08-users.txt")
    u.write_user_topo(
        "../DataComposite/geant-treesyn-alu25-del08-user_topo.txt")
    s = Servers(t, n)
    s.generate_servers()
    s.write_servers("../DataComposite/geant-treesyn-alu25-del08-costs.txt")
예제 #15
0
파일: composite.py 프로젝트: 5g-media/CNO
def test3():
    filename_tree = "../DataComposite/linear_structure.txt"
    loops = False
    t = ServicesTree(loops, filename_tree)
    #n = Network("../Networks/isno_30_4")
    n = Network("../Networks/isno_5_2")
    u = Users(n)
    u.generate_users(len(t), target_alu=0.25, target_delay=0.8)
    u.write_demands("../DataComposite/isno_5_2-t2-users.txt")
    u.write_user_topo("../DataComposite/isno_5_2-t2-user_topo.txt")
    #u.write_demands("../DataComposite/isno_30_4-t1-users.txt")
    #u.write_user_topo("../DataComposite/isno_30_4-t1-user_topo.txt")
    s = Servers(t, n)
    s.generate_servers()
    s.write_servers("../DataComposite/isno_5_2-t2-costs.txt")
예제 #16
0
파일: composite.py 프로젝트: 5g-media/CNO
def test5():
    filename_tree = "../DataComposite/tree_syn_structure.txt"
    loops = False
    t = ServicesTree(loops, filename_tree)
    n = Network("../Networks/geant.txt", "sndlib")

    s = Servers(t, n, "../DataComposite/geant-tree-syn-costs.txt")
    u = Users(n, "../DataComposite/geant-tree-syn-users.txt",
              "../DataComposite/geant-tree-syn-user_topo.txt")

    cs = CompositeServices(n, t, s, u, opt_cong=False, congestion_cost=False)

    #print(cs)

    print(cs.min_cost())
    print(cs.minimum_first_hop())
예제 #17
0
파일: composite.py 프로젝트: 5g-media/CNO
def test1():
    from composite_heuristic import CompositeHeuristic
    n = Network("../Networks/isno_5_2")
    filename_tree = "../DataComposite/linear_structure.txt"
    loops = False
    t = ServicesTree(loops, filename_tree)
    s = Servers(t, n, "../DataComposite/isno_5_2-costs.txt")
    u = Users(n, "../DataComposite/isno_5_2-users-v2.txt",
              "../DataComposite/isno_5_2-user_topo.txt")

    cs = CompositeServices(n, t, s, u, opt_cong=True, congestion_cost=True)
    #print(cs)

    hcs = CompositeHeuristic(cs)
    order = list(range(len(cs.users)))
    sol = hcs.heuristic(order)
    cs.of_normalized_penalty(sol, printcomps=True)
예제 #18
0
def test_geant():
    network_file = "../Networks/geant.txt"
    n = Network(network_file, "sndlib")

    #filename_tree = "../DataComposite/tree_syn_structure.txt"
    filename_tree = "../DataComposite/linear_structure_loops.txt"
    loops = True
    t = ServicesTree(loops, filename_tree)

    #servers_file = "../DataComposite/geant-loops-costs.txt"
    servers_file = "../DataComposite/geant-lin-alu30-del09-costs.txt"

    s = Servers(t, n, servers_file)

    #users_dem_file = "../DataComposite/geant-treeloops-alu25-del07-users.txt"
    users_dem_file = "../DataComposite/geant-lin-alu30-del09-users.txt"
    #users_top_file = "../DataComposite/geant-treeloops-alu25-del07-user_topo.txt"
    users_top_file = "../DataComposite/geant-user_topo.txt"

    u = Users(n, users_dem_file, users_top_file)

    #    cs = CompositeServices(n, t, s, u, opt_cong = True, cong_opt_method = "sp",
    #                           congestion_cost = True, cong_of = "fortz")

    cs = CompositeServices(n,
                           t,
                           s,
                           u,
                           opt_cong=False,
                           congestion_cost=False,
                           cong_of="fortz")

    ea_par = {"max_evaluations": 20000, "pop_size": 100}
    ea = EACompositeServices(cs)
    #ea = EACompositeServices(cs,optimize_routing_weights = True)

    assig = ea.run_evol_alg(ea_pars=ea_par)

    print("Best solution:")
    print(assig)
예제 #19
0
def test1():
    #etwork_file = "../Networks/isno_30_4"
    network_file = "../Networks/isno_5_2"
    n = Network(network_file)

    filename_tree = "../DataComposite/linear_structure.txt"
    loops = False
    t = ServicesTree(loops, filename_tree)

    #servers_file = "../DataComposite/test-cost.txt"
    #servers_file = "../DataComposite/isno_30_4-t1-costs.txt"
    servers_file = "../DataComposite/isno_5_2-t1-costs.txt"
    s = Servers(t, n, servers_file)

    #users_dem_file = "../DataComposite/test-users.txt"
    #users_top_file = "../DataComposite/test-user_topo.txt"
    #users_dem_file = "../DataComposite/isno_30_4-t1-users.txt"
    #users_top_file = "../DataComposite/isno_30_4-t1-user_topo.txt"
    users_dem_file = "../DataComposite/isno_5_2-t2-users.txt"
    users_top_file = "../DataComposite/isno_5_2-t1-user_topo.txt"

    u = Users(n, users_dem_file, users_top_file)

    cs = CompositeServices(n,
                           t,
                           s,
                           u,
                           opt_cong=False,
                           congestion_cost=True,
                           cong_of="fortz")

    print("Starting EA:")
    ea_par = {"max_evaluations": 500}
    ea = EACompositeServices(cs)

    assig = ea.run_evol_alg(ea_pars=ea_par)
    #assig = ea.run_evol_alg(True, max_cpus = 50)

    print("Best solution:")
    print(assig)
예제 #20
0
def test2():
    network_file = "../Networks/isno_30_4"
    #network_file = "../Networks/isno_5_2"
    n = Network(network_file)

    filename_tree = "../DataComposite/linear_structure.txt"
    loops = False
    t = ServicesTree(loops, filename_tree)

    #servers_file = "../DataComposite/test-cost.txt"
    servers_file = "../DataComposite/isno_30_4-t1-costs.txt"
    s = Servers(t, n, servers_file)

    #users_dem_file = "../DataComposite/test-users.txt"
    #sers_top_file = "../DataComposite/test-user_topo.txt"
    users_dem_file = "../DataComposite/isno_30_4-t1-users.txt"
    users_top_file = "../DataComposite/isno_30_4-t1-user_topo.txt"
    u = Users(n, users_dem_file, users_top_file)

    cs = CompositeServices(n,
                           t,
                           s,
                           u,
                           opt_cong=False,
                           congestion_cost=True,
                           cong_of="mlu")

    hcs = CompositeHeuristic(cs)

    order = list(range(len(cs.users)))

    sol = hcs.heuristic(order)
    print(sol)

    of = cs.of_normalized_penalty(sol, True)
    print("Objective function:", of)
예제 #21
0
def test1():
    #network_file = "../Networks/isno_30_4"
    network_file = "../Networks/geant.txt"
    n = Network(network_file, "sndlib")

    filename_tree = "../DataComposite/linear_structure.txt"
    loops = False
    t = ServicesTree(loops, filename_tree)

    #    servers_file = "../DataComposite/isno_30_4-t1-costs.txt"
    servers_file = "../DataComposite/geant-t3-costs.txt"
    s = Servers(t, n, servers_file)

    users_dem_file = "../DataComposite/geant-t3-users.txt"
    #    users_dem_file = "../DataComposite/isno_30_4-t1-users.txt"
    users_top_file = "../DataComposite/geant-t3-user_topo.txt"
    #    users_top_file = "../DataComposite/isno_30_4-t1-user_topo.txt"
    u = Users(n, users_dem_file, users_top_file)

    cs = CompositeServices(n,
                           t,
                           s,
                           u,
                           opt_cong=True,
                           congestion_cost=True,
                           cong_opt_method="sp",
                           cong_of="fortz")

    print("Starting EA:")
    ea = DeapComposite(cs, optimize_routing_weights=True)

    #ea.run_evol_alg({"num_gens": 100})

    _, _, f = ea.run_mo({"max_evaluations": 10000, "algorithm": "spea"})

    numpy.savetxt("front.csv", f)
예제 #22
0
def run():
    ## FORMAT: type_optimization network_file services_tree instance_file results_file
    ## type_optimization:
    ##      nc - no congestion
    ##      d - congestion costs; shortest path delays
    ##      sp - congestion costs; EA optimizing weights
    ##      oc - congestion costs; MILP optimizaing congestion
    ## lnc, ld, lsp, loc - the same as before but with loops on the service tree

    ## network file - assuming sndlib format
    ## services tree - file with "tree" of services
    ## instance_file - defines "name" of instance
    ## assuming: instance_file + "-users.txt" - users demands
    ## assuming: instance_file + "-user_topo.txt" - users topologies
    ## assuming: instance_file + "-costs.txt" - server costs
    ## results_file: prefix of the files for results
    ## - files will be results_file + "-stats.txt" and results_file+ "-pop.txt"
    ## Options:
    ## -mo - do multiobjective optimization (NSGA 2)
    ## -p numcpus - activates parallel evaluation of OF with numcpus as maximum
    ## -ev maxevals - maximum number of evaluations (default: 10000)
    ## -mr rate - set mutation rate (per element)
    ## -lr rate - local opt rate (per individual)
    ## -r runs - number of runs (1 if not specified)
    ## -w weights - weights for the OF - fh, e2e, cost, congestion (split by ,)

    network_file = sys.argv[2]
    n = Network(network_file, "sndlib")  #, engine = "igraph")

    filename_tree = sys.argv[3]
    if sys.argv[1][0] == "l":
        loops = True
    else:
        loops = False
    t = ServicesTree(loops, filename_tree)

    servers_file = sys.argv[4] + "-costs.txt"
    s = Servers(t, n, servers_file)

    users_dem_file = sys.argv[4] + "-users.txt"
    users_top_file = sys.argv[4] + "-user_topo.txt"
    u = Users(n, users_dem_file, users_top_file)

    optimize_routing_weig = False
    if sys.argv[1] == "nc" or sys.argv[1] == "lnc":
        cs = CompositeServices(n,
                               t,
                               s,
                               u,
                               opt_cong=False,
                               congestion_cost=False,
                               cong_of="fortz")
    elif sys.argv[1] == "d" or sys.argv[1] == "ld":
        cs = CompositeServices(n,
                               t,
                               s,
                               u,
                               opt_cong=False,
                               congestion_cost=True,
                               cong_of="fortz")
    elif sys.argv[1] == "oc" or sys.argv[1] == "loc":
        cs = CompositeServices(n,
                               t,
                               s,
                               u,
                               opt_cong=True,
                               congestion_cost=True,
                               cong_opt_method="milp",
                               cong_of="fortz")
    elif sys.argv[1] == "sp" or sys.argv[1] == "lsp":
        cs = CompositeServices(n,
                               t,
                               s,
                               u,
                               opt_cong=True,
                               congestion_cost=True,
                               cong_opt_method="sp",
                               cong_of="fortz")
        optimize_routing_weig = True

    ## options
    par = False
    maxcpus = 1
    multiobj = False
    numruns = 1
    eapars = {}
    if len(sys.argv) > 6:
        i = 6
        while i < len(sys.argv):
            if sys.argv[i] == "-p":
                par = True
                maxcpus = int(sys.argv[i + 1])
                i += 2
            elif sys.argv[i] == "-mo":
                multiobj = True
                i += 1
            elif sys.argv[i] == "-ev":
                eapars["max_evaluations"] = int(sys.argv[i + 1])
                i += 2
            elif sys.argv[i] == "-mr":
                eapars["mutation_rate"] = float(sys.argv[i + 1])
                i += 2
            elif sys.argv[i] == "-lr":
                eapars["local_opt_rate"] = float(sys.argv[i + 1])
                i += 2
            elif sys.argv[i] == "-r":
                numruns = int(sys.argv[i + 1])
                i += 2
            elif sys.argv[i] == "-w":
                wstr = sys.argv[i + 1]
                tokens = wstr.split(",")
                w = {}
                w["fh"] = float(tokens[0])
                w["e2e"] = float(tokens[1])
                w["cost"] = float(tokens[2])
                if cs.congestion_cost and len(tokens) > 3:
                    w["congestion"] = float(tokens[3])
                cs.set_weights(w)
                print(cs.weights)
                i += 2
            else:
                print("Invalid option")
                sys.exit(1)

    res = {}

    if multiobj:
        res_keys = [
            "type", "network", "tree", "instance", "popsize", "evals",
            "mutation_rate", "local_rate"
        ]
    else:
        res_keys = [
            "type", "network", "tree", "instance", "popsize", "evals",
            "selected", "elites", "mutation_rate", "local_rate", "of_value",
            "of_cost", "of_e2e", "of_fh", "of_cong"
        ]

    for k in res_keys:
        res[k] = []

    network_name = sys.argv[2].split("/").pop()
    tree_name = sys.argv[3].split("/").pop()
    instance_name = sys.argv[4].split("/").pop()

    for r in range(numruns):

        start = timeit.default_timer()

        ea = EACompositeServices(
            cs, optimize_routing_weights=optimize_routing_weig)

        res["type"].append(sys.argv[1])
        res["network"].append(network_name)
        res["tree"].append(tree_name)
        res["instance"].append(instance_name)

        if multiobj:
            file_run = sys.argv[5] + "-run" + str(r)
            res_ea = ea.run_mo(ea_pars=eapars,
                               display=False,
                               save_file=file_run)

            #res["popsize"].append(res_ea["popsize"])
            #res["evals"].append(res_ea["evals"])
            #res["mutation_rate"].append(res_ea["mutation_rate"])
            #res["local_rate"].append(res_ea["local_rate"])

            #res_pd = pd.DataFrame(data = res)
            #res_pd.to_csv(sys.argv[5] + "-results.csv")
        else:
            if sys.argv[5] == 'None':
                _, res_ea = ea.run_evol_alg(parallel=par,
                                            max_cpus=maxcpus,
                                            ea_pars=eapars)
            else:
                file_run = sys.argv[5] + "-run" + str(r)
                _, res_ea = ea.run_evol_alg(parallel=par,
                                            max_cpus=maxcpus,
                                            ea_pars=eapars,
                                            save_file=file_run)

                res["of_value"].append(res_ea["of_value"])
                res["of_fh"].append(res_ea["of_fh"])
                res["of_e2e"].append(res_ea["of_e2e"])
                res["of_cost"].append(res_ea["of_cost"])
                res["of_cong"].append(res_ea["of_cong"])

                res["popsize"].append(res_ea["popsize"])
                res["evals"].append(res_ea["evals"])
                res["selected"].append(res_ea["selected"])
                res["elites"].append(res_ea["elites"])
                res["mutation_rate"].append(res_ea["mutation_rate"])
                res["local_rate"].append(res_ea["local_rate"])

                res_pd = pd.DataFrame(data=res)
                res_pd.to_csv(sys.argv[5] + "-results.csv")

        stop = timeit.default_timer()
        print('Time EA: ', stop - start)
예제 #23
0
def run():
    ## FORMAT: type_optimization network_file services_tree instance_file
    ## type_optimization:
    ##      nc - no congestion
    ##      d - congestion costs; shortest path delays
    ##      oc - congestion costs; MILP optimizaing congestion
    ## network file - assuming sndlib format
    ## services tree - file with "tree" of services
    ## instance_file - defines "name" of instance
    ## assuming: instance_file + "-users.txt" - users demands
    ## assuming: instance_file + "-user_topo.txt" - users topologies
    ## assuming: instance_file + "-costs.txt" - server costs

    network_file = sys.argv[2]
    n = Network(network_file, "sndlib")

    filename_tree = sys.argv[3]
    loops = False
    t = ServicesTree(loops, filename_tree)

    servers_file = sys.argv[4] + "-costs.txt"
    s = Servers(t, n, servers_file)

    users_dem_file = sys.argv[4] + "-users.txt"
    users_top_file = sys.argv[4] + "-user_topo.txt"
    u = Users(n, users_dem_file, users_top_file)

    if sys.argv[1] == "nc":
        cs = CompositeServices(n,
                               t,
                               s,
                               u,
                               opt_cong=False,
                               congestion_cost=False,
                               cong_of="fortz")
    elif sys.argv[1] == "d":
        cs = CompositeServices(n,
                               t,
                               s,
                               u,
                               opt_cong=False,
                               congestion_cost=True,
                               cong_of="fortz")
    elif sys.argv[1] == "oc":
        cs = CompositeServices(n,
                               t,
                               s,
                               u,
                               opt_cong=True,
                               congestion_cost=True,
                               cong_opt_method="milp",
                               cong_of="fortz")
    else:
        print("Type of optimization not defined")
        sys.exit(1)

    hcs = CompositeHeuristic(cs)
    order = list(range(len(cs.users)))
    sol = hcs.heuristic(order)

    of = cs.of_normalized_penalty(sol, True)

    if not cs.congestion_cost:  ## reporting congestion even if not used in the optimization
        dem = cs.generate_e2e_demands(sol.dic_assig)
        l = Loads(n)
        l.add_loads_from_paths(cs.del_paths, dem)
        if cs.cong_of == "mlu": cong = l.mlu()[0]
        elif cs.cong_of == "alu": cong = l.alu()
        elif cs.cong_of == "fortz":
            co = CongestionOptimization(n, dem)
            phiu = co.phi_uncap()
            cong = l.fortz_of(phiu) - 1.0
        print("Congestion (not optimized):", cong)

    print("Objective function:", of)