{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "39e7adde",
   "metadata": {
    "tags": [
     "active-ipynb",
     "remove-input",
     "remove-output"
    ]
   },
   "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": "markdown",
   "id": "643df1fc",
   "metadata": {},
   "source": [
    "# Autoscaler API\n",
    "\n",
    "By default, OpenMDAO uses manual specification for the scaling of design variables, constraints, and objectives in optimization.\n",
    "These are either specified with `scaler` and `adder` or `ref0` and `ref` when adding design variables, constraints, or objectives.\n",
    "\n",
    "In some cases, users may want to apply automatic scaling algorithms of their own. For that purpose, we provide an Autoscaler API.\n",
    "\n",
    "Presently, OpenMDAO only comes with a default `Autoscaler`, which is the default option for Drivers.\n",
    "\n",
    "This uses the scaling provided by the user to specify an overall \"total scaler\" and \"total adder\" for each variable.\n",
    "User's wishing to implement their own scaling algorithm with a diagonal, linear scaling approach can simply override the definitions of \"total_scaler\" and \"total_adder\".\n",
    "\n",
    "Otherwise, they are free to use the autoscaling methods to implement more advanced techniques."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "72eaa8f2",
   "metadata": {},
   "source": [
    "\n",
    "## Autoscaler\n",
    "\n",
    "In implementing their own Autoscaler methods, users may utilize the following API.\n",
    "\n",
    "```{eval-rst}\n",
    "    .. autoattribute:: openmdao.drivers.autoscalers.autoscaler.Autoscaler.has_scaling\n",
    "        :noindex:\n",
    "```\n",
    "\n",
    "```{eval-rst}\n",
    "    .. autoattribute:: openmdao.drivers.autoscalers.autoscaler.Autoscaler.setup_requires_run_model\n",
    "        :noindex:\n",
    "```\n",
    "\n",
    "```{eval-rst}\n",
    "    .. automethod:: openmdao.drivers.autoscalers.autoscaler.Autoscaler.setup\n",
    "        :noindex:\n",
    "```\n",
    "\n",
    "```{eval-rst}\n",
    "    .. autoattribute:: openmdao.drivers.autoscalers.autoscaler.Autoscaler.report_after_setup\n",
    "        :noindex:\n",
    "```\n",
    "\n",
    "```{eval-rst}\n",
    "    .. automethod:: openmdao.drivers.autoscalers.autoscaler.Autoscaler.get_bounds_scaling\n",
    "        :noindex:\n",
    "```\n",
    "\n",
    "```{eval-rst}\n",
    "    .. automethod:: openmdao.drivers.autoscalers.autoscaler.Autoscaler.apply_design_var_scaling\n",
    "        :noindex:\n",
    "```\n",
    "\n",
    "```{eval-rst}\n",
    "    .. automethod:: openmdao.drivers.autoscalers.autoscaler.Autoscaler.apply_design_var_unscaling\n",
    "        :noindex:\n",
    "```\n",
    "\n",
    "```{eval-rst}\n",
    "    .. automethod:: openmdao.drivers.autoscalers.autoscaler.Autoscaler.apply_constraint_scaling\n",
    "        :noindex:\n",
    "```\n",
    "\n",
    "```{eval-rst}\n",
    "    .. automethod:: openmdao.drivers.autoscalers.autoscaler.Autoscaler.apply_objective_scaling\n",
    "        :noindex:\n",
    "```\n",
    "\n",
    "```{eval-rst}\n",
    "    .. automethod:: openmdao.drivers.autoscalers.autoscaler.Autoscaler.apply_mult_unscaling\n",
    "        :noindex:\n",
    "```\n",
    "\n",
    "```{eval-rst}\n",
    "    .. automethod:: openmdao.drivers.autoscalers.autoscaler.Autoscaler.apply_jac_scaling\n",
    "        :noindex:\n",
    "```\n",
    "\n",
    "In addition, more advanced methods may require overriding the following\n",
    "\n",
    "```{eval-rst}\n",
    "    .. automethod:: openmdao.drivers.autoscalers.autoscaler.Autoscaler._compute_scaled_bounds\n",
    "        :noindex:\n",
    "```\n",
    "\n",
    "```{eval-rst}\n",
    "    .. automethod:: openmdao.drivers.autoscalers.autoscaler.Autoscaler._scale_bound\n",
    "        :noindex:\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8a87cb8a",
   "metadata": {},
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "dev",
   "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.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
