{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "![MOSEK ApS](https://www.mosek.com/static/images/branding/webgraphmoseklogocolor.png )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We implement a Python Fusion model for the problem known as F-SPARC (fractional subcarrier and power allocation with rate constraints). Our implementation defines a mixed-integer exponential cone problem.\n", "\n", "The model comes from the paper *Bi-Perspective Functions for Mixed-Integer Fractional Programs with Indicator Variables* by Adam N. Letchford, Qiang N and, Zhaoyu Zhong, http://www.optimization-online.org/DB_HTML/2017/09/6222.html.\n", "\n", "Some test data come from http://www.research.lancs.ac.uk/portal/en/datasets/ofdma-optimisation(48d843b0-1fb6-4e3d-af39-ca533a37b7ab).html\n", "\n", "# Problem formulation\n", "\n", "We consider a set $I$ of communication channels (subcarriers) to be assigned to a set $J$ of users. Each channel can be assigned to at most one user, while one user will typically have more channels assigned to them, subject to the requirement that user $j$ achieves a total data rate of at least $d_j$ (bits per second). The data rate of a channel is computed as follows: for a channel of bandwidth $B$ (hertz), noise level $N_i$ (watts) and operating with power $p_i$ (watts), the maximum data rate is\n", "$$f_i = B \\log_2(1+\\frac{p_i}{N_i}).$$\n", "Finally, we assume a minimal system power of $\\sigma$ required to keep the system running and a maximum power level $P$. \n", "\n", "The goal is to map the channels to users and assign their power levels so that the *energy efficiency*\n", "\n", "$$\\frac{\\textrm{total data rate}}{\\textrm{total power}}$$\n", "is maximized.\n", "\n", "The mixed-integer formulation is then:\n", "$$\n", "\\begin{array}{rl}\n", "\\mathrm{maximize} & \\frac{\\sum_{i,j} B \\log_2(1+p_{i,j}/N_i)}{\\sigma+\\sum_{i,j}p_{i,j}} \\\\\n", "\\textrm{subject to} & B \\sum_i \\log_2(1+p_{i,j}/N_i) \\geq d_j, \\quad j\\in J, \\\\\n", "& \\sigma + \\sum_{i,j}p_{ij} \\leq P, \\\\\n", "& 0 \\leq p_{ij}\\leq Px_{ij}, x_{ij}\\in \\{0,1\\}, \\\\\n", "& \\sum_j x_{ij} \\leq 1,\\quad i\\in I,\n", "\\end{array}\n", "$$\n", "\n", "where $p_{ij}$ is the power assigned to channel $i$ when used by user $j$. The first constraint describes the total bitrate of each user, the second bounds total power, and the remaining constraints with indicator variables model the assignment requirements.\n", "\n", "\n", "# Conic reformulation\n", "\n", "To obtain a problem in conic form we perform a homogenization as in Section 5.2 of Letchfort et al. That is, we introduce new variables $t$, $z_{ij}$ and $\\tilde{p_{ij}}$ with the intention of representing\n", "$$t = 1/(\\sigma+\\sum_{ij}p_{ij}),\\quad z_{ij}=Bt\\log_2(1+p_{ij}/N_i),\\quad \\tilde{p_{ij}} = p_{ij}t.$$\n", "In terms of the new variables the problem is equivalent with\n", "\n", "$$\n", "\\begin{array}{rl}\n", "\\mathrm{maximize} & \\sum_{i,j} z_{ij} \\\\\n", "\\textrm{subject to} & z_{ij} \\leq B t \\log_2(1+\\tilde{p_{i,j}}/(tN_i)), \\quad i \\in I, j\\in J, \\\\\n", "& d_jt \\leq \\sum_i z_{ij},\\quad j\\in J \\\\\n", "& t\\sigma + \\sum_{i,j} \\tilde{p_{i,j}} = 1, \\\\\n", "& 1/P \\leq t \\leq 1/\\sigma, \\\\\n", "& 0 \\leq \\tilde{p_{i,j}} \\leq x_{ij}, x_{ij}\\in \\{0,1\\}, \\\\\n", "& \\sum_j x_{ij} \\leq 1,\\quad i\\in I,\n", "\\end{array}\n", "$$\n", "The first constraint can equivalently be written as\n", "$$t+\\tilde{p_{i,j}}/N_i \\geq t \\exp(\\log(2)z_{i,j}/(Bt))$$\n", "which, using the exponential cone, is\n", "$$(t+\\tilde{p_{i,j}}/N_i , t, \\log(2)z_{i,j}/B)\\in K_\\mathrm{exp}.$$\n", "\n", "# Implementation in Fusion\n", "\n", "We start that functions which parse examples in the format of http://www.research.lancs.ac.uk/portal/en/datasets/ofdma-optimisation(48d843b0-1fb6-4e3d-af39-ca533a37b7ab).html and set up some global constants. The data files contain user demands and channel noise for each example." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import ast, sys\n", "\n", "constants = {\n", " \"System Power\": 10, \n", " \"Bandwidth\": 1.25, \n", " \"Maximum Power\": 36\n", "}\n", "\n", "def parse(filename):\n", " data = []\n", " with open(filename, 'r') as file:\n", " content = file.read()\n", " if 'Instance: ' not in content: raise Exception\n", " \n", " for inst in content.split('Instance: ')[1:]:\n", " if 'noise' not in inst or 'demand' not in inst: raise Exception\n", "\n", " data.append({\n", " \"noise\" : ast.literal_eval(inst.split('noise')[1].split('demand')[0].strip()), \n", " \"demand\" : ast.literal_eval(inst.split('demand')[1].strip())\n", " })\n", " return data \n", "\n", "BW = constants[\"Bandwidth\"]\n", "P = constants[\"Maximum Power\"]\n", "SIGMA = constants[\"System Power\"]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The next function is a direct implementation of the conic model above." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from mosek.fusion import *\n", "from math import log\n", "\n", "def fsparc_model(n, d):\n", " M = Model()\n", " I, J = len(n), len(d)\n", "\n", " # create variables\n", " z = M.variable('z', [I, J], Domain.greaterThan(0.0)) \n", " x = M.variable('x', [I, J], Domain.binary()) \n", " p_tilde = M.variable('p_tilde', [I, J], Domain.greaterThan(0.0))\n", " t = M.variable('t', 1, Domain.inRange(1.0/P, 1.0/SIGMA)) \n", "\n", " # add linear constraints\n", " M.constraint(Expr.sum(x, 1), Domain.lessThan(1.0)) \n", " M.constraint(Expr.add(Expr.mul(SIGMA, t), Expr.sum(p_tilde)), Domain.equalsTo(1.0))\n", " M.constraint(Expr.sub(p_tilde, x), Domain.lessThan(0.0)) \n", " M.constraint(Expr.sub(Expr.sum(z, 0), Expr.mulElm(Expr.repeat(t, J, 0), d)), Domain.greaterThan(0.0))\n", " \n", " # objective\n", " M.objective(\"obj\", ObjectiveSense.Maximize, Expr.sum(z))\n", " \n", " # add conic constraint\n", " p_over_n = Expr.mulElm(p_tilde, [[1 / n_i] * J for n_i in n])\n", " multi_t = Expr.repeat(Expr.repeat(t, I, 0), J, 1)\n", " M.constraint(Expr.stack(2, Expr.add(multi_t, p_over_n), multi_t, Expr.mul(log(2.0) / BW, z)), \n", " Domain.inPExpCone())\n", " \n", " return M\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next we run the model and present some statistics for a few examples." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "\n", "def stats(M, n, d):\n", " I, J = len(n), len(d)\n", " t = M.getVariable('t').level()[0]\n", " pval = M.getVariable('p_tilde').level().reshape([I, J]) / t\n", " xval = M.getVariable('x').level().reshape([I, J])\n", " power = [sum(pval[i,:]) for i in range(I)]\n", " user = [int(sum([xval[i][j]*j for j in range(J)])) for i in range(I)]\n", " print(\"Total data rate: demanded {0}, provided {1}\".format(\n", " sum(d), \n", " sum([BW*log(1+power[i]/n[i])/log(2.0) for i in range(I)])))\n", " print(\"Power: system {0:.3f}, used {1:.3f}, maximal: {2:.3f}\".format(SIGMA, SIGMA+sum(power), P))\n", " colors = ['red', 'green', 'blue', 'cyan', 'yellow', 'violet'] \n", " plt.bar(range(I), power, color = [colors[user[i]] for i in range(I)])\n", " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 1\n", "\n", "We run an example with realistic data (72 channels, 4 users) with a very short time limit." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Problem\n", " Name : \n", " Objective sense : max \n", " Type : CONIC (conic optimization problem)\n", " Constraints : 1229 \n", " Cones : 288 \n", " Scalar variables : 1729 \n", " Matrix variables : 0 \n", " Integer variables : 288 \n", "\n", "Optimizer started.\n", "Mixed integer optimizer started.\n", "Threads used: 20\n", "Presolve started.\n", "Presolve terminated. Time = 0.01\n", "Presolved problem: 1440 variables, 940 constraints, 2883 non-zeros\n", "Presolved problem: 0 general integer, 288 binary, 1152 continuous\n", "Clique table size: 72\n", "BRANCHES RELAXS ACT_NDS DEPTH BEST_INT_OBJ BEST_RELAX_OBJ REL_GAP(%) TIME \n", "0 1 1 0 NA 3.2821073370e+02 NA 0.1 \n", "Cut generation started.\n", "0 2 1 0 NA 3.2821073370e+02 NA 0.6 \n", "Cut generation terminated. Time = 0.00\n", "8 12 9 2 NA 3.2564092596e+02 NA 1.0 \n", "21 25 22 5 NA 3.2564092596e+02 NA 1.1 \n", "36 40 37 5 NA 3.2564092596e+02 NA 1.2 \n", "49 53 50 6 NA 3.2564092596e+02 NA 1.3 \n", "79 83 80 8 NA 3.2564092596e+02 NA 1.5 \n", "159 163 160 12 NA 3.2564092596e+02 NA 1.7 \n", "319 323 320 20 NA 3.2564092596e+02 NA 2.3 \n", "639 643 640 36 NA 3.2564092596e+02 NA 3.3 \n", "1079 1083 1080 58 NA 3.2564092596e+02 NA 5.1 \n", "1540 1544 1519 4 9.6388958662e+01 3.2355936051e+02 235.68 7.0 \n", "2003 2003 1610 76 9.7146226251e+01 3.1948388561e+02 228.87 8.8 \n", "2483 2483 2056 10 9.7146226251e+01 3.1418591147e+02 223.42 10.4 \n", "2963 2963 2534 16 9.7146226251e+01 3.1198674503e+02 221.15 11.8 \n", "3442 3442 3011 40 9.7146226251e+01 3.1198674503e+02 221.15 13.4 \n", "3917 3917 3486 64 9.7146226251e+01 3.1198674503e+02 221.15 15.1 \n", "4389 4389 3870 13 9.7146226251e+01 3.1198474109e+02 221.15 17.0 \n", "4863 4863 4200 10 9.7146226251e+01 3.1068358231e+02 219.81 18.6 \n", "5343 5343 4680 11 9.7146226251e+01 3.0978236788e+02 218.88 20.1 \n", "5823 5823 5160 12 9.7146226251e+01 3.0943340745e+02 218.52 21.6 \n", "6303 6303 5624 9 9.7146226251e+01 3.0892256489e+02 218.00 23.2 \n", "6783 6783 6104 20 9.7146226251e+01 3.0848648896e+02 217.55 24.6 \n", "7260 7260 6581 44 9.7146226251e+01 3.0848648896e+02 217.55 26.1 \n", "7740 7740 7061 68 9.7146226251e+01 3.0848648896e+02 217.55 27.7 \n", "8209 8209 7522 12 9.7146226251e+01 3.0843778266e+02 217.50 29.5 \n", "8678 8678 7845 13 9.7146226251e+01 3.0824261215e+02 217.30 31.2 \n", "9156 9156 8281 14 9.7146226251e+01 3.0782433694e+02 216.87 33.0 \n", "9636 9636 8723 15 9.7146226251e+01 3.0758164100e+02 216.62 34.6 \n", "10115 10115 9152 16 9.7146226251e+01 3.0726996741e+02 216.30 36.2 \n", "10556 10556 9527 38 9.7146226251e+01 3.0726996741e+02 216.30 38.1 \n", "11034 11034 9989 62 9.7146226251e+01 3.0726996741e+02 216.30 39.7 \n", "\n", "Objective of best integer solution : 9.714622625080e+01 \n", "Best objective bound : 3.072699674120e+02 \n", "Construct solution objective : Not employed\n", "Construct solution # roundings : 0\n", "User objective cut value : 0\n", "Number of cuts generated : 0\n", "Number of branches : 11034\n", "Number of relaxations solved : 11034\n", "Number of interior point iterations: 242428\n", "Number of simplex iterations : 0\n", "Time spend presolving the root : 0.01\n", "Time spend optimizing the root : 0.09\n", "Mixed integer optimizer terminated. Time: 40.03\n", "\n", "Optimizer terminated. Time: 40.08 \n", "\n", "\n", "Integer solution solution summary\n", " Problem status : PRIMAL_FEASIBLE\n", " Solution status : PRIMAL_FEASIBLE\n", " Primal. obj: 9.7146226251e+01 nrm: 8e+03 Viol. con: 6e-05 var: 6e-10 cones: 0e+00 itg: 0e+00 \n", "Total data rate: demanded 1144.5349999999999, provided 1144.5614497476022\n", "Power: system 10.000, used 11.782, maximal: 36.000\n" ] }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAEz5JREFUeJzt3X+MZWV9x/H3pzvu+qMFdHcwlIXuGrZW1PprQjW2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ano5MNeO/78Az53EOlutzwb+Azi5r23NavWbypIk4MS5ZCRJGsFAkCQBBoIkqTEQJEmAgSBJagwESRJgIEiSGgNBkgTA/wHgv9+9X3gbawAAAABJRU5ErkJggg==\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "instance = parse(\"data/lancaster/4_0.8.txt\")[0]\n", "n, d = instance[\"noise\"], instance[\"demand\"]\n", "M = fsparc_model(n, d)\n", "M.setLogHandler(sys.stdout)\n", "M.setSolverParam(\"optimizerMaxTime\", 40.0)\n", "M.solve()\n", "M.acceptedSolutionStatus(AccSolutionStatus.Feasible)\n", "stats(M, n, d)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The bar plot shows power assignments to the channels. Each color represents one user.\n", "\n", "# Example 2\n", "\n", "The next example is a small, randomly generated set of data with 15 channels and 3 users, which we should solve to optimality." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Problem\n", " Name : \n", " Objective sense : max \n", " Type : CONIC (conic optimization problem)\n", " Constraints : 199 \n", " Cones : 45 \n", " Scalar variables : 271 \n", " Matrix variables : 0 \n", " Integer variables : 45 \n", "\n", "Optimizer started.\n", "Mixed integer optimizer started.\n", "Threads used: 20\n", "Presolve started.\n", "Presolve terminated. Time = 0.00\n", "Presolved problem: 225 variables, 153 constraints, 452 non-zeros\n", "Presolved problem: 0 general integer, 45 binary, 180 continuous\n", "Clique table size: 15\n", "BRANCHES RELAXS ACT_NDS DEPTH BEST_INT_OBJ BEST_RELAX_OBJ REL_GAP(%) TIME \n", "0 1 1 0 NA 6.2736906817e+01 NA 0.0 \n", "Cut generation started.\n", "0 2 1 0 NA 6.2736906817e+01 NA 0.1 \n", "Cut generation terminated. Time = 0.00\n", "8 12 9 2 NA 5.8418013107e+01 NA 0.2 \n", "20 24 21 5 NA 5.7248034543e+01 NA 0.3 \n", "36 40 37 7 NA 5.7248034543e+01 NA 0.3 \n", "48 52 49 8 NA 5.7248034543e+01 NA 0.3 \n", "80 84 81 10 NA 5.7248034543e+01 NA 0.4 \n", "160 164 161 14 NA 5.7248034543e+01 NA 0.5 \n", "320 313 249 17 1.9890365163e+01 5.5150531676e+01 177.27 0.8 \n", "560 515 269 5 2.0074632174e+01 5.4015323987e+01 169.07 1.1 \n", "820 769 353 18 2.0886038578e+01 5.2713196601e+01 152.38 1.6 \n", "1160 1102 503 18 2.0886038578e+01 5.1086229306e+01 144.60 2.0 \n", "1619 1558 686 13 2.0886038578e+01 5.0036307959e+01 139.57 2.7 \n", "2081 2015 816 22 2.0886038578e+01 4.7777192266e+01 128.75 3.3 \n", "2545 2475 950 18 2.0886038578e+01 4.5168505100e+01 116.26 4.0 \n", "3008 2933 1043 21 2.0886038578e+01 4.2765322708e+01 104.76 4.6 \n", "3467 3391 1090 18 2.0886038578e+01 4.0000720055e+01 91.52 5.3 \n", "3913 3843 1186 21 2.0886038578e+01 3.8961479080e+01 86.54 6.0 \n", "4353 4292 1242 15 2.0886038578e+01 3.7279206008e+01 78.49 6.8 \n", "4803 4743 1316 9 2.0886038578e+01 3.6233564889e+01 73.48 7.5 \n", "5263 5200 1394 17 2.0886038578e+01 3.6162281699e+01 73.14 8.1 \n", "5717 5652 1446 21 2.0886038578e+01 3.5396585587e+01 69.47 8.8 \n", "6155 6097 1474 10 2.0886038578e+01 3.4835152140e+01 66.79 9.6 \n", "6574 6521 1477 19 2.0886038578e+01 3.4008845027e+01 62.83 10.4 \n", "7033 6977 1514 18 2.0886038578e+01 3.3563414586e+01 60.70 11.1 \n", "7474 7424 1523 14 2.0886038578e+01 3.3441191697e+01 60.11 11.9 \n", "7927 7879 1482 21 2.0886038578e+01 3.3056697831e+01 58.27 12.6 \n", "8376 8329 1467 18 2.0886038578e+01 3.2055350146e+01 53.48 13.2 \n", "8821 8777 1392 15 2.0886156731e+01 3.1721254007e+01 51.88 14.1 \n", "9275 9230 1338 14 2.0886156731e+01 3.1296712465e+01 49.84 14.8 \n", "9730 9684 1293 10 2.0886156731e+01 3.1084824213e+01 48.83 15.5 \n", "10172 10133 1255 16 2.0886156731e+01 3.0927284262e+01 48.08 16.2 \n", "10618 10580 1173 17 2.0886156731e+01 3.0531538141e+01 46.18 16.9 \n", "11060 11028 1089 14 2.0886156731e+01 3.0358038321e+01 45.35 17.7 \n", "11473 11455 1030 20 2.0886156731e+01 3.0272515219e+01 44.94 18.5 \n", "11898 11896 991 18 2.0886156731e+01 2.9876691828e+01 43.05 19.3 \n", "12327 12338 900 18 2.0886156731e+01 2.9590258263e+01 41.67 20.2 \n", "12743 12777 834 16 2.0886156731e+01 2.9590258263e+01 41.67 21.1 \n", "13180 13222 759 18 2.0886156731e+01 2.9590258263e+01 41.67 21.9 \n", "13600 13664 691 17 2.0886156731e+01 2.8856240125e+01 38.16 22.8 \n", "14033 14108 610 17 2.0886156731e+01 2.8758742060e+01 37.69 23.6 \n", "14483 14558 524 16 2.0886156731e+01 2.8140325871e+01 34.73 24.3 \n", "14918 14992 435 18 2.0886156731e+01 2.7798746872e+01 33.10 25.0 \n", "15335 15415 344 16 2.0886156731e+01 2.7511073832e+01 31.72 25.7 \n", "15675 15756 290 17 2.0886156731e+01 2.7223697972e+01 30.34 26.3 \n", "15955 16043 240 22 2.0886156731e+01 2.7223697972e+01 30.34 26.9 \n", "16195 16303 194 15 2.0886156731e+01 2.6706954318e+01 27.87 27.5 \n", "16375 16495 140 14 2.0886156731e+01 2.6240947330e+01 25.64 28.1 \n", "16515 16642 118 21 2.0886156731e+01 2.6240947330e+01 25.64 28.5 \n", "16614 16744 77 13 2.0886156731e+01 2.5988521964e+01 24.43 28.8 \n", "16673 16804 54 15 2.0886156731e+01 2.5988521964e+01 24.43 28.9 \n", "16713 16844 44 18 2.0886156731e+01 2.5988521964e+01 24.43 29.1 \n", "16750 16882 23 18 2.0886156731e+01 2.5988521964e+01 24.43 29.2 \n", "16761 16893 16 16 2.0886156731e+01 2.5988521964e+01 24.43 29.2 \n", "16776 16909 7 14 2.0886156731e+01 2.4433909459e+01 16.99 29.3 \n", "16786 16921 3 8 2.0886156731e+01 2.4433909459e+01 16.99 29.4 \n", "An optimal solution satisfying the relative gap tolerance of 1.00e-02(%) has been located.\n", "The relative gap is 0.00e+00(%).\n", "An optimal solution satisfying the absolute gap tolerance of 0.00e+00 has been located.\n", "The absolute gap is 0.00e+00.\n", "\n", "Objective of best integer solution : 2.088615673080e+01 \n", "Best objective bound : 2.088615673080e+01 \n", "Construct solution objective : Not employed\n", "Construct solution # roundings : 0\n", "User objective cut value : 0\n", "Number of cuts generated : 0\n", "Number of branches : 16791\n", "Number of relaxations solved : 16927\n", "Number of interior point iterations: 418244\n", "Number of simplex iterations : 0\n", "Time spend presolving the root : 0.00\n", "Time spend optimizing the root : 0.02\n", "Mixed integer optimizer terminated. Time: 29.53\n", "\n", "Optimizer terminated. Time: 29.55 \n", "\n", "\n", "Integer solution solution summary\n", " Problem status : PRIMAL_FEASIBLE\n", " Solution status : INTEGER_OPTIMAL\n", " Primal. obj: 2.0886156731e+01 nrm: 6e+04 Viol. con: 1e-05 var: 7e-10 cones: 0e+00 itg: 0e+00 \n", "Total data rate: demanded 297.7325530926529, provided 301.222514307648\n", "Power: system 10.000, used 14.422, maximal: 36.000\n" ] }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAEa1JREFUeJzt3X2MZXddx/H3x11bBBQKHZ/2gV1gRZYHWx0XlQiJtLCI2eUPCIti1thko6GKotESTKtrNDwYxMSibaBCFFlqQZ2YYml40Bgs7rSUwrauHRZsx0W7uhVUsHXL1z/uqbnc3mXOzNyZO+vv/Uomc885v9+Zz70785mz5957JlWFJKkNXzftAJKk9WPpS1JDLH1Jaoil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u5pZxmV5NHA64Erlxq7llop/V6Xg9gIknw9g8J/d1W9f9p5RjwX2JfkcwxOkf1Qkj+abqSxFoHFqnr4f0k3MPglsJFcAny2qk5V1f8A7wd+YMqZzuZfknwbQPf5vinnGSvJQeBHgB+rjfla9Kcw+CX/ye5naCtwW5JvXc8QrZR+n0tJTF13Oep3AHdV1VumnWdUVb2uqrZW1Q4Gj+GHq2rDHZ1W1T8D9yZ5WrfqBQzeFb6R3AN8X5JHd//uL2CDPdk8ZPgyKweBP59ilrGS7AV+GdhXVV+adp5xqupTVfXNVbWj+xlaBL67+35dN02UfvcEz8OXkrgLuL6qjk031VjPBX6cwRH07d3HD0871DnqZ4B3J7kDuAj4zSnn+Srd/0JuAG4DPsXgZ3H679ZM3gP8LfC0JItJLgPeAFya5G4Grzp5wwbM+LvANwI3dz83vz/NjHDWnFPnO3IlqSFNHOlLkgYsfUlqiKUvSQ2x9CWpIZa+JDXE0pekhlj6ktQQS1+SGvK/jYM3Vfuv8dYAAAAASUVORK5CYII=\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "instance = parse(\"data/small-random/random_15_3_0.85.txt\")[0]\n", "n, d = instance[\"noise\"], instance[\"demand\"]\n", "M = fsparc_model(n, d)\n", "M.setLogHandler(sys.stdout)\n", "M.solve()\n", "stats(M, n, d)" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "
This work is licensed under a Creative Commons Attribution 4.0 International License. The **MOSEK** logo and name are trademarks of Mosek ApS. The code is provided as-is. Compatibility with future release of **MOSEK** or the Fusion API are not guaranteed. For more information contact our [support](mailto:support@mosek.com). " ] } ], "metadata": { "anaconda-cloud": {}, "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": 1 }