{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "4457574f",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:17.454907Z",
     "iopub.status.busy": "2026-10-02T14:46:17.454647Z",
     "iopub.status.idle": "2026-10-02T14:46:17.459096Z",
     "shell.execute_reply": "2026-10-02T14:46:17.458449Z"
    },
    "papermill": {
     "duration": 0.039136,
     "end_time": "2026-10-02T14:46:17.460368+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:17.421232+00:00",
     "status": "completed"
    },
    "tags": [
     "remove-input",
     "remove-output",
     "active-ipynb"
    ]
   },
   "outputs": [],
   "source": [
    "try:\n",
    "    from openmdao.utils.notebook_utils import notebook_mode  # noqa: F401\n",
    "except ImportError:\n",
    "    !python -m pip install openmdao[notebooks]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "b5a47f26",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:17.465235Z",
     "iopub.status.busy": "2026-10-02T14:46:17.465084Z",
     "iopub.status.idle": "2026-10-02T14:46:18.238099Z",
     "shell.execute_reply": "2026-10-02T14:46:18.236878Z"
    },
    "papermill": {
     "duration": 0.776365,
     "end_time": "2026-10-02T14:46:18.238893+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:17.462528+00:00",
     "status": "completed"
    },
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [],
   "source": [
    "from openmdao.utils.assert_utils import assert_near_equal\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "da61b446",
   "metadata": {
    "papermill": {
     "duration": 0.00195,
     "end_time": "2026-10-02T14:46:18.243359+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:18.241409+00:00",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "# Driver Recording"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d64d1926",
   "metadata": {
    "papermill": {
     "duration": 0.001573,
     "end_time": "2026-10-02T14:46:18.246814+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:18.245241+00:00",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "A CaseRecorder is commonly attached to the problem’s Driver in order to gain insight into the convergence of the model as the driver finds a solution. By default, a recorder attached to a driver will record the design variables, constraints and objectives.\n",
    "\n",
    "The driver recorder is capable of capturing any values from any part of the model, not just the design variables, constraints, and objectives."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "20a65508",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:18.252150Z",
     "iopub.status.busy": "2026-10-02T14:46:18.251893Z",
     "iopub.status.idle": "2026-10-02T14:46:18.930115Z",
     "shell.execute_reply": "2026-10-02T14:46:18.926832Z"
    },
    "papermill": {
     "duration": 0.682265,
     "end_time": "2026-10-02T14:46:18.930774+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:18.248509+00:00",
     "status": "completed"
    },
    "scrolled": true,
    "tags": [
     "remove-input"
    ]
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/runner/work/OpenMDAO/OpenMDAO/.pixi/envs/dev/lib/python3.13/site-packages/openmdao/utils/notebook_utils.py:127: OMDeprecationWarning:Argument `recording_options` is deprecated. Use `options_dict=\"recording_options\" to remove this warning.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "<!DOCTYPE html>\n",
       "<html lang=\"en\">\n",
       "<head>\n",
       "    <style>\n",
       "        h2 {\n",
       "            text-align: center;\n",
       "        }\n",
       "    </style>\n",
       "</head>\n",
       "<body>\n",
       "    <h2></h2>\n",
       "        <table style=\"border: 1px solid #999; border-collapse: collapse;\">\n",
       "        <tr><th style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; background-color: #E9E9E9; text-align: left;\">Option</th><th style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; background-color: #E9E9E9; text-align: left;\">Default</th><th style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; background-color: #E9E9E9; text-align: left;\">Acceptable Values</th><th style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; background-color: #E9E9E9; text-align: left;\">Acceptable Types</th><th style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; background-color: #E9E9E9; text-align: left;\">Description</th></tr>\n",
       "       <tr style=\"background-color: ghostwhite;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">excludes</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">N/A</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[&#x27;list&#x27;]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">Patterns for vars to exclude in recording (processed post-includes). Uses fnmatch wildcards</td></tr>\n",
       "       <tr style=\"background-color: #F3F3F3;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">includes</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">N/A</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[&#x27;list&#x27;]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">Patterns for variables to include in recording. Uses fnmatch wildcards</td></tr>\n",
       "       <tr style=\"background-color: ghostwhite;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">record_constraints</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">True</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[True, False]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[&#x27;bool&#x27;]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">Set to True to record constraints at the driver level</td></tr>\n",
       "       <tr style=\"background-color: #F3F3F3;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">record_derivatives</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">False</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[True, False]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[&#x27;bool&#x27;]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">Set to True to record derivatives at the driver level</td></tr>\n",
       "       <tr style=\"background-color: ghostwhite;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">record_desvars</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">True</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[True, False]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[&#x27;bool&#x27;]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">Set to True to record design variables at the driver level</td></tr>\n",
       "       <tr style=\"background-color: #F3F3F3;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">record_inputs</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">True</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[True, False]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[&#x27;bool&#x27;]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">Set to True to record inputs at the driver level</td></tr>\n",
       "       <tr style=\"background-color: ghostwhite;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">record_objectives</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">True</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[True, False]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[&#x27;bool&#x27;]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">Set to True to record objectives at the driver level</td></tr>\n",
       "       <tr style=\"background-color: #F3F3F3;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">record_outputs</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">True</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[True, False]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[&#x27;bool&#x27;]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">Set True to record outputs at the driver level.</td></tr>\n",
       "       <tr style=\"background-color: ghostwhite;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">record_residuals</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">False</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[True, False]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[&#x27;bool&#x27;]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">Set True to record residuals at the driver level.</td></tr>\n",
       "       <tr style=\"background-color: #F3F3F3;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">record_responses</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">False</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[True, False]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">[&#x27;bool&#x27;]</td><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">Set True to record constraints and objectives at the driver level</td></tr>\n",
       "    </table>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import openmdao.api as om\n",
    "om.show_options_table(\"openmdao.core.driver.Driver\", recording_options=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7f5cc141",
   "metadata": {
    "papermill": {
     "duration": 0.001932,
     "end_time": "2026-10-02T14:46:18.934883+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:18.932951+00:00",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "```{note}\n",
    "Note that the `excludes` option takes precedence over the `includes` option.\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "26c5a6cc",
   "metadata": {
    "papermill": {
     "duration": 0.001755,
     "end_time": "2026-10-02T14:46:18.938431+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:18.936676+00:00",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "## Driver Recording Example\n",
    "\n",
    "In the example below, we first run a case while recording at the driver level. Then, we examine the objective, constraint, and design variable values at the last recorded case. Lastly, we print the full contents of the last case, including outputs from the problem that are not design variables, constraints, or objectives. \n",
    "\n",
    "Specifically, `y1` and `y2` are some of those intermediate outputs that are recorded due to the use of:\n",
    "\n",
    "`driver.recording_options['includes'] = ['*']`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "a377c6aa",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:18.943273Z",
     "iopub.status.busy": "2026-10-02T14:46:18.942836Z",
     "iopub.status.idle": "2026-10-02T14:46:20.084985Z",
     "shell.execute_reply": "2026-10-02T14:46:20.084413Z"
    },
    "papermill": {
     "duration": 1.145284,
     "end_time": "2026-10-02T14:46:20.085545+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:18.940261+00:00",
     "status": "completed"
    },
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [
    {
     "data": {
      "application/papermill.record/text/html": "<style>pre { line-height: 125%; }\ntd.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\nspan.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\ntd.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\nspan.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\n.output_html .hll { background-color: #ffffcc }\n.output_html { background: #f8f8f8; }\n.output_html .c { color: #3D7B7B; font-style: italic } /* Comment */\n.output_html .err { border: 1px solid #F00 } /* Error */\n.output_html .k { color: #008000; font-weight: bold } /* Keyword */\n.output_html .o { color: #666 } /* Operator */\n.output_html .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */\n.output_html .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */\n.output_html .cp { color: #9C6500 } /* Comment.Preproc */\n.output_html .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */\n.output_html .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */\n.output_html .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */\n.output_html .gd { color: #A00000 } /* Generic.Deleted */\n.output_html .ge { font-style: italic } /* Generic.Emph */\n.output_html .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */\n.output_html .gr { color: #E40000 } /* Generic.Error */\n.output_html .gh { color: #000080; font-weight: bold } /* Generic.Heading */\n.output_html .gi { color: #008400 } /* Generic.Inserted */\n.output_html .go { color: #717171 } /* Generic.Output */\n.output_html .gp { color: #000080; font-weight: bold } /* Generic.Prompt */\n.output_html .gs { font-weight: bold } /* Generic.Strong */\n.output_html .gu { color: #800080; font-weight: bold } /* Generic.Subheading */\n.output_html .gt { color: #04D } /* Generic.Traceback */\n.output_html .kc { color: #008000; font-weight: bold } /* Keyword.Constant */\n.output_html .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */\n.output_html .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */\n.output_html .kp { color: #008000 } /* Keyword.Pseudo */\n.output_html .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */\n.output_html .kt { color: #B00040 } /* Keyword.Type */\n.output_html .m { color: #666 } /* Literal.Number */\n.output_html .s { color: #BA2121 } /* Literal.String */\n.output_html .na { color: #687822 } /* Name.Attribute */\n.output_html .nb { color: #008000 } /* Name.Builtin */\n.output_html .nc { color: #00F; font-weight: bold } /* Name.Class */\n.output_html .no { color: #800 } /* Name.Constant */\n.output_html .nd { color: #A2F } /* Name.Decorator */\n.output_html .ni { color: #717171; font-weight: bold } /* Name.Entity */\n.output_html .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */\n.output_html .nf { color: #00F } /* Name.Function */\n.output_html .nl { color: #767600 } /* Name.Label */\n.output_html .nn { color: #00F; font-weight: bold } /* Name.Namespace */\n.output_html .nt { color: #008000; font-weight: bold } /* Name.Tag */\n.output_html .nv { color: #19177C } /* Name.Variable */\n.output_html .ow { color: #A2F; font-weight: bold } /* Operator.Word */\n.output_html .w { color: #BBB } /* Text.Whitespace */\n.output_html .mb { color: #666 } /* Literal.Number.Bin */\n.output_html .mf { color: #666 } /* Literal.Number.Float */\n.output_html .mh { color: #666 } /* Literal.Number.Hex */\n.output_html .mi { color: #666 } /* Literal.Number.Integer */\n.output_html .mo { color: #666 } /* Literal.Number.Oct */\n.output_html .sa { color: #BA2121 } /* Literal.String.Affix */\n.output_html .sb { color: #BA2121 } /* Literal.String.Backtick */\n.output_html .sc { color: #BA2121 } /* Literal.String.Char */\n.output_html .dl { color: #BA2121 } /* Literal.String.Delimiter */\n.output_html .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */\n.output_html .s2 { color: #BA2121 } /* Literal.String.Double */\n.output_html .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */\n.output_html .sh { color: #BA2121 } /* Literal.String.Heredoc */\n.output_html .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */\n.output_html .sx { color: #008000 } /* Literal.String.Other */\n.output_html .sr { color: #A45A77 } /* Literal.String.Regex */\n.output_html .s1 { color: #BA2121 } /* Literal.String.Single */\n.output_html .ss { color: #19177C } /* Literal.String.Symbol */\n.output_html .bp { color: #008000 } /* Name.Builtin.Pseudo */\n.output_html .fm { color: #00F } /* Name.Function.Magic */\n.output_html .vc { color: #19177C } /* Name.Variable.Class */\n.output_html .vg { color: #19177C } /* Name.Variable.Global */\n.output_html .vi { color: #19177C } /* Name.Variable.Instance */\n.output_html .vm { color: #19177C } /* Name.Variable.Magic */\n.output_html .il { color: #666 } /* Literal.Number.Integer.Long */</style><div class=\"highlight\"><pre><span></span><span class=\"k\">class</span><span class=\"w\"> </span><span class=\"nc\">SellarDerivatives</span><span class=\"p\">(</span><span class=\"n\">om</span><span class=\"o\">.</span><span class=\"n\">Group</span><span class=\"p\">):</span>\n<span class=\"w\">    </span><span class=\"sd\">&quot;&quot;&quot;</span>\n<span class=\"sd\">    Group containing the Sellar MDA. This version uses the disciplines with derivatives.</span>\n<span class=\"sd\">    &quot;&quot;&quot;</span>\n\n    <span class=\"k\">def</span><span class=\"w\"> </span><span class=\"nf\">setup</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n        <span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">add_subsystem</span><span class=\"p\">(</span><span class=\"s1\">&#39;d1&#39;</span><span class=\"p\">,</span> <span class=\"n\">SellarDis1withDerivatives</span><span class=\"p\">(),</span> <span class=\"n\">promotes</span><span class=\"o\">=</span><span class=\"p\">[</span><span class=\"s1\">&#39;x&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;z&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;y1&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;y2&#39;</span><span class=\"p\">])</span>\n        <span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">add_subsystem</span><span class=\"p\">(</span><span class=\"s1\">&#39;d2&#39;</span><span class=\"p\">,</span> <span class=\"n\">SellarDis2withDerivatives</span><span class=\"p\">(),</span> <span class=\"n\">promotes</span><span class=\"o\">=</span><span class=\"p\">[</span><span class=\"s1\">&#39;z&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;y1&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;y2&#39;</span><span class=\"p\">])</span>\n\n        <span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">add_subsystem</span><span class=\"p\">(</span><span class=\"s1\">&#39;obj_cmp&#39;</span><span class=\"p\">,</span> <span class=\"n\">om</span><span class=\"o\">.</span><span class=\"n\">ExecComp</span><span class=\"p\">(</span><span class=\"s1\">&#39;obj = x**2 + z[1] + y1 + exp(-y2)&#39;</span><span class=\"p\">,</span> <span class=\"n\">obj</span><span class=\"o\">=</span><span class=\"mf\">0.0</span><span class=\"p\">,</span>\n                                                  <span class=\"n\">x</span><span class=\"o\">=</span><span class=\"mf\">0.0</span><span class=\"p\">,</span> <span class=\"n\">z</span><span class=\"o\">=</span><span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">array</span><span class=\"p\">([</span><span class=\"mf\">0.0</span><span class=\"p\">,</span> <span class=\"mf\">0.0</span><span class=\"p\">]),</span> <span class=\"n\">y1</span><span class=\"o\">=</span><span class=\"mf\">0.0</span><span class=\"p\">,</span> <span class=\"n\">y2</span><span class=\"o\">=</span><span class=\"mf\">0.0</span><span class=\"p\">),</span>\n                           <span class=\"n\">promotes</span><span class=\"o\">=</span><span class=\"p\">[</span><span class=\"s1\">&#39;obj&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;x&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;z&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;y1&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;y2&#39;</span><span class=\"p\">])</span>\n\n        <span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">add_subsystem</span><span class=\"p\">(</span><span class=\"s1\">&#39;con_cmp1&#39;</span><span class=\"p\">,</span> <span class=\"n\">om</span><span class=\"o\">.</span><span class=\"n\">ExecComp</span><span class=\"p\">(</span><span class=\"s1\">&#39;con1 = 3.16 - y1&#39;</span><span class=\"p\">,</span> <span class=\"n\">con1</span><span class=\"o\">=</span><span class=\"mf\">0.0</span><span class=\"p\">,</span> <span class=\"n\">y1</span><span class=\"o\">=</span><span class=\"mf\">0.0</span><span class=\"p\">),</span>\n                           <span class=\"n\">promotes</span><span class=\"o\">=</span><span class=\"p\">[</span><span class=\"s1\">&#39;con1&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;y1&#39;</span><span class=\"p\">])</span>\n        <span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">add_subsystem</span><span class=\"p\">(</span><span class=\"s1\">&#39;con_cmp2&#39;</span><span class=\"p\">,</span> <span class=\"n\">om</span><span class=\"o\">.</span><span class=\"n\">ExecComp</span><span class=\"p\">(</span><span class=\"s1\">&#39;con2 = y2 - 24.0&#39;</span><span class=\"p\">,</span> <span class=\"n\">con2</span><span class=\"o\">=</span><span class=\"mf\">0.0</span><span class=\"p\">,</span> <span class=\"n\">y2</span><span class=\"o\">=</span><span class=\"mf\">0.0</span><span class=\"p\">),</span>\n                           <span class=\"n\">promotes</span><span class=\"o\">=</span><span class=\"p\">[</span><span class=\"s1\">&#39;con2&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;y2&#39;</span><span class=\"p\">])</span>\n\n        <span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">set_input_defaults</span><span class=\"p\">(</span><span class=\"s1\">&#39;x&#39;</span><span class=\"p\">,</span> <span class=\"mf\">1.0</span><span class=\"p\">)</span>\n        <span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">set_input_defaults</span><span class=\"p\">(</span><span class=\"s1\">&#39;z&#39;</span><span class=\"p\">,</span> <span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">array</span><span class=\"p\">([</span><span class=\"mf\">5.0</span><span class=\"p\">,</span> <span class=\"mf\">2.0</span><span class=\"p\">]))</span>\n</pre></div>\n",
      "application/papermill.record/text/latex": "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n\\PY{k}{class}\\PY{+w}{ }\\PY{n+nc}{SellarDerivatives}\\PY{p}{(}\\PY{n}{om}\\PY{o}{.}\\PY{n}{Group}\\PY{p}{)}\\PY{p}{:}\n\\PY{+w}{    }\\PY{l+s+sd}{\\PYZdq{}\\PYZdq{}\\PYZdq{}}\n\\PY{l+s+sd}{    Group containing the Sellar MDA. This version uses the disciplines with derivatives.}\n\\PY{l+s+sd}{    \\PYZdq{}\\PYZdq{}\\PYZdq{}}\n\n    \\PY{k}{def}\\PY{+w}{ }\\PY{n+nf}{setup}\\PY{p}{(}\\PY{n+nb+bp}{self}\\PY{p}{)}\\PY{p}{:}\n        \\PY{n+nb+bp}{self}\\PY{o}{.}\\PY{n}{add\\PYZus{}subsystem}\\PY{p}{(}\\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{d1}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{n}{SellarDis1withDerivatives}\\PY{p}{(}\\PY{p}{)}\\PY{p}{,} \\PY{n}{promotes}\\PY{o}{=}\\PY{p}{[}\\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{x}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{z}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{y1}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{y2}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{]}\\PY{p}{)}\n        \\PY{n+nb+bp}{self}\\PY{o}{.}\\PY{n}{add\\PYZus{}subsystem}\\PY{p}{(}\\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{d2}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{n}{SellarDis2withDerivatives}\\PY{p}{(}\\PY{p}{)}\\PY{p}{,} \\PY{n}{promotes}\\PY{o}{=}\\PY{p}{[}\\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{z}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{y1}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{y2}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{]}\\PY{p}{)}\n\n        \\PY{n+nb+bp}{self}\\PY{o}{.}\\PY{n}{add\\PYZus{}subsystem}\\PY{p}{(}\\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{obj\\PYZus{}cmp}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{n}{om}\\PY{o}{.}\\PY{n}{ExecComp}\\PY{p}{(}\\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{obj = x**2 + z[1] + y1 + exp(\\PYZhy{}y2)}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{n}{obj}\\PY{o}{=}\\PY{l+m+mf}{0.0}\\PY{p}{,}\n                                                  \\PY{n}{x}\\PY{o}{=}\\PY{l+m+mf}{0.0}\\PY{p}{,} \\PY{n}{z}\\PY{o}{=}\\PY{n}{np}\\PY{o}{.}\\PY{n}{array}\\PY{p}{(}\\PY{p}{[}\\PY{l+m+mf}{0.0}\\PY{p}{,} \\PY{l+m+mf}{0.0}\\PY{p}{]}\\PY{p}{)}\\PY{p}{,} \\PY{n}{y1}\\PY{o}{=}\\PY{l+m+mf}{0.0}\\PY{p}{,} \\PY{n}{y2}\\PY{o}{=}\\PY{l+m+mf}{0.0}\\PY{p}{)}\\PY{p}{,}\n                           \\PY{n}{promotes}\\PY{o}{=}\\PY{p}{[}\\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{obj}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{x}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{z}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{y1}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{y2}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{]}\\PY{p}{)}\n\n        \\PY{n+nb+bp}{self}\\PY{o}{.}\\PY{n}{add\\PYZus{}subsystem}\\PY{p}{(}\\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{con\\PYZus{}cmp1}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{n}{om}\\PY{o}{.}\\PY{n}{ExecComp}\\PY{p}{(}\\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{con1 = 3.16 \\PYZhy{} y1}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{n}{con1}\\PY{o}{=}\\PY{l+m+mf}{0.0}\\PY{p}{,} \\PY{n}{y1}\\PY{o}{=}\\PY{l+m+mf}{0.0}\\PY{p}{)}\\PY{p}{,}\n                           \\PY{n}{promotes}\\PY{o}{=}\\PY{p}{[}\\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{con1}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{y1}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{]}\\PY{p}{)}\n        \\PY{n+nb+bp}{self}\\PY{o}{.}\\PY{n}{add\\PYZus{}subsystem}\\PY{p}{(}\\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{con\\PYZus{}cmp2}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{n}{om}\\PY{o}{.}\\PY{n}{ExecComp}\\PY{p}{(}\\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{con2 = y2 \\PYZhy{} 24.0}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{n}{con2}\\PY{o}{=}\\PY{l+m+mf}{0.0}\\PY{p}{,} \\PY{n}{y2}\\PY{o}{=}\\PY{l+m+mf}{0.0}\\PY{p}{)}\\PY{p}{,}\n                           \\PY{n}{promotes}\\PY{o}{=}\\PY{p}{[}\\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{con2}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{y2}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{]}\\PY{p}{)}\n\n        \\PY{n+nb+bp}{self}\\PY{o}{.}\\PY{n}{set\\PYZus{}input\\PYZus{}defaults}\\PY{p}{(}\\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{x}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{l+m+mf}{1.0}\\PY{p}{)}\n        \\PY{n+nb+bp}{self}\\PY{o}{.}\\PY{n}{set\\PYZus{}input\\PYZus{}defaults}\\PY{p}{(}\\PY{l+s+s1}{\\PYZsq{}}\\PY{l+s+s1}{z}\\PY{l+s+s1}{\\PYZsq{}}\\PY{p}{,} \\PY{n}{np}\\PY{o}{.}\\PY{n}{array}\\PY{p}{(}\\PY{p}{[}\\PY{l+m+mf}{5.0}\\PY{p}{,} \\PY{l+m+mf}{2.0}\\PY{p}{]}\\PY{p}{)}\\PY{p}{)}\n\\end{Verbatim}\n",
      "application/papermill.record/text/plain": "class SellarDerivatives(om.Group):\n    \"\"\"\n    Group containing the Sellar MDA. This version uses the disciplines with derivatives.\n    \"\"\"\n\n    def setup(self):\n        self.add_subsystem('d1', SellarDis1withDerivatives(), promotes=['x', 'z', 'y1', 'y2'])\n        self.add_subsystem('d2', SellarDis2withDerivatives(), promotes=['z', 'y1', 'y2'])\n\n        self.add_subsystem('obj_cmp', om.ExecComp('obj = x**2 + z[1] + y1 + exp(-y2)', obj=0.0,\n                                                  x=0.0, z=np.array([0.0, 0.0]), y1=0.0, y2=0.0),\n                           promotes=['obj', 'x', 'z', 'y1', 'y2'])\n\n        self.add_subsystem('con_cmp1', om.ExecComp('con1 = 3.16 - y1', con1=0.0, y1=0.0),\n                           promotes=['con1', 'y1'])\n        self.add_subsystem('con_cmp2', om.ExecComp('con2 = y2 - 24.0', con2=0.0, y2=0.0),\n                           promotes=['con2', 'y2'])\n\n        self.set_input_defaults('x', 1.0)\n        self.set_input_defaults('z', np.array([5.0, 2.0]))"
     },
     "metadata": {
      "scrapbook": {
       "mime_prefix": "application/papermill.record/",
       "name": "code_src89"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from openmdao.utils.notebook_utils import get_code\n",
    "from myst_nb import glue\n",
    "glue(\"code_src89\", get_code(\"openmdao.test_suite.components.sellar_feature.SellarDerivatives\"), display=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4fefdee2",
   "metadata": {
    "papermill": {
     "duration": 0.002039,
     "end_time": "2026-10-02T14:46:20.089933+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:20.087894+00:00",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    ":::{dropdown} `SellarDerivatives` class definition \n",
    "\n",
    "{glue:}`code_src89`\n",
    ":::"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "3fd9eaf7",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:20.095000Z",
     "iopub.status.busy": "2026-10-02T14:46:20.094708Z",
     "iopub.status.idle": "2026-10-02T14:46:22.301419Z",
     "shell.execute_reply": "2026-10-02T14:46:22.301004Z"
    },
    "papermill": {
     "duration": 2.210338,
     "end_time": "2026-10-02T14:46:22.302311+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:20.091973+00:00",
     "status": "completed"
    },
    "scrolled": false,
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1790952381.314932] [runnervm8df0l:10505:0]        ib_iface.c:1269 UCX  ERROR mana_0: iface 0x55a3d379b4d0 failed to create UD QP TX wr:256 sge:6 inl:64 resp:0 RX wr:4096 sge:1 resp:0 failed: Operation not supported\n",
      "[1790952381.315184] [runnervm8df0l:10505:0]      ucp_worker.c:1412 UCX  ERROR uct_iface_open(ud_verbs/mana_0:1) failed: Input/output error\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[runnervm8df0l:10505] pml_ucx.c:313  Error: Failed to create UCP worker\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NL: NLBGS Converged in 8 iterations\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NL: NLBGS Converged in 1 iterations\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NL: NLBGS Converged in 9 iterations\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NL: NLBGS Converged in 10 iterations\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NL: NLBGS Converged in 10 iterations\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NL: NLBGS Converged in 9 iterations\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NL: NLBGS Converged in 6 iterations\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Optimization terminated successfully    (Exit mode 0)\n",
      "            Current function value: 3.183393951730529\n",
      "            Iterations: 6\n",
      "            Function evaluations: 6\n",
      "            Gradient evaluations: 6\n",
      "Optimization Complete\n",
      "-----------------------------------\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "Problem: driver_recording\n",
       "Driver:  ScipyOptimizeDriver\n",
       "  success     : True\n",
       "  iterations  : 7\n",
       "  runtime     : 4.3496E-01 s\n",
       "  model_evals : 7\n",
       "  model_time  : 8.3284E-03 s\n",
       "  deriv_evals : 6\n",
       "  deriv_time  : 4.8648E-02 s\n",
       "  exit_status : SUCCESS"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import openmdao.api as om\n",
    "from openmdao.test_suite.components.sellar_feature import SellarDerivatives\n",
    "\n",
    "import numpy as np\n",
    "\n",
    "model = SellarDerivatives()\n",
    "\n",
    "model.nonlinear_solver = om.NonlinearBlockGS()\n",
    "model.linear_solver = om.ScipyKrylov()\n",
    "\n",
    "model.add_design_var('z', lower=np.array([-10.0, 0.0]),\n",
    "                          upper=np.array([10.0, 10.0]))\n",
    "model.add_design_var('x', lower=0.0, upper=10.0)\n",
    "model.add_objective('obj')\n",
    "model.add_constraint('con1', upper=0.0)\n",
    "model.add_constraint('con2', upper=0.0)\n",
    "\n",
    "driver = om.ScipyOptimizeDriver(optimizer='SLSQP', tol=1e-9)\n",
    "\n",
    "driver.recording_options['includes'] = ['*']\n",
    "driver.recording_options['record_objectives'] = True\n",
    "driver.recording_options['record_constraints'] = True\n",
    "driver.recording_options['record_desvars'] = True\n",
    "driver.recording_options['record_inputs'] = True\n",
    "driver.recording_options['record_outputs'] = True\n",
    "driver.recording_options['record_residuals'] = True\n",
    "\n",
    "driver.add_recorder(om.SqliteRecorder(\"driver_recording.sql\"))\n",
    "\n",
    "prob = om.Problem(name='driver_recording', model=model, driver=driver)\n",
    "prob.setup()\n",
    "prob.run_driver()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "9fb08419",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.308381Z",
     "iopub.status.busy": "2026-10-02T14:46:22.307992Z",
     "iopub.status.idle": "2026-10-02T14:46:22.543412Z",
     "shell.execute_reply": "2026-10-02T14:46:22.542565Z"
    },
    "papermill": {
     "duration": 0.23893,
     "end_time": "2026-10-02T14:46:22.543890+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.304960+00:00",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<!DOCTYPE html>\n",
       "<html lang=\"en\">\n",
       "<head>\n",
       "    <style>\n",
       "        h2 {\n",
       "            text-align: center;\n",
       "        }\n",
       "    </style>\n",
       "</head>\n",
       "<body>\n",
       "    <h2></h2>\n",
       "        <table style=\"border: 1px solid #999; border-collapse: collapse;\">\n",
       "        <tr><th style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; background-color: #E9E9E9; text-align: left;\">driver</th></tr>\n",
       "       <tr style=\"background-color: ghostwhite;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">rank0:ScipyOptimize_SLSQP|0</td></tr>\n",
       "       <tr style=\"background-color: #F3F3F3;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">rank0:ScipyOptimize_SLSQP|1</td></tr>\n",
       "       <tr style=\"background-color: ghostwhite;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">rank0:ScipyOptimize_SLSQP|2</td></tr>\n",
       "       <tr style=\"background-color: #F3F3F3;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">rank0:ScipyOptimize_SLSQP|3</td></tr>\n",
       "       <tr style=\"background-color: ghostwhite;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">rank0:ScipyOptimize_SLSQP|4</td></tr>\n",
       "       <tr style=\"background-color: #F3F3F3;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">rank0:ScipyOptimize_SLSQP|5</td></tr>\n",
       "       <tr style=\"background-color: ghostwhite;\"><td style=\"border: 1px solid #999; border-collapse: collapse; padding: 5px; text-align: left;\">rank0:ScipyOptimize_SLSQP|6</td></tr>\n",
       "    </table>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "prob.cleanup()\n",
    "cr = om.CaseReader(prob.get_outputs_dir() / \"driver_recording.sql\")\n",
    "driver_cases = cr.list_cases('driver')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "7620fd4f",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.550095Z",
     "iopub.status.busy": "2026-10-02T14:46:22.549798Z",
     "iopub.status.idle": "2026-10-02T14:46:22.553191Z",
     "shell.execute_reply": "2026-10-02T14:46:22.552416Z"
    },
    "papermill": {
     "duration": 0.006987,
     "end_time": "2026-10-02T14:46:22.553628+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.546641+00:00",
     "status": "completed"
    },
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [],
   "source": [
    "assert len(driver_cases) == 7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "b7c24dd7",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.559662Z",
     "iopub.status.busy": "2026-10-02T14:46:22.559508Z",
     "iopub.status.idle": "2026-10-02T14:46:22.563662Z",
     "shell.execute_reply": "2026-10-02T14:46:22.562967Z"
    },
    "papermill": {
     "duration": 0.008216,
     "end_time": "2026-10-02T14:46:22.564126+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.555910+00:00",
     "status": "completed"
    },
    "scrolled": false,
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "driver rank0:ScipyOptimize_SLSQP|6 {'x': array([5.63626006e-15]), 'z': array([1.97763888, 0.        ]), 'con1': array([-9.11004605e-11]), 'con2': array([-20.24472223]), 'y1': array([3.16]), 'y2': array([3.75527777]), 'obj': array([3.18339395])}\n"
     ]
    }
   ],
   "source": [
    "last_case = cr.get_case(driver_cases[-1])\n",
    "print(last_case)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "650e4714",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.569649Z",
     "iopub.status.busy": "2026-10-02T14:46:22.569380Z",
     "iopub.status.idle": "2026-10-02T14:46:22.573861Z",
     "shell.execute_reply": "2026-10-02T14:46:22.573159Z"
    },
    "papermill": {
     "duration": 0.00789,
     "end_time": "2026-10-02T14:46:22.574314+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.566424+00:00",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'obj': array([3.18339395])}"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "last_case.get_objectives()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "cbe1e9d4",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.579909Z",
     "iopub.status.busy": "2026-10-02T14:46:22.579613Z",
     "iopub.status.idle": "2026-10-02T14:46:22.584217Z",
     "shell.execute_reply": "2026-10-02T14:46:22.583457Z"
    },
    "papermill": {
     "duration": 0.007903,
     "end_time": "2026-10-02T14:46:22.584667+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.576764+00:00",
     "status": "completed"
    },
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "np.float64(5.436113407797904e-10)"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "assert_near_equal(last_case.get_objectives()['obj'], 3.18339395, tolerance=1e-8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "7010c1aa",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.590614Z",
     "iopub.status.busy": "2026-10-02T14:46:22.590010Z",
     "iopub.status.idle": "2026-10-02T14:46:22.597933Z",
     "shell.execute_reply": "2026-10-02T14:46:22.596315Z"
    },
    "papermill": {
     "duration": 0.011307,
     "end_time": "2026-10-02T14:46:22.598393+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.587086+00:00",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'z': array([1.97763888, 0.        ]), 'x': array([5.63626006e-15])}"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "last_case.get_design_vars()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "3d071c8c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.638140Z",
     "iopub.status.busy": "2026-10-02T14:46:22.637976Z",
     "iopub.status.idle": "2026-10-02T14:46:22.644453Z",
     "shell.execute_reply": "2026-10-02T14:46:22.643540Z"
    },
    "papermill": {
     "duration": 0.04418,
     "end_time": "2026-10-02T14:46:22.645022+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.600842+00:00",
     "status": "completed"
    },
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "np.float64(1.7637977961360507e-09)"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "design_vars = last_case.get_design_vars()\n",
    "assert_near_equal(design_vars['x'], 0., tolerance=1e-8)\n",
    "assert_near_equal(design_vars['z'][0], 1.97763888, tolerance=1e-8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "708a6125",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.651223Z",
     "iopub.status.busy": "2026-10-02T14:46:22.651050Z",
     "iopub.status.idle": "2026-10-02T14:46:22.655989Z",
     "shell.execute_reply": "2026-10-02T14:46:22.655052Z"
    },
    "papermill": {
     "duration": 0.008764,
     "end_time": "2026-10-02T14:46:22.656520+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.647756+00:00",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'con1': array([-9.11004605e-11]), 'con2': array([-20.24472223])}"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "last_case.get_constraints()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "da04fb33",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.662398Z",
     "iopub.status.busy": "2026-10-02T14:46:22.662236Z",
     "iopub.status.idle": "2026-10-02T14:46:22.667357Z",
     "shell.execute_reply": "2026-10-02T14:46:22.666451Z"
    },
    "papermill": {
     "duration": 0.010094,
     "end_time": "2026-10-02T14:46:22.669154+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.659060+00:00",
     "status": "completed"
    },
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "np.float64(1.4932798340865912e-10)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "constraints = last_case.get_constraints()\n",
    "assert_near_equal(constraints['con1'], 0, tolerance=1e-8)\n",
    "assert_near_equal(constraints['con2'], -20.24472223, tolerance=1e-8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "5366fe98",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.675770Z",
     "iopub.status.busy": "2026-10-02T14:46:22.675186Z",
     "iopub.status.idle": "2026-10-02T14:46:22.679721Z",
     "shell.execute_reply": "2026-10-02T14:46:22.678947Z"
    },
    "papermill": {
     "duration": 0.008283,
     "end_time": "2026-10-02T14:46:22.680161+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.671878+00:00",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([5.63626006e-15])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "last_case.inputs['obj_cmp.x']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "f014d126",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.686098Z",
     "iopub.status.busy": "2026-10-02T14:46:22.685948Z",
     "iopub.status.idle": "2026-10-02T14:46:22.689658Z",
     "shell.execute_reply": "2026-10-02T14:46:22.688460Z"
    },
    "papermill": {
     "duration": 0.007343,
     "end_time": "2026-10-02T14:46:22.690172+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.682829+00:00",
     "status": "completed"
    },
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "np.float64(5.636260060859323e-15)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "assert_near_equal(last_case.inputs['obj_cmp.x'], 0, tolerance=1e-8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "48f0da4c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.696229Z",
     "iopub.status.busy": "2026-10-02T14:46:22.696001Z",
     "iopub.status.idle": "2026-10-02T14:46:22.700491Z",
     "shell.execute_reply": "2026-10-02T14:46:22.699724Z"
    },
    "papermill": {
     "duration": 0.00809,
     "end_time": "2026-10-02T14:46:22.700953+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.692863+00:00",
     "status": "completed"
    },
    "scrolled": true,
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1.97763888, 0.        ])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "last_case.outputs['z']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "830be9a4",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.707422Z",
     "iopub.status.busy": "2026-10-02T14:46:22.707164Z",
     "iopub.status.idle": "2026-10-02T14:46:22.711707Z",
     "shell.execute_reply": "2026-10-02T14:46:22.710944Z"
    },
    "papermill": {
     "duration": 0.008579,
     "end_time": "2026-10-02T14:46:22.712119+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.703540+00:00",
     "status": "completed"
    },
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "np.float64(0.0)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "assert_near_equal(last_case.outputs['z'][0], 1.97763888, tolerance=1e-8)\n",
    "assert_near_equal(last_case.outputs['z'][1], 0, tolerance=1e-8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "d58ac713",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.729265Z",
     "iopub.status.busy": "2026-10-02T14:46:22.729112Z",
     "iopub.status.idle": "2026-10-02T14:46:22.732860Z",
     "shell.execute_reply": "2026-10-02T14:46:22.732139Z"
    },
    "papermill": {
     "duration": 0.018519,
     "end_time": "2026-10-02T14:46:22.733283+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.714764+00:00",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([3.88031829e-11])"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "last_case.residuals['obj']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "9bce5416",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.739599Z",
     "iopub.status.busy": "2026-10-02T14:46:22.739461Z",
     "iopub.status.idle": "2026-10-02T14:46:22.743082Z",
     "shell.execute_reply": "2026-10-02T14:46:22.742363Z"
    },
    "papermill": {
     "duration": 0.007344,
     "end_time": "2026-10-02T14:46:22.743501+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.736157+00:00",
     "status": "completed"
    },
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "np.float64(3.880318288906892e-11)"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "assert_near_equal(last_case.residuals['obj'], 0, tolerance=1e-8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "004cf155",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.750108Z",
     "iopub.status.busy": "2026-10-02T14:46:22.749964Z",
     "iopub.status.idle": "2026-10-02T14:46:22.753785Z",
     "shell.execute_reply": "2026-10-02T14:46:22.753024Z"
    },
    "papermill": {
     "duration": 0.007554,
     "end_time": "2026-10-02T14:46:22.754212+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.746658+00:00",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([3.16])"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "last_case['y1']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "526351a3",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:22.760442Z",
     "iopub.status.busy": "2026-10-02T14:46:22.760296Z",
     "iopub.status.idle": "2026-10-02T14:46:22.763081Z",
     "shell.execute_reply": "2026-10-02T14:46:22.762627Z"
    },
    "papermill": {
     "duration": 0.007116,
     "end_time": "2026-10-02T14:46:22.764076+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:22.756960+00:00",
     "status": "completed"
    },
    "tags": [
     "remove-input",
     "remove-output"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "np.float64(2.8829259654633494e-11)"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "assert_near_equal(last_case['y1'], 3.16, tolerance=1e-8)"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Tags",
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.13.14"
  },
  "orphan": true,
  "papermill": {
   "default_parameters": {},
   "duration": 7.059917,
   "end_time": "2026-10-02T14:46:23.716067+00:00",
   "environment_variables": {},
   "exception": null,
   "input_path": "/home/runner/work/OpenMDAO/OpenMDAO/openmdao/docs/openmdao_book/features/recording/driver_recording.ipynb",
   "output_path": "/home/runner/work/OpenMDAO/OpenMDAO/openmdao/docs/_executed_book/features/recording/driver_recording.ipynb",
   "parameters": {},
   "start_time": "2026-10-02T14:46:16.656150+00:00",
   "version": "2.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}