From a02baa907ffa2a700013987cae25dc197ac63b69 Mon Sep 17 00:00:00 2001 From: ramkri123 Date: Sun, 11 Mar 2018 22:33:39 -0300 Subject: Example Minizinc Placement Models for 5G Issue-ID: OPTFRA-173 Change-Id: I245e64764d8dd6e9e254a79a97a7d49e228b125a Signed-off-by: ramkri123 --- .../5g-placement-scheduling/README | 10 ++ .../5g-placement-scheduling/gold-1.dzn | 116 +++++++++++++++++++++ .../5g-placement-scheduling/gold-2.dzn | 116 +++++++++++++++++++++ .../5g-placement-scheduling/gold-3.dzn | 116 +++++++++++++++++++++ .../5g-placement-scheduling/gold-4.dzn | 116 +++++++++++++++++++++ .../5g-placement-scheduling/gold.dzn | 116 +++++++++++++++++++++ .../5g-placement-scheduling/network-slicing.ipynb | 77 ++++++++++++++ .../5g-placement-scheduling/placement.mzn | 104 ++++++++++++++++++ 8 files changed, 771 insertions(+) create mode 100644 examples/placement-models-minizinc/5g-placement-scheduling/README create mode 100755 examples/placement-models-minizinc/5g-placement-scheduling/gold-1.dzn create mode 100755 examples/placement-models-minizinc/5g-placement-scheduling/gold-2.dzn create mode 100755 examples/placement-models-minizinc/5g-placement-scheduling/gold-3.dzn create mode 100755 examples/placement-models-minizinc/5g-placement-scheduling/gold-4.dzn create mode 100755 examples/placement-models-minizinc/5g-placement-scheduling/gold.dzn create mode 100644 examples/placement-models-minizinc/5g-placement-scheduling/network-slicing.ipynb create mode 100755 examples/placement-models-minizinc/5g-placement-scheduling/placement.mzn diff --git a/examples/placement-models-minizinc/5g-placement-scheduling/README b/examples/placement-models-minizinc/5g-placement-scheduling/README new file mode 100644 index 0000000..210e3e8 --- /dev/null +++ b/examples/placement-models-minizinc/5g-placement-scheduling/README @@ -0,0 +1,10 @@ +Build docker image: +------------------ +sudo docker build --network=host -t placement-example . + +Run Jupyter lab demo: +--------------------- +sudo docker run --name placement-example --network=host -it placement-example /bin/bash -c 'cd /osdf/examples/placement-models-minizinc/vdns-plus-vfw-use-case; jupyter lab --port= --ip= --allow-root placement-minizinc.ipynb' + +Usage Example: + sudo docker run --name placement-example --network=host -it placement-example /bin/bash -c 'cd /osdf/examples/placement-models-minizinc/vdns-plus-vfw-use-case; jupyter lab --port=8181 --ip=10.172.161.6 --allow-root placement-minizinc.ipynb' diff --git a/examples/placement-models-minizinc/5g-placement-scheduling/gold-1.dzn b/examples/placement-models-minizinc/5g-placement-scheduling/gold-1.dzn new file mode 100755 index 0000000..eafacdd --- /dev/null +++ b/examples/placement-models-minizinc/5g-placement-scheduling/gold-1.dzn @@ -0,0 +1,116 @@ +% enum CUST_TYPES = { STANDARD, SILVER, GOLD }; +% enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV }; +% enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION }; +% enum CLOUD_REGION_CAPACITY = {CPU_CLOUD, MEMORY_CLOUD}; + +NCR = 8; % e-dc-1,2,3,4,5 core-dc-6,7,8 +N_ATTR = 4; +N_UTILIZATION_METRICS = 2; +N_CAPM = 2; +N_VMS = 3; +C_ALLOC_THRESHOLD = 0.65; +CUST_ALLOC_THRESHOLD = 0.95; +AVG_CPU_UTILIZATION_THRESHOLD = 0.7; +PEAK_CPU_UTILIZATION_THRESHOLD = 0.95; + +cust_type = GOLD; +N_WL = 5; +MIN_GUAR_ADDL_WT = 1000; + +u_lat = 0; +u_lon = 0; +cr_lat = [0, 1, 2, 3, 4, 100, 100, 100]; +cr_lon = [0, 1, 2, 3, 4, 100, 100, 100]; +dist_norm = 1000.0; +max_dist_ue = 3.0; + +% enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV }; +w_attr = [0.1, 0.7, 0.1, 0.1]; +capabilities = [| 0, 1, 0, 1 % edge dc 1 + | 0, 1, 1, 1 % edge dc 2 + | 0, 1, 0, 0 % edge dc 3 + | 0, 1, 0, 1 % edge dc 4 + | 0, 1, 0, 1 % edge dc 5 + | 1, 0, 1, 0 % core dc 6 + | 1, 0, 0, 0 % core dc 7 + | 1, 0, 0, 0 |];% core dc 8 + +% enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION }; +w_metrics = [0.9, 0.1]; +cpu_utilization = [| 0.1, 0.5 + | 0.1, 0.5 + | 0.1, 0.5 + | 0.1, 0.5 + | 0.1, 0.5 + | 0.6, 0.8 + | 0.6, 0.8 + | 0.6, 0.8 |]; + +c_alloc_capacity = [| 600, 1200 + | 600, 1200 + | 600, 1200 + | 600, 1200 + | 600, 1200 + | 2400, 4800 + | 2400, 4800 + | 2400, 4800 |]; + +c_total_capacity = [| 1000, 2000 + | 1000, 2000 + | 1000, 2000 + | 1000, 2000 + | 1000, 2000 + | 4000, 8000 + | 4000, 8000 + | 4000, 8000 |]; + +c_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +cust_alloc_capacity = [| 60, 120 + | 60, 120 + | 60, 120 + | 60, 120 + | 60, 120 + | 240, 480 + | 240, 480 + | 240, 480 |]; + +cust_total_capacity = [| 100, 200 + | 100, 200 + | 100, 200 + | 100, 200 + | 100, 200 + | 400, 800 + | 400, 800 + | 400, 800 |]; + +cust_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +vm_reqs = [| 1, 4 + | 2, 8 + | 4, 16 |]; + +%vm_reqs_sums = [ 14, 56 ]; + +vm_reqs_sums_norm = [| 0.007, 0.014 + | 0.007, 0.014 + | 0.007, 0.014 + | 0.007, 0.014 + | 0.007, 0.014 + | 0.00175, 0.0035 + | 0.00175, 0.0035 + | 0.00175, 0.0035 |]; diff --git a/examples/placement-models-minizinc/5g-placement-scheduling/gold-2.dzn b/examples/placement-models-minizinc/5g-placement-scheduling/gold-2.dzn new file mode 100755 index 0000000..b821a5a --- /dev/null +++ b/examples/placement-models-minizinc/5g-placement-scheduling/gold-2.dzn @@ -0,0 +1,116 @@ +% enum CUST_TYPES = { STANDARD, SILVER, GOLD }; +% enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV }; +% enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION }; +% enum CLOUD_REGION_CAPACITY = {CPU_CLOUD, MEMORY_CLOUD}; + +NCR = 8; % e-dc-1,2,3,4,5 core-dc-6,7,8 +N_ATTR = 4; +N_UTILIZATION_METRICS = 2; +N_CAPM = 2; +N_VMS = 3; +C_ALLOC_THRESHOLD = 0.65; +CUST_ALLOC_THRESHOLD = 0.95; +AVG_CPU_UTILIZATION_THRESHOLD = 0.7; +PEAK_CPU_UTILIZATION_THRESHOLD = 0.95; + +cust_type = GOLD; +N_WL = 5; +MIN_GUAR_ADDL_WT = 1000; + +u_lat = 1; +u_lon = 1; +cr_lat = [0, 1, 2, 3, 4, 100, 100, 100]; +cr_lon = [0, 1, 2, 3, 4, 100, 100, 100]; +dist_norm = 1000.0; +max_dist_ue = 3.0; + +% enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV }; +w_attr = [0.1, 0.7, 0.1, 0.1]; +capabilities = [| 0, 1, 0, 1 % edge dc 1 + | 0, 1, 1, 1 % edge dc 2 + | 0, 1, 0, 0 % edge dc 3 + | 0, 1, 0, 1 % edge dc 4 + | 0, 1, 0, 1 % edge dc 5 + | 1, 0, 1, 0 % core dc 6 + | 1, 0, 0, 0 % core dc 7 + | 1, 0, 0, 0 |];% core dc 8 + +% enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION }; +w_metrics = [0.9, 0.1]; +cpu_utilization = [| 0.1, 0.5 + | 0.1, 0.5 + | 0.1, 0.5 + | 0.1, 0.5 + | 0.1, 0.5 + | 0.6, 0.8 + | 0.6, 0.8 + | 0.6, 0.8 |]; + +c_alloc_capacity = [| 600, 1200 + | 600, 1200 + | 600, 1200 + | 600, 1200 + | 600, 1200 + | 2400, 4800 + | 2400, 4800 + | 2400, 4800 |]; + +c_total_capacity = [| 1000, 2000 + | 1000, 2000 + | 1000, 2000 + | 1000, 2000 + | 1000, 2000 + | 4000, 8000 + | 4000, 8000 + | 4000, 8000 |]; + +c_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +cust_alloc_capacity = [| 60, 120 + | 60, 120 + | 60, 120 + | 60, 120 + | 60, 120 + | 240, 480 + | 240, 480 + | 240, 480 |]; + +cust_total_capacity = [| 100, 200 + | 100, 200 + | 100, 200 + | 100, 200 + | 100, 200 + | 400, 800 + | 400, 800 + | 400, 800 |]; + +cust_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +vm_reqs = [| 1, 4 + | 2, 8 + | 4, 16 |]; + +%vm_reqs_sums = [ 14, 56 ]; + +vm_reqs_sums_norm = [| 0.007, 0.014 + | 0.007, 0.014 + | 0.007, 0.014 + | 0.007, 0.014 + | 0.007, 0.014 + | 0.00175, 0.0035 + | 0.00175, 0.0035 + | 0.00175, 0.0035 |]; diff --git a/examples/placement-models-minizinc/5g-placement-scheduling/gold-3.dzn b/examples/placement-models-minizinc/5g-placement-scheduling/gold-3.dzn new file mode 100755 index 0000000..84af4bc --- /dev/null +++ b/examples/placement-models-minizinc/5g-placement-scheduling/gold-3.dzn @@ -0,0 +1,116 @@ +% enum CUST_TYPES = { STANDARD, SILVER, GOLD }; +% enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV }; +% enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION }; +% enum CLOUD_REGION_CAPACITY = {CPU_CLOUD, MEMORY_CLOUD}; + +NCR = 8; % e-dc-1,2,3,4,5 core-dc-6,7,8 +N_ATTR = 4; +N_UTILIZATION_METRICS = 2; +N_CAPM = 2; +N_VMS = 3; +C_ALLOC_THRESHOLD = 0.65; +CUST_ALLOC_THRESHOLD = 0.95; +AVG_CPU_UTILIZATION_THRESHOLD = 0.7; +PEAK_CPU_UTILIZATION_THRESHOLD = 0.95; + +cust_type = GOLD; +N_WL = 5; +MIN_GUAR_ADDL_WT = 1000; + +u_lat = 3; +u_lon = 3; +cr_lat = [0, 1, 2, 3, 4, 100, 100, 100]; +cr_lon = [0, 1, 2, 3, 4, 100, 100, 100]; +dist_norm = 1000.0; +max_dist_ue = 3.0; + +% enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV }; +w_attr = [0.1, 0.7, 0.1, 0.1]; +capabilities = [| 0, 1, 0, 1 % edge dc 1 + | 0, 1, 1, 1 % edge dc 2 + | 0, 1, 0, 0 % edge dc 3 + | 0, 1, 0, 1 % edge dc 4 + | 0, 1, 0, 1 % edge dc 5 + | 1, 0, 1, 0 % core dc 6 + | 1, 0, 0, 0 % core dc 7 + | 1, 0, 0, 0 |];% core dc 8 + +% enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION }; +w_metrics = [0.9, 0.1]; +cpu_utilization = [| 0.1, 0.5 + | 0.1, 0.5 + | 0.1, 0.5 + | 0.1, 0.5 + | 0.1, 0.5 + | 0.6, 0.8 + | 0.6, 0.8 + | 0.6, 0.8 |]; + +c_alloc_capacity = [| 600, 1200 + | 600, 1200 + | 600, 1200 + | 600, 1200 + | 600, 1200 + | 2400, 4800 + | 2400, 4800 + | 2400, 4800 |]; + +c_total_capacity = [| 1000, 2000 + | 1000, 2000 + | 1000, 2000 + | 1000, 2000 + | 1000, 2000 + | 4000, 8000 + | 4000, 8000 + | 4000, 8000 |]; + +c_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +cust_alloc_capacity = [| 60, 120 + | 60, 120 + | 60, 120 + | 60, 120 + | 60, 120 + | 240, 480 + | 240, 480 + | 240, 480 |]; + +cust_total_capacity = [| 100, 200 + | 100, 200 + | 100, 200 + | 100, 200 + | 100, 200 + | 400, 800 + | 400, 800 + | 400, 800 |]; + +cust_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +vm_reqs = [| 1, 4 + | 2, 8 + | 4, 16 |]; + +%vm_reqs_sums = [ 14, 56 ]; + +vm_reqs_sums_norm = [| 0.007, 0.014 + | 0.007, 0.014 + | 0.007, 0.014 + | 0.007, 0.014 + | 0.007, 0.014 + | 0.00175, 0.0035 + | 0.00175, 0.0035 + | 0.00175, 0.0035 |]; diff --git a/examples/placement-models-minizinc/5g-placement-scheduling/gold-4.dzn b/examples/placement-models-minizinc/5g-placement-scheduling/gold-4.dzn new file mode 100755 index 0000000..172766b --- /dev/null +++ b/examples/placement-models-minizinc/5g-placement-scheduling/gold-4.dzn @@ -0,0 +1,116 @@ +% enum CUST_TYPES = { STANDARD, SILVER, GOLD }; +% enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV }; +% enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION }; +% enum CLOUD_REGION_CAPACITY = {CPU_CLOUD, MEMORY_CLOUD}; + +NCR = 8; % e-dc-1,2,3,4,5 core-dc-6,7,8 +N_ATTR = 4; +N_UTILIZATION_METRICS = 2; +N_CAPM = 2; +N_VMS = 3; +C_ALLOC_THRESHOLD = 0.65; +CUST_ALLOC_THRESHOLD = 0.95; +AVG_CPU_UTILIZATION_THRESHOLD = 0.7; +PEAK_CPU_UTILIZATION_THRESHOLD = 0.95; + +cust_type = GOLD; +N_WL = 5; +MIN_GUAR_ADDL_WT = 1000; + +u_lat = 3; +u_lon = 3; +cr_lat = [0, 1, 2, 3, 4, 100, 100, 100]; +cr_lon = [0, 1, 2, 3, 4, 100, 100, 100]; +dist_norm = 1000.0; +max_dist_ue = 3.0; + +% enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV }; +w_attr = [0.1, 0.7, 0.1, 0.1]; +capabilities = [| 0, 1, 0, 1 % edge dc 1 + | 0, 1, 1, 1 % edge dc 2 + | 0, 1, 0, 0 % edge dc 3 + | 0, 1, 0, 1 % edge dc 4 + | 0, 1, 0, 1 % edge dc 5 + | 1, 0, 1, 0 % core dc 6 + | 1, 0, 0, 0 % core dc 7 + | 1, 0, 0, 0 |];% core dc 8 + +% enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION }; +w_metrics = [0.9, 0.1]; +cpu_utilization = [| 0.1, 0.5 + | 0.1, 0.96 + | 0.1, 0.5 + | 0.1, 0.5 + | 0.1, 0.5 + | 0.6, 0.8 + | 0.6, 0.8 + | 0.6, 0.8 |]; + +c_alloc_capacity = [| 600, 1200 + | 600, 1200 + | 600, 1200 + | 600, 1200 + | 600, 1200 + | 2400, 4800 + | 2400, 4800 + | 2400, 4800 |]; + +c_total_capacity = [| 1000, 2000 + | 1000, 2000 + | 1000, 2000 + | 1000, 2000 + | 1000, 2000 + | 4000, 8000 + | 4000, 8000 + | 4000, 8000 |]; + +c_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +cust_alloc_capacity = [| 60, 120 + | 60, 120 + | 60, 120 + | 60, 120 + | 60, 120 + | 240, 480 + | 240, 480 + | 240, 480 |]; + +cust_total_capacity = [| 100, 200 + | 100, 200 + | 100, 200 + | 100, 200 + | 100, 200 + | 400, 800 + | 400, 800 + | 400, 800 |]; + +cust_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +vm_reqs = [| 1, 4 + | 2, 8 + | 4, 16 |]; + +%vm_reqs_sums = [ 14, 56 ]; + +vm_reqs_sums_norm = [| 0.007, 0.014 + | 0.007, 0.014 + | 0.007, 0.014 + | 0.007, 0.014 + | 0.007, 0.014 + | 0.00175, 0.0035 + | 0.00175, 0.0035 + | 0.00175, 0.0035 |]; diff --git a/examples/placement-models-minizinc/5g-placement-scheduling/gold.dzn b/examples/placement-models-minizinc/5g-placement-scheduling/gold.dzn new file mode 100755 index 0000000..eafacdd --- /dev/null +++ b/examples/placement-models-minizinc/5g-placement-scheduling/gold.dzn @@ -0,0 +1,116 @@ +% enum CUST_TYPES = { STANDARD, SILVER, GOLD }; +% enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV }; +% enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION }; +% enum CLOUD_REGION_CAPACITY = {CPU_CLOUD, MEMORY_CLOUD}; + +NCR = 8; % e-dc-1,2,3,4,5 core-dc-6,7,8 +N_ATTR = 4; +N_UTILIZATION_METRICS = 2; +N_CAPM = 2; +N_VMS = 3; +C_ALLOC_THRESHOLD = 0.65; +CUST_ALLOC_THRESHOLD = 0.95; +AVG_CPU_UTILIZATION_THRESHOLD = 0.7; +PEAK_CPU_UTILIZATION_THRESHOLD = 0.95; + +cust_type = GOLD; +N_WL = 5; +MIN_GUAR_ADDL_WT = 1000; + +u_lat = 0; +u_lon = 0; +cr_lat = [0, 1, 2, 3, 4, 100, 100, 100]; +cr_lon = [0, 1, 2, 3, 4, 100, 100, 100]; +dist_norm = 1000.0; +max_dist_ue = 3.0; + +% enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV }; +w_attr = [0.1, 0.7, 0.1, 0.1]; +capabilities = [| 0, 1, 0, 1 % edge dc 1 + | 0, 1, 1, 1 % edge dc 2 + | 0, 1, 0, 0 % edge dc 3 + | 0, 1, 0, 1 % edge dc 4 + | 0, 1, 0, 1 % edge dc 5 + | 1, 0, 1, 0 % core dc 6 + | 1, 0, 0, 0 % core dc 7 + | 1, 0, 0, 0 |];% core dc 8 + +% enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION }; +w_metrics = [0.9, 0.1]; +cpu_utilization = [| 0.1, 0.5 + | 0.1, 0.5 + | 0.1, 0.5 + | 0.1, 0.5 + | 0.1, 0.5 + | 0.6, 0.8 + | 0.6, 0.8 + | 0.6, 0.8 |]; + +c_alloc_capacity = [| 600, 1200 + | 600, 1200 + | 600, 1200 + | 600, 1200 + | 600, 1200 + | 2400, 4800 + | 2400, 4800 + | 2400, 4800 |]; + +c_total_capacity = [| 1000, 2000 + | 1000, 2000 + | 1000, 2000 + | 1000, 2000 + | 1000, 2000 + | 4000, 8000 + | 4000, 8000 + | 4000, 8000 |]; + +c_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +cust_alloc_capacity = [| 60, 120 + | 60, 120 + | 60, 120 + | 60, 120 + | 60, 120 + | 240, 480 + | 240, 480 + | 240, 480 |]; + +cust_total_capacity = [| 100, 200 + | 100, 200 + | 100, 200 + | 100, 200 + | 100, 200 + | 400, 800 + | 400, 800 + | 400, 800 |]; + +cust_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +vm_reqs = [| 1, 4 + | 2, 8 + | 4, 16 |]; + +%vm_reqs_sums = [ 14, 56 ]; + +vm_reqs_sums_norm = [| 0.007, 0.014 + | 0.007, 0.014 + | 0.007, 0.014 + | 0.007, 0.014 + | 0.007, 0.014 + | 0.00175, 0.0035 + | 0.00175, 0.0035 + | 0.00175, 0.0035 |]; diff --git a/examples/placement-models-minizinc/5g-placement-scheduling/network-slicing.ipynb b/examples/placement-models-minizinc/5g-placement-scheduling/network-slicing.ipynb new file mode 100644 index 0000000..4518603 --- /dev/null +++ b/examples/placement-models-minizinc/5g-placement-scheduling/network-slicing.ipynb @@ -0,0 +1,77 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!mzn-gecode placement.mzn gold-1.dzn" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!mzn-gecode placement.mzn gold-2.dzn" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!mzn-gecode placement.mzn gold-3.dzn" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!mzn-gecode placement.mzn gold-4.dzn" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!mzn-gecode placement.mzn gold-5.dzn" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.4" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/examples/placement-models-minizinc/5g-placement-scheduling/placement.mzn b/examples/placement-models-minizinc/5g-placement-scheduling/placement.mzn new file mode 100755 index 0000000..dc41f0c --- /dev/null +++ b/examples/placement-models-minizinc/5g-placement-scheduling/placement.mzn @@ -0,0 +1,104 @@ +include "globals.mzn"; + +int: NCR; % number of cloud regions +int: N_ATTR; % number of capability related attributes +array[1..N_ATTR] of float: w_attr; % weights of each attribute + +int: N_UTILIZATION_METRICS; % number of dynamic capacity metrics of interest +% set of 1..N_UTILIZATION_METRICS: U_METRICS; +array[1..N_UTILIZATION_METRICS] of float: w_metrics; % weights of each capacity metric + +int: cust_type; % customer type, 0 = regular, 1 = silver, 2 = gold +int: N_VMS; % number of VMs in VNF +int: N_CAPM; % number of metrics for cloud region capacity check +int: MIN_GUAR_ADDL_WT; % additional weight for min guarantee capability + +float: C_ALLOC_THRESHOLD; % allocation threshold for cloud +float: CUST_ALLOC_THRESHOLD; % allocation threshold for customer in cloud +float: AVG_CPU_UTILIZATION_THRESHOLD; +float: PEAK_CPU_UTILIZATION_THRESHOLD; + +int: u_lat; +int: u_lon; +float: dist_norm; +float: max_dist_ue; +array[1..NCR] of int: cr_lat; +array[1..NCR] of int: cr_lon; + +enum CUST_TYPES = { STANDARD, SILVER, GOLD }; +enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV }; +enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION }; +enum CLOUD_REGION_CAPACITY = {CPU_CLOUD, MEMORY_CLOUD}; +enum WL_TYPES = { W1, W2, W3, W4, W5 }; +int: N_WL; + +% set of 1..N_CAPM: CAP_METRICS; + +% whether a cloud region has the corresponding capability -- data will be customer specific +array[1..NCR, 1..N_ATTR] of int: capabilities; +array[1..NCR, 1..N_UTILIZATION_METRICS] of float: cpu_utilization; % how much capacity is already dynamically utilized (fraction) +array[1..NCR, 1..N_CAPM] of int: c_alloc_capacity; % how much percent is already allocated in the cloud +array[1..NCR, 1..N_CAPM] of int: c_total_capacity; % total cloud capacity +array[1..NCR, 1..N_CAPM] of float: c_alloc_capacity_norm; +array[1..NCR, 1..N_CAPM] of int: cust_alloc_capacity; % how much percent is already allocated in the cloud for the customer +array[1..NCR, 1..N_CAPM] of int: cust_total_capacity; % total cloud capacity for customer +array[1..NCR, 1..N_CAPM] of float: cust_alloc_capacity_norm; + +% VM requirements for each type of capacity (vm cpu, memory, etc.) +% TODO: establish a standard for units (MB RAM, GB disk, N virtual cores, etc.) +array[1..N_VMS, 1..N_CAPM] of int: vm_reqs; +array[1..N_CAPM] of int: vm_reqs_sums = [ sum(k in 1..N_VMS) (vm_reqs[k,j]) | j in 1..N_CAPM ]; +array[1..NCR, 1..N_CAPM] of float: vm_reqs_sums_norm; +%forall(i in 1..NCR, j in 1..N_CAPM) ( +% vm_reqs_sums_norm[i, j] = vm_reqs_sums[j]/c_total_capacity[i, j] +%) +%array[1..NCR, 1..N_CAPM] of float: vm_reqs_sums_norm = [ ((vm_reqs_sums[j]/c_total_capacity[i,j]) | j in 1..N_CAPM) | i in 1..NCR ]; + +array[1..N_WL] of var int: s_regions; % target cloud regions (solution to the problem) + +function var float: dist(var int: x1, var int: y1, var int: x2, var int: y2) = (sqrt(pow((x1-x2),2) + pow((y1-y2),2)))/dist_norm; + +% custom constraints +constraint forall (s in s_regions) ( + cpu_utilization[s, AVG_CPU_UTILIZATION] <= AVG_CPU_UTILIZATION_THRESHOLD /\ % hard constraint: need some capacity available + cpu_utilization[s, PEAK_CPU_UTILIZATION] <= PEAK_CPU_UTILIZATION_THRESHOLD /\ % hard constraint: need some capacity available + cust_alloc_capacity[s, CPU_CLOUD] <= (CUST_ALLOC_THRESHOLD*(cust_total_capacity[s, CPU_CLOUD])) - (vm_reqs_sums[CPU_CLOUD]) /\ + cust_alloc_capacity[s, MEMORY_CLOUD] <= (CUST_ALLOC_THRESHOLD*(cust_total_capacity[s, MEMORY_CLOUD])) - (vm_reqs_sums[MEMORY_CLOUD]) /\ + c_alloc_capacity[s, CPU_CLOUD] <= (C_ALLOC_THRESHOLD*(c_total_capacity[s, CPU_CLOUD])) - (vm_reqs_sums[CPU_CLOUD]) /\ + c_alloc_capacity[s, MEMORY_CLOUD] <= (C_ALLOC_THRESHOLD*(c_total_capacity[s, MEMORY_CLOUD])) - (vm_reqs_sums[MEMORY_CLOUD]) +); + +% specific constraints based on the workload +constraint [capabilities[s_regions[x], CORE_DC] | x in WL_TYPES] = [1, 1, 0, 0, 0]; + +constraint forall (x in [W3, W4, W5]) +(dist(u_lat, u_lon, cr_lat[s_regions[x]], cr_lon[s_regions[x]]) < max_dist_ue/dist_norm); + +constraint all_different([s_regions[x] | x in WL_TYPES]); + +% custom soft constraint for gold customers -- give a large weight to Minimum Guarantee +var float: additional_obj = sum(s in s_regions) (bool2int(cust_type = GOLD) * capabilities[s, MIN_GUARANTEE] * MIN_GUAR_ADDL_WT); + +% TODO: global constraints (such as data validation) + +% Objective for utilization +var float: obj_c_capacity = sum(k in 1..N_CAPM, s in s_regions) ( + (1 - c_alloc_capacity_norm[s, k] - vm_reqs_sums_norm[s, k]) + +% (1 - cust_alloc_capacity_norm[s, k] - vm_reqs_sums_norm[s, k])); + (1 - cust_alloc_capacity_norm[s, k] - vm_reqs_sums_norm[s, k]) + + (1 - dist(u_lat, u_lon,cr_lat[s], cr_lon[s]))); + +% Objective for utilization +var float: obj_utilization = sum(k in 1..N_UTILIZATION_METRICS, s in s_regions) ( w_metrics[k] * (1 - cpu_utilization[s, k]) ); + +% Objective for capabilities +var float: obj_capabilities = sum(k in 1..N_ATTR, s in s_regions) ( w_attr[k] * capabilities[s, k] ); + +% Overall objective function +var float: obj = obj_c_capacity + obj_utilization + obj_capabilities + additional_obj; + +solve maximize obj; + +output [ "Solution: \n" + ++ concat(["Cloud Region for W" ++ format(x) ++ " = " ++ format(s_regions[x]) ++ "\n" | x in 1..N_WL]) ] + ++ [ "Objective function value: ", show(obj), "\n", "Customer type: ", show(cust_type), "\n"]; -- cgit 1.2.3-korg