From aa358e298d345da0582ad1ea3b496bb44650a4f1 Mon Sep 17 00:00:00 2001 From: ramkri123 Date: Tue, 27 Feb 2018 14:52:49 -0800 Subject: Minizinc Placement Model Ex. for vDNS+vFW use case Issue-ID: OPTFRA-153 Change-Id: I228e638e4c5bfb2cabd970c571077f3ebaf01ece Signed-off-by: ramkri123 --- .../gold-no-min-guarantee.dzn | 62 +++ .../vdns-plus-vfw-use-case/gold.dzn | 62 +++ .../normal-silver-less-pref.dzn | 57 +++ .../placement-minizinc.ipynb | 466 +++++++++++++++++++++ .../vdns-plus-vfw-use-case/placement.mzn | 89 ++++ .../silver-high-edge-load.dzn | 62 +++ .../vdns-plus-vfw-use-case/silver.dzn | 62 +++ ...ervice-gold-customer-model-driven-placement.dzn | 16 + .../vDNS-service-model-driven-placement.mzn | 40 ++ ...S-service-no-edge-dc-model-driven-placement.dzn | 16 + ...vice-silver-customer-model-driven-placement.dzn | 16 + ...ervice-gold-customer-model-driven-placement.dzn | 16 - .../vDNS-service-model-driven-placement.mzn | 40 -- ...S-service-no-edge-dc-model-driven-placement.dzn | 16 - ...vice-silver-customer-model-driven-placement.dzn | 16 - 15 files changed, 948 insertions(+), 88 deletions(-) create mode 100755 examples/placement-models-minizinc/vdns-plus-vfw-use-case/gold-no-min-guarantee.dzn create mode 100755 examples/placement-models-minizinc/vdns-plus-vfw-use-case/gold.dzn create mode 100755 examples/placement-models-minizinc/vdns-plus-vfw-use-case/normal-silver-less-pref.dzn create mode 100755 examples/placement-models-minizinc/vdns-plus-vfw-use-case/placement-minizinc.ipynb create mode 100755 examples/placement-models-minizinc/vdns-plus-vfw-use-case/placement.mzn create mode 100755 examples/placement-models-minizinc/vdns-plus-vfw-use-case/silver-high-edge-load.dzn create mode 100755 examples/placement-models-minizinc/vdns-plus-vfw-use-case/silver.dzn create mode 100644 examples/placement-models-minizinc/vdns-use-case/vDNS-service-gold-customer-model-driven-placement.dzn create mode 100644 examples/placement-models-minizinc/vdns-use-case/vDNS-service-model-driven-placement.mzn create mode 100644 examples/placement-models-minizinc/vdns-use-case/vDNS-service-no-edge-dc-model-driven-placement.dzn create mode 100644 examples/placement-models-minizinc/vdns-use-case/vDNS-service-silver-customer-model-driven-placement.dzn delete mode 100644 minizinc-examples/vDNS-service-gold-customer-model-driven-placement.dzn delete mode 100644 minizinc-examples/vDNS-service-model-driven-placement.mzn delete mode 100644 minizinc-examples/vDNS-service-no-edge-dc-model-driven-placement.dzn delete mode 100644 minizinc-examples/vDNS-service-silver-customer-model-driven-placement.dzn diff --git a/examples/placement-models-minizinc/vdns-plus-vfw-use-case/gold-no-min-guarantee.dzn b/examples/placement-models-minizinc/vdns-plus-vfw-use-case/gold-no-min-guarantee.dzn new file mode 100755 index 0000000..f1f67e9 --- /dev/null +++ b/examples/placement-models-minizinc/vdns-plus-vfw-use-case/gold-no-min-guarantee.dzn @@ -0,0 +1,62 @@ +% 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}; + +N_CLOUD_REGIONS = 3; % e-dc-1, core-dc-1, core-dc-2 +N_ATTRIBUTES = 4; +N_UTILIZATION_METRICS = 2; +N_CAPACITY_METRICS = 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_VNFS = 1; + +w_metrics = [0.9, 0.1]; +w_attributes = [0.1, 0.9, 0.05, 0.05]; + +capabilities = [| 0, 1, 1, 1 + | 1, 0, 0, 1 + | 1, 1, 0, 1 |]; + +cpu_utilization = [| 0.05, 0.9 + | 0.1, 0.5 + | 0.6, 0.8 |]; + +c_alloc_capacity = [| 600, 1200 + | 1200, 2400 + | 2400, 4800 |]; + +c_total_capacity = [| 1000, 2000 + | 2000, 4000 + | 4000, 8000 |]; + +c_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +cust_alloc_capacity = [| 60, 120 + | 120, 240 + | 240, 480 |]; + +cust_total_capacity = [| 100, 200 + | 200, 400 + | 400, 800 |]; + +cust_alloc_capacity_norm = [| 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.0035, 0.007 + | 0.00175, 0.0035 |]; diff --git a/examples/placement-models-minizinc/vdns-plus-vfw-use-case/gold.dzn b/examples/placement-models-minizinc/vdns-plus-vfw-use-case/gold.dzn new file mode 100755 index 0000000..451e795 --- /dev/null +++ b/examples/placement-models-minizinc/vdns-plus-vfw-use-case/gold.dzn @@ -0,0 +1,62 @@ +% 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}; + +N_CLOUD_REGIONS = 3; % e-dc-1, core-dc-1, core-dc-2 +N_ATTRIBUTES = 4; +N_UTILIZATION_METRICS = 2; +N_CAPACITY_METRICS = 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_VNFS = 1; + +w_metrics = [0.9, 0.1]; +w_attributes = [0.1, 0.9, 0.05, 0.05]; + +capabilities = [| 0, 1, 1, 1 + | 1, 0, 1, 1 + | 1, 1, 0, 1 |]; + +cpu_utilization = [| 0.05, 0.9 + | 0.1, 0.5 + | 0.6, 0.8 |]; + +c_alloc_capacity = [| 600, 1200 + | 1200, 2400 + | 2400, 4800 |]; + +c_total_capacity = [| 1000, 2000 + | 2000, 4000 + | 4000, 8000 |]; + +c_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +cust_alloc_capacity = [| 60, 120 + | 120, 240 + | 240, 480 |]; + +cust_total_capacity = [| 100, 200 + | 200, 400 + | 400, 800 |]; + +cust_alloc_capacity_norm = [| 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.0035, 0.007 + | 0.00175, 0.0035 |]; diff --git a/examples/placement-models-minizinc/vdns-plus-vfw-use-case/normal-silver-less-pref.dzn b/examples/placement-models-minizinc/vdns-plus-vfw-use-case/normal-silver-less-pref.dzn new file mode 100755 index 0000000..1184ece --- /dev/null +++ b/examples/placement-models-minizinc/vdns-plus-vfw-use-case/normal-silver-less-pref.dzn @@ -0,0 +1,57 @@ +N_CLOUD_REGIONS = 3; % e-dc-1, core-dc-1, core-dc-2 +N_ATTRIBUTES = 4; +N_UTILIZATION_METRICS = 2; +N_CAPACITY_METRICS = 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 = SILVER; + +w_metrics = [0.9, 0.1]; +w_attributes = [0, 0.9, 0.05, 0.05]; + +%{ CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV }; +capabilities = [| 0, 1, 1, 1 + | 1, 0, 1, 1 + | 1, 1, 0, 1 |]; + +cpu_utilization = [| 0.05, 0.9 + | 0.5, 0.94 + | 0.5, 0.94 |]; + +c_alloc_capacity = [| 600, 1200 + | 1200, 2400 + | 2400, 4800 |]; + +c_total_capacity = [| 1000, 2000 + | 2000, 4000 + | 4000, 8000 |]; + +c_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +cust_alloc_capacity = [| 60, 120 + | 120, 240 + | 240, 480 |]; + +cust_total_capacity = [| 100, 200 + | 200, 400 + | 400, 800 |]; + +cust_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +vm_reqs = [| 2, 8 + | 4, 16 + | 8, 32 |]; + +%vm_reqs_sums = [ 14, 56 ]; + +vm_reqs_sums_norm = [| 0.014, 0.028 + | 0.007, 0.014 + | 0.0035, 0.007 |]; diff --git a/examples/placement-models-minizinc/vdns-plus-vfw-use-case/placement-minizinc.ipynb b/examples/placement-models-minizinc/vdns-plus-vfw-use-case/placement-minizinc.ipynb new file mode 100755 index 0000000..68ab73b --- /dev/null +++ b/examples/placement-models-minizinc/vdns-plus-vfw-use-case/placement-minizinc.ipynb @@ -0,0 +1,466 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "int: N_CLOUD_REGIONS; % number of cloud regions\n", + "% set of 1..N_CLOUD_REGIONS: C_REGIONS;\n", + "\n", + "int: N_ATTRIBUTES; % number of capability related attributes\n", + "% set of 1..N_ATTRIBUTES: ATTRIBS;\n", + "array[1..N_ATTRIBUTES] of float: w_attributes; % weights of each attribute\n", + "\n", + "int: N_UTILIZATION_METRICS; % number of dynamic capacity metrics of interest\n", + "% set of 1..N_UTILIZATION_METRICS: U_METRICS;\n", + "array[1..N_UTILIZATION_METRICS] of float: w_metrics; % weights of each capacity metric\n", + "\n", + "int: cust_type; % customer type, 0 = regular, 1 = silver, 2 = gold\n", + "int: N_VMS; % number of VMs in VNF\n", + "int: N_CAPACITY_METRICS; % number of metrics for cloud region capacity check\n", + "\n", + "float: C_ALLOC_THRESHOLD; % allocation threshold for cloud\n", + "float: CUST_ALLOC_THRESHOLD; % allocation threshold for customer in cloud\n", + "float: AVG_CPU_UTILIZATION_THRESHOLD;\n", + "float: PEAK_CPU_UTILIZATION_THRESHOLD;\n", + "\n", + "enum CUST_TYPES = { STANDARD, SILVER, GOLD };\n", + "enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV };\n", + "enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION };\n", + "enum CLOUD_REGION_CAPACITY = {CPU_CLOUD, MEMORY_CLOUD};\n", + "enum VNFS_TYPES = { VDNS, VFW };\n", + "int: N_VNFS;\n", + "\n", + "% set of 1..N_CAPACITY_METRICS: CAP_METRICS;\n", + "\n", + "% whether a cloud region has the corresponding capability -- data will be customer specific\n", + "% array[1..N_CLOUD_REGIONS, 1..N_CLOUD_REGIONS] of float: c_dist;\n", + "array[1..N_CLOUD_REGIONS, 1..N_ATTRIBUTES] of int: capabilities;\n", + "array[1..N_CLOUD_REGIONS, 1..N_UTILIZATION_METRICS] of float: cpu_utilization; % how much capacity is already dynamically utilized (fraction)\n", + "array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] of int: c_alloc_capacity; % how much percent is already allocated in the cloud\n", + "array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] of int: c_total_capacity; % total cloud capacity\n", + "array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] of float: c_alloc_capacity_norm;\n", + "array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] of int: cust_alloc_capacity; % how much percent is already allocated in the cloud for the customer\n", + "array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] of int: cust_total_capacity; % total cloud capacity for customer\n", + "array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] of float: cust_alloc_capacity_norm;\n", + "\n", + "% VM requirements for each type of capacity (vm cpu, memory, etc.)\n", + "% TODO: establish a standard for units (MB RAM, GB disk, N virtual cores, etc.)\n", + "array[1..N_VMS, 1..N_CAPACITY_METRICS] of int: vm_reqs;\n", + "array[1..N_CAPACITY_METRICS] of int: vm_reqs_sums = [ sum(k in 1..N_VMS) (vm_reqs[k,j]) | j in 1..N_CAPACITY_METRICS ];\n", + "array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] of float: vm_reqs_sums_norm;\n", + "%forall(i in 1..N_CLOUD_REGIONS, j in 1..N_CAPACITY_METRICS) (\n", + "% vm_reqs_sums_norm[i, j] = vm_reqs_sums[j]/c_total_capacity[i, j]\n", + "%)\n", + "%array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] of float: vm_reqs_sums_norm = [ ((vm_reqs_sums[j]/c_total_capacity[i,j]) | j in 1..N_CAPACITY_METRICS) | i in 1..N_CLOUD_REGIONS ];\n", + "\n", + "array[1..N_VNFS] of var int: s_regions; % target cloud regions (solution to the problem)\n", + "\n", + "% custom constraints\n", + "constraint forall (s in s_regions) (\n", + " cpu_utilization[s, AVG_CPU_UTILIZATION] <= AVG_CPU_UTILIZATION_THRESHOLD /\\ % hard constraint: need some capacity available\n", + " cpu_utilization[s, PEAK_CPU_UTILIZATION] <= PEAK_CPU_UTILIZATION_THRESHOLD /\\ % hard constraint: need some capacity available\n", + " cust_alloc_capacity[s, CPU_CLOUD] <= (CUST_ALLOC_THRESHOLD*(cust_total_capacity[s, CPU_CLOUD])) - (vm_reqs_sums[CPU_CLOUD]) /\\\n", + " cust_alloc_capacity[s, MEMORY_CLOUD] <= (CUST_ALLOC_THRESHOLD*(cust_total_capacity[s, MEMORY_CLOUD])) - (vm_reqs_sums[MEMORY_CLOUD]) /\\\n", + " c_alloc_capacity[s, CPU_CLOUD] <= (C_ALLOC_THRESHOLD*(c_total_capacity[s, CPU_CLOUD])) - (vm_reqs_sums[CPU_CLOUD]) /\\\n", + " c_alloc_capacity[s, MEMORY_CLOUD] <= (C_ALLOC_THRESHOLD*(c_total_capacity[s, MEMORY_CLOUD])) - (vm_reqs_sums[MEMORY_CLOUD])\n", + ");\n", + "\n", + "% specific constraints based on the VNF\n", + "constraint capabilities[s_regions[VDNS], CORE_DC] = 1; % hard constraint for vDNS: has to be placed in CORE DC\n", + "\n", + "% custom soft constraint for gold customers -- give a large weight to direct connection\n", + "var float: additional_obj = sum(s in s_regions) (bool2int(cust_type = GOLD) * capabilities[s, MIN_GUARANTEE] * 1000);\n", + "\n", + "% TODO: global constraints (such as data validation)\n", + "\n", + "% Objective for utilization\n", + "var float: obj_c_capacity = sum(k in 1..N_CAPACITY_METRICS, s in s_regions) (\n", + "\t\t (1 - c_alloc_capacity_norm[s, k] - vm_reqs_sums_norm[s, k]) +\n", + " (1 - cust_alloc_capacity_norm[s, k] - vm_reqs_sums_norm[s, k]));\n", + "\n", + "% Objective for utilization\n", + "var float: obj_utilization = sum(k in 1..N_UTILIZATION_METRICS, s in s_regions) ( w_metrics[k] * (1 - cpu_utilization[s, k]) );\n", + "\n", + "% Objective for capabilities\n", + "var float: obj_capabilities = sum(k in 1..N_ATTRIBUTES, s in s_regions) ( w_attributes[k] * capabilities[s, k] );\n", + "\n", + "% Overall objective function\n", + "var float: obj = obj_c_capacity + obj_utilization + obj_capabilities + additional_obj;\n", + "\n", + "solve maximize obj;\n", + "\n", + "output [ \"Solution: \\nCloud Region for vDNS = \", show(s_regions[VDNS]) ] \n", + "++ [ if N_VNFS = 2 then \"\\nCloud Region for vFW = \" ++ show(s_regions[VFW]) ++ \"\\n\" else \"\\n\" endif ]\n", + "++ [ \"Objective function value: \", show(obj), \"\\n\", \"Customer type: \", show(cust_type), \"\\n\"];\n" + ] + } + ], + "source": [ + "!cat placement.mzn" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "% enum CUST_TYPES = { STANDARD, SILVER, GOLD };\n", + "% enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV };\n", + "% enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION };\n", + "% enum CLOUD_REGION_CAPACITY = {CPU_CLOUD, MEMORY_CLOUD};\n", + "\n", + "N_CLOUD_REGIONS = 3; % e-dc-1, core-dc-1, core-dc-2\n", + "N_ATTRIBUTES = 4;\n", + "N_UTILIZATION_METRICS = 2;\n", + "N_CAPACITY_METRICS = 2;\n", + "N_VMS = 3;\n", + "C_ALLOC_THRESHOLD = 0.65;\n", + "CUST_ALLOC_THRESHOLD = 0.95;\n", + "AVG_CPU_UTILIZATION_THRESHOLD = 0.7;\n", + "PEAK_CPU_UTILIZATION_THRESHOLD = 0.95;\n", + "\n", + "cust_type = GOLD;\n", + "N_VNFS = 1;\n", + "\n", + "w_metrics = [0.9, 0.1];\n", + "w_attributes = [0.1, 0.9, 0.05, 0.05]; \n", + "\n", + "capabilities = [| 0, 1, 1, 1\n", + " | 1, 0, 1, 1\n", + " | 1, 1, 0, 1 |];\n", + "\n", + "cpu_utilization = [| 0.05, 0.9\n", + " | 0.1, 0.5\n", + " | 0.6, 0.8 |];\n", + "\n", + "c_alloc_capacity = [| 600, 1200\n", + " | 1200, 2400\n", + " | 2400, 4800 |];\n", + "\n", + "c_total_capacity = [| 1000, 2000\n", + " | 2000, 4000\n", + " | 4000, 8000 |];\n", + "\n", + "c_alloc_capacity_norm = [| 0.6, 0.6\n", + " | 0.6, 0.6\n", + " | 0.6, 0.6 |];\n", + "\n", + "cust_alloc_capacity = [| 60, 120\n", + " | 120, 240\n", + " | 240, 480 |];\n", + "\n", + "cust_total_capacity = [| 100, 200\n", + " | 200, 400\n", + " | 400, 800 |];\n", + "\n", + "cust_alloc_capacity_norm = [| 0.6, 0.6\n", + " | 0.6, 0.6\n", + " | 0.6, 0.6 |];\n", + "\n", + "vm_reqs = [| 1, 4\n", + " | 2, 8\n", + " | 4, 16 |];\n", + "\n", + "%vm_reqs_sums = [ 14, 56 ];\n", + "\n", + "vm_reqs_sums_norm = [| 0.007, 0.014\n", + " | 0.0035, 0.007\n", + " | 0.00175, 0.0035 |];\n" + ] + } + ], + "source": [ + "!cat gold.dzn" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "23c23\n", + "< | 1, 0, 1, 1\n", + "---\n", + "> | 1, 0, 0, 1\n" + ] + } + ], + "source": [ + "!diff gold.dzn gold-no-min-guarantee.dzn" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "23c23\n", + "< | 1, 0, 1, 1\n", + "---\n", + "> | 1, 0, 0, 1\n" + ] + } + ], + "source": [ + "!diff gold.dzn gold-no-min-guarantee.dzn" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "% enum CUST_TYPES = { STANDARD, SILVER, GOLD };\n", + "% enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV };\n", + "% enum METRICS = { AVG_CPU_UTILIZATION, PEAK_CPU_UTILIZATION };\n", + "% enum CLOUD_REGION_CAPACITY = {CPU_CLOUD, MEMORY_CLOUD};\n", + "\n", + "N_CLOUD_REGIONS = 3; % e-dc-1, core-dc-1, core-dc-2\n", + "N_ATTRIBUTES = 4;\n", + "N_UTILIZATION_METRICS = 2;\n", + "N_CAPACITY_METRICS = 2;\n", + "N_VMS = 3;\n", + "C_ALLOC_THRESHOLD = 0.65;\n", + "CUST_ALLOC_THRESHOLD = 0.95;\n", + "AVG_CPU_UTILIZATION_THRESHOLD = 0.7;\n", + "PEAK_CPU_UTILIZATION_THRESHOLD = 0.95;\n", + "\n", + "cust_type = SILVER;\n", + "N_VNFS = 2;\n", + "\n", + "w_metrics = [0.9, 0.1];\n", + "w_attributes = [0.1, 0.9, 0.05, 0.05]; \n", + "\n", + "capabilities = [| 0, 1, 1, 1\n", + " | 1, 0, 1, 1\n", + " | 1, 1, 0, 1 |];\n", + "\n", + "cpu_utilization = [| 0.05, 0.9\n", + " | 0.1, 0.5\n", + " | 0.6, 0.8 |];\n", + "\n", + "c_alloc_capacity = [| 600, 1200\n", + " | 1200, 2400\n", + " | 2400, 4800 |];\n", + "\n", + "c_total_capacity = [| 1000, 2000\n", + " | 2000, 4000\n", + " | 4000, 8000 |];\n", + "\n", + "c_alloc_capacity_norm = [| 0.6, 0.6\n", + " | 0.6, 0.6\n", + " | 0.6, 0.6 |];\n", + "\n", + "cust_alloc_capacity = [| 60, 120\n", + " | 120, 240\n", + " | 240, 480 |];\n", + "\n", + "cust_total_capacity = [| 100, 200\n", + " | 200, 400\n", + " | 400, 800 |];\n", + "\n", + "cust_alloc_capacity_norm = [| 0.6, 0.6\n", + " | 0.6, 0.6\n", + " | 0.6, 0.6 |];\n", + "\n", + "vm_reqs = [| 1, 4\n", + " | 2, 8\n", + " | 4, 16 |];\n", + "\n", + "%vm_reqs_sums = [ 14, 56 ];\n", + "\n", + "vm_reqs_sums_norm = [| 0.007, 0.014\n", + " | 0.0035, 0.007\n", + " | 0.00175, 0.0035 |];\n" + ] + } + ], + "source": [ + "!cat silver.dzn" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "26c26\n", + "< cpu_utilization = [| 0.05, 0.9\n", + "---\n", + "> cpu_utilization = [| 0.05, 0.96\n" + ] + } + ], + "source": [ + "!diff silver.dzn silver-high-edge-load.dzn" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution: \n", + "Cloud Region for vDNS = 2\n", + "Objective function value: 1002.639\n", + "Customer type: 3\n", + "----------\n", + "==========\n" + ] + } + ], + "source": [ + "!mzn-gecode -a placement.mzn gold.dzn" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution: \n", + "Cloud Region for vDNS = 2\n", + "Objective function value: 2.589\n", + "Customer type: 3\n", + "----------\n", + "Solution: \n", + "Cloud Region for vDNS = 3\n", + "Objective function value: 3.0195\n", + "Customer type: 3\n", + "----------\n", + "==========\n" + ] + } + ], + "source": [ + "!mzn-gecode -a placement.mzn gold-no-min-guarantee.dzn" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution: \n", + "Cloud Region for vDNS = 2\n", + "Cloud Region for vFW = 1\n", + "Objective function value: 6.062\n", + "Customer type: 2\n", + "----------\n", + "Solution: \n", + "Cloud Region for vDNS = 3\n", + "Cloud Region for vFW = 1\n", + "Objective function value: 6.4425\n", + "Customer type: 2\n", + "----------\n", + "==========\n" + ] + } + ], + "source": [ + "!mzn-gecode -a placement.mzn silver.dzn" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution: \n", + "Cloud Region for vDNS = 2\n", + "Cloud Region for vFW = 2\n", + "Objective function value: 5.278\n", + "Customer type: 2\n", + "----------\n", + "Solution: \n", + "Cloud Region for vDNS = 3\n", + "Cloud Region for vFW = 2\n", + "Objective function value: 5.6585\n", + "Customer type: 2\n", + "----------\n", + "Solution: \n", + "Cloud Region for vDNS = 3\n", + "Cloud Region for vFW = 3\n", + "Objective function value: 6.039\n", + "Customer type: 2\n", + "----------\n", + "==========\n" + ] + } + ], + "source": [ + "!mzn-gecode -a placement.mzn silver-high-edge-load.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/vdns-plus-vfw-use-case/placement.mzn b/examples/placement-models-minizinc/vdns-plus-vfw-use-case/placement.mzn new file mode 100755 index 0000000..ba66a4e --- /dev/null +++ b/examples/placement-models-minizinc/vdns-plus-vfw-use-case/placement.mzn @@ -0,0 +1,89 @@ +int: N_CLOUD_REGIONS; % number of cloud regions +% set of 1..N_CLOUD_REGIONS: C_REGIONS; + +int: N_ATTRIBUTES; % number of capability related attributes +% set of 1..N_ATTRIBUTES: ATTRIBS; +array[1..N_ATTRIBUTES] of float: w_attributes; % 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_CAPACITY_METRICS; % number of metrics for cloud region capacity check + +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; + +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 VNFS_TYPES = { VDNS, VFW }; +int: N_VNFS; + +% set of 1..N_CAPACITY_METRICS: CAP_METRICS; + +% whether a cloud region has the corresponding capability -- data will be customer specific +% array[1..N_CLOUD_REGIONS, 1..N_CLOUD_REGIONS] of float: c_dist; +array[1..N_CLOUD_REGIONS, 1..N_ATTRIBUTES] of int: capabilities; +array[1..N_CLOUD_REGIONS, 1..N_UTILIZATION_METRICS] of float: cpu_utilization; % how much capacity is already dynamically utilized (fraction) +array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] of int: c_alloc_capacity; % how much percent is already allocated in the cloud +array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] of int: c_total_capacity; % total cloud capacity +array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] of float: c_alloc_capacity_norm; +array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] of int: cust_alloc_capacity; % how much percent is already allocated in the cloud for the customer +array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] of int: cust_total_capacity; % total cloud capacity for customer +array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] 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_CAPACITY_METRICS] of int: vm_reqs; +array[1..N_CAPACITY_METRICS] of int: vm_reqs_sums = [ sum(k in 1..N_VMS) (vm_reqs[k,j]) | j in 1..N_CAPACITY_METRICS ]; +array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] of float: vm_reqs_sums_norm; +%forall(i in 1..N_CLOUD_REGIONS, j in 1..N_CAPACITY_METRICS) ( +% vm_reqs_sums_norm[i, j] = vm_reqs_sums[j]/c_total_capacity[i, j] +%) +%array[1..N_CLOUD_REGIONS, 1..N_CAPACITY_METRICS] of float: vm_reqs_sums_norm = [ ((vm_reqs_sums[j]/c_total_capacity[i,j]) | j in 1..N_CAPACITY_METRICS) | i in 1..N_CLOUD_REGIONS ]; + +array[1..N_VNFS] of var int: s_regions; % target cloud regions (solution to the problem) + +% 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 VNF +constraint capabilities[s_regions[VDNS], CORE_DC] = 1; % hard constraint for vDNS: has to be placed in CORE DC + +% custom soft constraint for gold customers -- give a large weight to direct connection +var float: additional_obj = sum(s in s_regions) (bool2int(cust_type = GOLD) * capabilities[s, MIN_GUARANTEE] * 1000); + +% TODO: global constraints (such as data validation) + +% Objective for utilization +var float: obj_c_capacity = sum(k in 1..N_CAPACITY_METRICS, 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])); + +% 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_ATTRIBUTES, s in s_regions) ( w_attributes[k] * capabilities[s, k] ); + +% Overall objective function +var float: obj = obj_c_capacity + obj_utilization + obj_capabilities + additional_obj; + +solve maximize obj; + +output [ "Solution: \nCloud Region for vDNS = ", show(s_regions[VDNS]) ] +++ [ if N_VNFS = 2 then "\nCloud Region for vFW = " ++ show(s_regions[VFW]) ++ "\n" else "\n" endif ] +++ [ "Objective function value: ", show(obj), "\n", "Customer type: ", show(cust_type), "\n"]; diff --git a/examples/placement-models-minizinc/vdns-plus-vfw-use-case/silver-high-edge-load.dzn b/examples/placement-models-minizinc/vdns-plus-vfw-use-case/silver-high-edge-load.dzn new file mode 100755 index 0000000..6323782 --- /dev/null +++ b/examples/placement-models-minizinc/vdns-plus-vfw-use-case/silver-high-edge-load.dzn @@ -0,0 +1,62 @@ +% 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}; + +N_CLOUD_REGIONS = 3; % e-dc-1, core-dc-1, core-dc-2 +N_ATTRIBUTES = 4; +N_UTILIZATION_METRICS = 2; +N_CAPACITY_METRICS = 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 = SILVER; +N_VNFS = 2; + +w_metrics = [0.9, 0.1]; +w_attributes = [0.1, 0.9, 0.05, 0.05]; + +capabilities = [| 0, 1, 1, 1 + | 1, 0, 1, 1 + | 1, 1, 0, 1 |]; + +cpu_utilization = [| 0.05, 0.96 + | 0.1, 0.5 + | 0.6, 0.8 |]; + +c_alloc_capacity = [| 600, 1200 + | 1200, 2400 + | 2400, 4800 |]; + +c_total_capacity = [| 1000, 2000 + | 2000, 4000 + | 4000, 8000 |]; + +c_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +cust_alloc_capacity = [| 60, 120 + | 120, 240 + | 240, 480 |]; + +cust_total_capacity = [| 100, 200 + | 200, 400 + | 400, 800 |]; + +cust_alloc_capacity_norm = [| 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.0035, 0.007 + | 0.00175, 0.0035 |]; diff --git a/examples/placement-models-minizinc/vdns-plus-vfw-use-case/silver.dzn b/examples/placement-models-minizinc/vdns-plus-vfw-use-case/silver.dzn new file mode 100755 index 0000000..4779a41 --- /dev/null +++ b/examples/placement-models-minizinc/vdns-plus-vfw-use-case/silver.dzn @@ -0,0 +1,62 @@ +% 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}; + +N_CLOUD_REGIONS = 3; % e-dc-1, core-dc-1, core-dc-2 +N_ATTRIBUTES = 4; +N_UTILIZATION_METRICS = 2; +N_CAPACITY_METRICS = 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 = SILVER; +N_VNFS = 2; + +w_metrics = [0.9, 0.1]; +w_attributes = [0.1, 0.9, 0.05, 0.05]; + +capabilities = [| 0, 1, 1, 1 + | 1, 0, 1, 1 + | 1, 1, 0, 1 |]; + +cpu_utilization = [| 0.05, 0.9 + | 0.1, 0.5 + | 0.6, 0.8 |]; + +c_alloc_capacity = [| 600, 1200 + | 1200, 2400 + | 2400, 4800 |]; + +c_total_capacity = [| 1000, 2000 + | 2000, 4000 + | 4000, 8000 |]; + +c_alloc_capacity_norm = [| 0.6, 0.6 + | 0.6, 0.6 + | 0.6, 0.6 |]; + +cust_alloc_capacity = [| 60, 120 + | 120, 240 + | 240, 480 |]; + +cust_total_capacity = [| 100, 200 + | 200, 400 + | 400, 800 |]; + +cust_alloc_capacity_norm = [| 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.0035, 0.007 + | 0.00175, 0.0035 |]; diff --git a/examples/placement-models-minizinc/vdns-use-case/vDNS-service-gold-customer-model-driven-placement.dzn b/examples/placement-models-minizinc/vdns-use-case/vDNS-service-gold-customer-model-driven-placement.dzn new file mode 100644 index 0000000..6a3222f --- /dev/null +++ b/examples/placement-models-minizinc/vdns-use-case/vDNS-service-gold-customer-model-driven-placement.dzn @@ -0,0 +1,16 @@ +N_CLOUD_REGIONS = 3; % e-dc-1, core-dc-1, core-dc-2 +N_ATTRIBUTES = 4; +N_METRICS = 2; + +CUST_TYPE = GOLD; + +W_METRICS = [0.9, 0.1]; +W_ATTRIBUTES = [0, 0.9, 0.05, 0.05]; + +capabilities = [| 0, 0, 1, 1 + | 1, 0, 1, 1 + | 1, 1, 0, 1 |]; + +utilization = [| 0.05, 0.9 + | 0.1, 0.5 + | 0.8, 0.98 |]; diff --git a/examples/placement-models-minizinc/vdns-use-case/vDNS-service-model-driven-placement.mzn b/examples/placement-models-minizinc/vdns-use-case/vDNS-service-model-driven-placement.mzn new file mode 100644 index 0000000..08292be --- /dev/null +++ b/examples/placement-models-minizinc/vdns-use-case/vDNS-service-model-driven-placement.mzn @@ -0,0 +1,40 @@ +int: N_CLOUD_REGIONS; % number of cloud regions + +int: N_ATTRIBUTES; % number of capability related attributes +array[1..N_ATTRIBUTES] of float: W_ATTRIBUTES; % weights of each attribute + +int: N_METRICS; % number of dynamic capacity metrics of interest +array[1..N_METRICS] of float: W_METRICS; % weights of each capacity metric + +int: CUST_TYPE; % customer type, 0 = regular, 1 = silver, 2 = gold + +enum CUST_TYPES = { STANDARD, SILVER, GOLD }; +enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV }; +enum METRICS = { AVG_UTILIZATION, PEAK_UTILIZATION }; + +% whether a cloud region has the corresponding capability -- data will be customer specific +array[1..N_CLOUD_REGIONS, 1..N_ATTRIBUTES] of int: capabilities; +array[1..N_CLOUD_REGIONS, 1..N_METRICS] of float: utilization; % how much capacity is already utilized (fraction) + +var int: s; % target cloud region (solution to the problem) + +% custom constraints +constraint capabilities[s, CORE_DC] = 1; % hard constraint: has to be placed in CORE DC +constraint utilization[s, AVG_UTILIZATION] <= 0.85; % hard constraint: need some capacity available +% custom soft constraint for gold customers -- give a large weight to direct connection +var float: additional_obj = bool2int(CUST_TYPE = GOLD) * capabilities[s, DIRECT_CONN] * 1000; + +% TODO: global constraints (such as data validation) + +% Objective for utilization +var float: obj_utilization = sum(k in 1..N_METRICS) ( W_METRICS[k] * (1 - utilization[s, k]) ); + +% Objective for capabilities +var float: obj_capabilities = sum(k in 1..N_ATTRIBUTES) ( W_ATTRIBUTES[k] * capabilities[s, k] ); + +% Overall objective function +var float: obj = obj_utilization + obj_capabilities + additional_obj; % can later add weights to each... + +solve maximize obj; + +output ["Cloud Region: ", show(s), "\n", "Objective function value: ", show(obj), "\n", "Customer type: ", show(CUST_TYPE), "\n"]; diff --git a/examples/placement-models-minizinc/vdns-use-case/vDNS-service-no-edge-dc-model-driven-placement.dzn b/examples/placement-models-minizinc/vdns-use-case/vDNS-service-no-edge-dc-model-driven-placement.dzn new file mode 100644 index 0000000..3a2a000 --- /dev/null +++ b/examples/placement-models-minizinc/vdns-use-case/vDNS-service-no-edge-dc-model-driven-placement.dzn @@ -0,0 +1,16 @@ +N_CLOUD_REGIONS = 3; % e-dc-1, core-dc-1, core-dc-2 +N_ATTRIBUTES = 4; +N_METRICS = 2; + +CUST_TYPE = GOLD; + +W_METRICS = [0.9, 0.1]; +W_ATTRIBUTES = [0, 0.9, 0.05, 0.05]; + +capabilities = [| 0, 0, 1, 1 + | 1, 0, 1, 1 + | 1, 1, 0, 1 |]; + +utilization = [| 0.05, 0.9 + | 0.1, 0.5 + | 0.95, 1.0 |]; diff --git a/examples/placement-models-minizinc/vdns-use-case/vDNS-service-silver-customer-model-driven-placement.dzn b/examples/placement-models-minizinc/vdns-use-case/vDNS-service-silver-customer-model-driven-placement.dzn new file mode 100644 index 0000000..c99bb99 --- /dev/null +++ b/examples/placement-models-minizinc/vdns-use-case/vDNS-service-silver-customer-model-driven-placement.dzn @@ -0,0 +1,16 @@ +N_CLOUD_REGIONS = 3; % e-dc-1, core-dc-1, core-dc-2 +N_ATTRIBUTES = 4; +N_METRICS = 2; + +CUST_TYPE = SILVER; + +W_METRICS = [0.9, 0.1]; +W_ATTRIBUTES = [0, 0.9, 0.05, 0.05]; + +capabilities = [| 0, 0, 1, 1 + | 1, 0, 1, 1 + | 1, 0, 1, 1 |]; + +utilization = [| 0.05, 0.9 + | 0.1, 0.5 + | 0.8, 0.98 |]; diff --git a/minizinc-examples/vDNS-service-gold-customer-model-driven-placement.dzn b/minizinc-examples/vDNS-service-gold-customer-model-driven-placement.dzn deleted file mode 100644 index 6a3222f..0000000 --- a/minizinc-examples/vDNS-service-gold-customer-model-driven-placement.dzn +++ /dev/null @@ -1,16 +0,0 @@ -N_CLOUD_REGIONS = 3; % e-dc-1, core-dc-1, core-dc-2 -N_ATTRIBUTES = 4; -N_METRICS = 2; - -CUST_TYPE = GOLD; - -W_METRICS = [0.9, 0.1]; -W_ATTRIBUTES = [0, 0.9, 0.05, 0.05]; - -capabilities = [| 0, 0, 1, 1 - | 1, 0, 1, 1 - | 1, 1, 0, 1 |]; - -utilization = [| 0.05, 0.9 - | 0.1, 0.5 - | 0.8, 0.98 |]; diff --git a/minizinc-examples/vDNS-service-model-driven-placement.mzn b/minizinc-examples/vDNS-service-model-driven-placement.mzn deleted file mode 100644 index 08292be..0000000 --- a/minizinc-examples/vDNS-service-model-driven-placement.mzn +++ /dev/null @@ -1,40 +0,0 @@ -int: N_CLOUD_REGIONS; % number of cloud regions - -int: N_ATTRIBUTES; % number of capability related attributes -array[1..N_ATTRIBUTES] of float: W_ATTRIBUTES; % weights of each attribute - -int: N_METRICS; % number of dynamic capacity metrics of interest -array[1..N_METRICS] of float: W_METRICS; % weights of each capacity metric - -int: CUST_TYPE; % customer type, 0 = regular, 1 = silver, 2 = gold - -enum CUST_TYPES = { STANDARD, SILVER, GOLD }; -enum ATTRIBUTES = { CORE_DC, DIRECT_CONN, MIN_GUARANTEE, SRIOV }; -enum METRICS = { AVG_UTILIZATION, PEAK_UTILIZATION }; - -% whether a cloud region has the corresponding capability -- data will be customer specific -array[1..N_CLOUD_REGIONS, 1..N_ATTRIBUTES] of int: capabilities; -array[1..N_CLOUD_REGIONS, 1..N_METRICS] of float: utilization; % how much capacity is already utilized (fraction) - -var int: s; % target cloud region (solution to the problem) - -% custom constraints -constraint capabilities[s, CORE_DC] = 1; % hard constraint: has to be placed in CORE DC -constraint utilization[s, AVG_UTILIZATION] <= 0.85; % hard constraint: need some capacity available -% custom soft constraint for gold customers -- give a large weight to direct connection -var float: additional_obj = bool2int(CUST_TYPE = GOLD) * capabilities[s, DIRECT_CONN] * 1000; - -% TODO: global constraints (such as data validation) - -% Objective for utilization -var float: obj_utilization = sum(k in 1..N_METRICS) ( W_METRICS[k] * (1 - utilization[s, k]) ); - -% Objective for capabilities -var float: obj_capabilities = sum(k in 1..N_ATTRIBUTES) ( W_ATTRIBUTES[k] * capabilities[s, k] ); - -% Overall objective function -var float: obj = obj_utilization + obj_capabilities + additional_obj; % can later add weights to each... - -solve maximize obj; - -output ["Cloud Region: ", show(s), "\n", "Objective function value: ", show(obj), "\n", "Customer type: ", show(CUST_TYPE), "\n"]; diff --git a/minizinc-examples/vDNS-service-no-edge-dc-model-driven-placement.dzn b/minizinc-examples/vDNS-service-no-edge-dc-model-driven-placement.dzn deleted file mode 100644 index 3a2a000..0000000 --- a/minizinc-examples/vDNS-service-no-edge-dc-model-driven-placement.dzn +++ /dev/null @@ -1,16 +0,0 @@ -N_CLOUD_REGIONS = 3; % e-dc-1, core-dc-1, core-dc-2 -N_ATTRIBUTES = 4; -N_METRICS = 2; - -CUST_TYPE = GOLD; - -W_METRICS = [0.9, 0.1]; -W_ATTRIBUTES = [0, 0.9, 0.05, 0.05]; - -capabilities = [| 0, 0, 1, 1 - | 1, 0, 1, 1 - | 1, 1, 0, 1 |]; - -utilization = [| 0.05, 0.9 - | 0.1, 0.5 - | 0.95, 1.0 |]; diff --git a/minizinc-examples/vDNS-service-silver-customer-model-driven-placement.dzn b/minizinc-examples/vDNS-service-silver-customer-model-driven-placement.dzn deleted file mode 100644 index c99bb99..0000000 --- a/minizinc-examples/vDNS-service-silver-customer-model-driven-placement.dzn +++ /dev/null @@ -1,16 +0,0 @@ -N_CLOUD_REGIONS = 3; % e-dc-1, core-dc-1, core-dc-2 -N_ATTRIBUTES = 4; -N_METRICS = 2; - -CUST_TYPE = SILVER; - -W_METRICS = [0.9, 0.1]; -W_ATTRIBUTES = [0, 0.9, 0.05, 0.05]; - -capabilities = [| 0, 0, 1, 1 - | 1, 0, 1, 1 - | 1, 0, 1, 1 |]; - -utilization = [| 0.05, 0.9 - | 0.1, 0.5 - | 0.8, 0.98 |]; -- cgit 1.2.3-korg