{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "remove-input",
     "active-ipynb",
     "remove-output"
    ]
   },
   "outputs": [],
   "source": [
    "%pylab inline\n",
    "from ipyparallel import Client, error\n",
    "cluster=Client(profile=\"mpi\")\n",
    "view=cluster[:]\n",
    "view.block=True\n",
    "\n",
    "try:\n",
    "    from openmdao.utils.notebook_utils import notebook_mode\n",
    "except ImportError:\n",
    "    !python -m pip install openmdao[notebooks]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [],
   "source": [
    "# Need to set seeds.\n",
    "import numpy as np\n",
    "np.random.seed(1)\n",
    "\n",
    "import os\n",
    "os.environ['SimpleGADriver_seed'] = '11'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [],
   "source": [
    "%%px\n",
    "\n",
    "# Need to set seeds on the mpi server too.\n",
    "import numpy as np\n",
    "np.random.seed(1)\n",
    "\n",
    "import os\n",
    "os.environ['SimpleGADriver_seed'] = '11'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# SimpleGADriver\n",
    "\n",
    "```{Note}\n",
    "SimpleGADriver is based on a simple genetic algorithm implementation sourced from the lecture notes for the class 2009 AAE550 taught by Prof. William A. Crossley at Purdue University.\n",
    "```\n",
    "\n",
    "This genetic algorithm optimizer supports integer and continuous variables. It uses a binary encoding scheme to encode any continuous variables into a user-definable number of bits. The number of bits you choose should be equal to the base-2 logarithm of the number of discrete values you want between the min and max value. A higher value means more accuracy for this variable, but it also increases the number of generations (and hence total evaluations) that will be required to find the minimum. If you do not specify a value for bits for a continuous variable, then the variable is assumed to be integer, and encoded as such. Note that if the range between the upper and lower bounds is not a power of two, then the variable is discretized beyond the upper bound, but those points that the GA generates which exceed the declared upper bound are discarded before evaluation.\n",
    "\n",
    "The SimpleGADriver supports both constrained and unconstrained optimization.\n",
    "\n",
    "The examples below show a mixed-integer problem to illustrate usage of this driver with both integer and discrete design variables."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [],
   "source": [
    "from openmdao.utils.notebook_utils import get_code\n",
    "from myst_nb import glue\n",
    "glue(\"code_src17\", get_code(\"openmdao.test_suite.components.branin.Branin\"), display=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    ":::{Admonition} `Branin` class definition \n",
    ":class: dropdown\n",
    "\n",
    "{glue:}`code_src17`\n",
    ":::"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import openmdao.api as om\n",
    "from openmdao.test_suite.components.branin import Branin\n",
    "\n",
    "prob = om.Problem()\n",
    "model = prob.model\n",
    "\n",
    "model.add_subsystem('comp', Branin(),\n",
    "                    promotes_inputs=[('x0', 'xI'), ('x1', 'xC')])\n",
    "\n",
    "model.add_design_var('xI', lower=-5.0, upper=10.0)\n",
    "model.add_design_var('xC', lower=0.0, upper=15.0)\n",
    "model.add_objective('comp.f')\n",
    "\n",
    "prob.driver = om.SimpleGADriver()\n",
    "prob.driver.options['bits'] = {'xC': 8}\n",
    "\n",
    "prob.setup()\n",
    "\n",
    "prob.set_val('xC', 7.5)\n",
    "prob.set_val('xI', 0.0)\n",
    "\n",
    "prob.run_driver()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## SimpleGADriver Options"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [],
   "source": [
    "om.show_options_table(\"openmdao.drivers.genetic_algorithm_driver.SimpleGADriver\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## SimpleGADriver Constructor\n",
    "\n",
    "The call signature for the `SimpleGADriver` constructor is:\n",
    "\n",
    "\n",
    "```{eval-rst}\n",
    "    .. automethod:: openmdao.drivers.pyoptsparse_driver.pyOptSparseDriver.__init__\n",
    "       :noindex:\n",
    "```  \n",
    "\n",
    "## Using SimpleGADriver\n",
    "\n",
    "You can change the number of generations to run the genetic algorithm by setting the “max_gen” option."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import openmdao.api as om\n",
    "from openmdao.test_suite.components.branin import Branin\n",
    "\n",
    "prob = om.Problem()\n",
    "model = prob.model\n",
    "\n",
    "model.add_subsystem('comp', Branin(),\n",
    "                    promotes_inputs=[('x0', 'xI'), ('x1', 'xC')])\n",
    "\n",
    "model.add_design_var('xI', lower=-5.0, upper=10.0)\n",
    "model.add_design_var('xC', lower=0.0, upper=15.0)\n",
    "model.add_objective('comp.f')\n",
    "\n",
    "prob.driver = om.SimpleGADriver()\n",
    "prob.driver.options['bits'] = {'xC': 8}\n",
    "prob.driver.options['max_gen'] = 5\n",
    "\n",
    "prob.setup()\n",
    "\n",
    "prob.set_val('xC', 7.5)\n",
    "prob.set_val('xI', 0.0)\n",
    "\n",
    "prob.run_driver()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can change the population size by setting the “pop_size” option. The default value for pop_size is 0, which means that the driver automatically computes a population size that is 4 times the total number of bits for all variables encoded."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import openmdao.api as om\n",
    "from openmdao.test_suite.components.branin import Branin\n",
    "\n",
    "prob = om.Problem()\n",
    "model = prob.model\n",
    "\n",
    "model.add_subsystem('comp', Branin(),\n",
    "                    promotes_inputs=[('x0', 'xI'), ('x1', 'xC')])\n",
    "\n",
    "model.add_design_var('xI', lower=-5.0, upper=10.0)\n",
    "model.add_design_var('xC', lower=0.0, upper=15.0)\n",
    "model.add_objective('comp.f')\n",
    "\n",
    "prob.driver = om.SimpleGADriver()\n",
    "prob.driver.options['bits'] = {'xC': 8}\n",
    "prob.driver.options['pop_size'] = 10\n",
    "\n",
    "prob.setup()\n",
    "\n",
    "prob.set_val('xC', 7.5)\n",
    "prob.set_val('xI', 0.0)\n",
    "\n",
    "prob.run_driver()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If you have more than one objective, you can use the `SimpleGADriver` to compute a set of non-dominated candidate optima by setting the “compute_pareto” option to True. In this case, the final state of the model will only be one of the pareto-optimal designs. The full set can be accessed via the ‘desvar_nd’ and ‘obj_nd’ attributes on the driver for the design variable values and their corresponding objectives."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [],
   "source": [
    "# Reset seed\n",
    "np.random.seed(1)\n",
    "os.environ['SimpleGADriver_seed'] = '11'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import openmdao.api as om\n",
    "\n",
    "class Box(om.ExplicitComponent):\n",
    "\n",
    "    def setup(self):\n",
    "        self.add_input('length', val=1.)\n",
    "        self.add_input('width', val=1.)\n",
    "        self.add_input('height', val=1.)\n",
    "\n",
    "        self.add_output('front_area', val=1.0)\n",
    "        self.add_output('top_area', val=1.0)\n",
    "        self.add_output('area', val=1.0)\n",
    "        self.add_output('volume', val=1.)\n",
    "\n",
    "    def compute(self, inputs, outputs):\n",
    "        length = inputs['length']\n",
    "        width = inputs['width']\n",
    "        height = inputs['height']\n",
    "\n",
    "        outputs['top_area'] = length * width\n",
    "        outputs['front_area'] = length * height\n",
    "        outputs['area'] = 2*length*height + 2*length*width + 2*height*width\n",
    "        outputs['volume'] = length*height*width\n",
    "\n",
    "prob = om.Problem()\n",
    "\n",
    "prob.model.add_subsystem('box', Box(), promotes=['*'])\n",
    "\n",
    "# setup the optimization\n",
    "prob.driver = om.SimpleGADriver()\n",
    "prob.driver.options['max_gen'] = 20\n",
    "prob.driver.options['bits'] = {'length': 8, 'width': 8, 'height': 8}\n",
    "prob.driver.options['penalty_parameter'] = 10.\n",
    "prob.driver.options['compute_pareto'] = True\n",
    "\n",
    "prob.model.add_design_var('length', lower=0.1, upper=2.)\n",
    "prob.model.add_design_var('width', lower=0.1, upper=2.)\n",
    "prob.model.add_design_var('height', lower=0.1, upper=2.)\n",
    "prob.model.add_objective('front_area', scaler=-1)  # maximize\n",
    "prob.model.add_objective('top_area', scaler=-1)  # maximize\n",
    "prob.model.add_constraint('volume', upper=1.)\n",
    "\n",
    "prob.setup()\n",
    "\n",
    "prob.set_val('length', 1.5)\n",
    "prob.set_val('width', 1.5)\n",
    "prob.set_val('height', 1.5)\n",
    "\n",
    "prob.run_driver()\n",
    "\n",
    "desvar_nd = prob.driver.desvar_nd\n",
    "nd_obj = prob.driver.obj_nd\n",
    "\n",
    "print(desvar_nd)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [],
   "source": [
    "from openmdao.utils.assert_utils import assert_near_equal\n",
    "assert_near_equal(desvar_nd, np.array([[1.83607843, 0.54705882, 0.95686275],\n",
    "                                    [1.50823529, 0.28627451, 1.95529412],\n",
    "                                    [1.45607843, 1.90313725, 0.34588235],\n",
    "                                    [1.76156863, 0.54705882, 1.01647059],\n",
    "                                    [1.85098039, 1.03137255, 0.49490196],\n",
    "                                    [1.87333333, 0.57686275, 0.90470588],\n",
    "                                    [1.38156863, 1.87333333, 0.38313725],\n",
    "                                    [1.68705882, 0.39803922, 1.47098039],\n",
    "                                    [1.86588235, 0.50980392, 1.01647059],\n",
    "                                    [2.        , 0.42784314, 1.13568627],\n",
    "                                    [1.99254902, 0.69607843, 0.70352941],\n",
    "                                    [1.74666667, 0.39803922, 1.40392157],\n",
    "                                    [1.99254902, 0.30117647, 1.38901961],\n",
    "                                    [1.97764706, 0.20431373, 1.95529412],\n",
    "                                    [1.99254902, 0.57686275, 0.84509804],\n",
    "                                    [1.9254902 , 0.30117647, 1.50823529],\n",
    "                                    [1.75411765, 0.57686275, 0.97176471],\n",
    "                                    [1.94039216, 0.92705882, 0.5545098 ],\n",
    "                                    [1.74666667, 0.81529412, 0.70352941],\n",
    "                                    [1.75411765, 0.42039216, 1.35176471]]),\n",
    "                          1e-6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "sorted_obj = nd_obj[nd_obj[:, 0].argsort()]\n",
    "\n",
    "print(sorted_obj)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [],
   "source": [
    "assert_near_equal(sorted_obj, np.array([[-3.86688166, -0.40406044],\n",
    "                                    [-2.9490436 , -0.43176932],\n",
    "                                    [-2.90409227, -0.57991234],\n",
    "                                    [-2.76768966, -0.60010888],\n",
    "                                    [-2.48163045, -0.67151557],\n",
    "                                    [-2.45218301, -0.69524183],\n",
    "                                    [-2.37115433, -0.7374173 ],\n",
    "                                    [-2.27137255, -0.85568627],\n",
    "                                    [-1.89661453, -0.95123414],\n",
    "                                    [-1.7905827 , -0.96368166],\n",
    "                                    [-1.75687505, -1.00444291],\n",
    "                                    [-1.70458962, -1.01188512],\n",
    "                                    [-1.69481569, -1.08065621],\n",
    "                                    [-1.68389927, -1.1494273 ],\n",
    "                                    [-1.40181684, -1.3869704 ],\n",
    "                                    [-1.21024148, -1.40545716],\n",
    "                                    [-1.07596647, -1.79885767],\n",
    "                                    [-0.91605383, -1.90905037],\n",
    "                                    [-0.52933041, -2.58813856],\n",
    "                                    [-0.50363183, -2.77111711]]),\n",
    "                          1e-6)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Constrained Optimization\n",
    "\n",
    "The SimpleGADriver supports both constrained and unconstrained optimization. If you have constraints,\n",
    "the constraints are added to the objective after they have been weighted using a user-tunable\n",
    "penalty multiplier and exponent. \n",
    "\n",
    "All constraints are converted to the form of $g(x)_i \\leq 0$ for\n",
    "inequality constraints and $h(x)_i = 0$ for equality constraints.\n",
    "The constraint vector for inequality constraints is the following:\n",
    "\n",
    "   $g = [g_1, g_2  \\dots g_N], g_i \\in R^{N_{g_i}}$\n",
    "   $h = [h_1, h_2  \\dots h_N], h_i \\in R^{N_{h_i}}$\n",
    "\n",
    "The number of all constraints:\n",
    "\n",
    "   $N_g = \\sum_{i=1}^N N_{g_i},  N_h = \\sum_{i=1}^N N_{h_i}$\n",
    "\n",
    "The fitness function is constructed with the penalty parameter $p$\n",
    "and the exponent $\\kappa$:\n",
    "\n",
    "   $\\Phi(x) = f(x) + p \\cdot \\sum_{k=1}^{N^g}(\\delta_k \\cdot g_k^{\\kappa})\n",
    "   + p \\cdot \\sum_{k=1}^{N^h}|h_k|^{\\kappa}$\n",
    "\n",
    "where $\\delta_k = 0$ if $g_k$ is satisfied, 1 otherwise\n",
    "\n",
    "The following example shows how to set the penalty parameter $p$ and the exponent $\\kappa$:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import openmdao.api as om\n",
    "\n",
    "class Cylinder(om.ExplicitComponent):\n",
    "    \"\"\"Main class\"\"\"\n",
    "\n",
    "    def setup(self):\n",
    "        self.add_input('radius', val=1.0)\n",
    "        self.add_input('height', val=1.0)\n",
    "\n",
    "        self.add_output('Area', val=1.0)\n",
    "        self.add_output('Volume', val=1.0)\n",
    "\n",
    "    def compute(self, inputs, outputs):\n",
    "        radius = inputs['radius']\n",
    "        height = inputs['height']\n",
    "\n",
    "        area = height * radius * 2 * 3.14 + 3.14 * radius ** 2 * 2\n",
    "        volume = 3.14 * radius ** 2 * height\n",
    "        outputs['Area'] = area\n",
    "        outputs['Volume'] = volume\n",
    "\n",
    "prob = om.Problem()\n",
    "prob.model.add_subsystem('cylinder', Cylinder(), promotes=['*'])\n",
    "\n",
    "# setup the optimization\n",
    "prob.driver = om.SimpleGADriver()\n",
    "prob.driver.options['penalty_parameter'] = 3.\n",
    "prob.driver.options['penalty_exponent'] = 1.\n",
    "prob.driver.options['max_gen'] = 50\n",
    "prob.driver.options['bits'] = {'radius': 8, 'height': 8}\n",
    "\n",
    "prob.model.add_design_var('radius', lower=0.5, upper=5.)\n",
    "prob.model.add_design_var('height', lower=0.5, upper=5.)\n",
    "prob.model.add_objective('Area')\n",
    "prob.model.add_constraint('Volume', lower=10.)\n",
    "\n",
    "prob.setup()\n",
    "\n",
    "prob.set_val('radius', 2.)\n",
    "prob.set_val('height', 3.)\n",
    "\n",
    "prob.run_driver()\n",
    "\n",
    "# These go to 0.5 for unconstrained problem. With constraint and penalty, they\n",
    "# will be above 1.0 (actual values will vary.)\n",
    "print(prob.get_val('radius'))\n",
    "print(prob.get_val('height'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [],
   "source": [
    "assert(prob.get_val('radius') > 1.0)\n",
    "assert(prob.get_val('height') > 1.0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Running a GA in Parallel\n",
    "\n",
    "If you have a model that doesn’t contain any distributed components or parallel groups, then the model evaluations for a new generation can be performed in parallel by turning on the “run_parallel” option:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%px\n",
    "\n",
    "import openmdao.api as om\n",
    "from openmdao.test_suite.components.branin import Branin\n",
    "\n",
    "prob = om.Problem()\n",
    "model = prob.model\n",
    "\n",
    "model.add_subsystem('comp', Branin(),\n",
    "                    promotes_inputs=[('x0', 'xI'), ('x1', 'xC')])\n",
    "\n",
    "model.add_design_var('xI', lower=-5.0, upper=10.0)\n",
    "model.add_design_var('xC', lower=0.0, upper=15.0)\n",
    "model.add_objective('comp.f')\n",
    "\n",
    "prob.driver = om.SimpleGADriver()\n",
    "prob.driver.options['bits'] = {'xC': 8}\n",
    "prob.driver.options['max_gen'] = 10\n",
    "prob.driver.options['run_parallel'] = True\n",
    "\n",
    "prob.setup()\n",
    "\n",
    "prob.set_val('xC', 7.5)\n",
    "prob.set_val('xI', 0.0)\n",
    "\n",
    "prob.run_driver()\n",
    "\n",
    "# Optimal solution\n",
    "print(prob.get_val('comp.f'))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%px\n",
    "\n",
    "print(prob.get_val('xI'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%px\n",
    "\n",
    "print(prob.get_val('xC'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [],
   "source": [
    "%%px\n",
    "\n",
    "from openmdao.utils.assert_utils import assert_near_equal\n",
    "assert_near_equal(prob.get_val('comp.f'), 1.25172426, 1e-6)\n",
    "assert_near_equal(prob.get_val('xI'), 9.0, 1e-6)\n",
    "assert_near_equal(prob.get_val('xC'), 2.11764706, 1e-6)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Running a GA on a Parallel Model in Parallel\n",
    "\n",
    "If you have a model that does contain distributed components or parallel groups, you can also use SimpleGADriver to optimize it. If you have enough processors, you can also simultaneously evaluate multiple points in your population by turning on the “run_parallel” option and setting the “procs_per_model” to the number of processors that your model requires. Take care that you submit your parallel run with enough processors such that the number of processors the model requires divides evenly into it, as in this example, where the model requires 2 and we give it 4."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%px\n",
    "\n",
    "import openmdao.api as om\n",
    "from openmdao.test_suite.components.branin import Branin\n",
    "\n",
    "prob = om.Problem()\n",
    "model = prob.model\n",
    "\n",
    "par = model.add_subsystem('par', om.ParallelGroup(),\n",
    "                          promotes_inputs=['*'])\n",
    "\n",
    "par.add_subsystem('comp1', Branin(),\n",
    "                  promotes_inputs=[('x0', 'xI'), ('x1', 'xC')])\n",
    "par.add_subsystem('comp2', Branin(),\n",
    "                  promotes_inputs=[('x0', 'xI'), ('x1', 'xC')])\n",
    "\n",
    "model.add_subsystem('comp', om.ExecComp('f = f1 + f2'))\n",
    "model.connect('par.comp1.f', 'comp.f1')\n",
    "model.connect('par.comp2.f', 'comp.f2')\n",
    "\n",
    "model.add_design_var('xI', lower=-5.0, upper=10.0)\n",
    "model.add_design_var('xC', lower=0.0, upper=15.0)\n",
    "model.add_objective('comp.f')\n",
    "\n",
    "prob.driver = om.SimpleGADriver()\n",
    "prob.driver.options['bits'] = {'xC': 8}\n",
    "prob.driver.options['max_gen'] = 10\n",
    "prob.driver.options['pop_size'] = 25\n",
    "prob.driver.options['run_parallel'] = True\n",
    "prob.driver.options['procs_per_model'] = 2\n",
    "\n",
    "prob.driver._randomstate = 1\n",
    "\n",
    "prob.setup()\n",
    "\n",
    "prob.set_val('xC', 7.5)\n",
    "prob.set_val('xI', 0.0)\n",
    "\n",
    "prob.run_driver()\n",
    "\n",
    "# Optimal solution\n",
    "print(prob.get_val('comp.f'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%px\n",
    "print(prob.get_val('xI'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%px\n",
    "print(prob.get_val('xC'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [],
   "source": [
    "%%px\n",
    "assert_near_equal(prob.get_val('comp.f'), 0.98799098, 1e-6)\n",
    "assert_near_equal(prob.get_val('xI'),-3.0, 1e-6)\n",
    "assert_near_equal(prob.get_val('xC'), 11.94117647, 1e-6)"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Tags",
  "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.8.1"
  },
  "orphan": true
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
