{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Formulation\n\nIn this example, we will discover the different functions of the API\nrelated to MDO formulations: their names, their options and their sub-options.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "from __future__ import division, unicode_literals\n\nfrom gemseo.api import (\n    configure_logger,\n    get_available_formulations,\n    get_formulation_options_schema,\n    get_formulation_sub_options_schema,\n    get_formulations_options_defaults,\n    get_formulations_sub_options_defaults,\n)\n\nconfigure_logger()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Get available formulations\n\nThe :meth:`~gemseo.api.get_available_formulations` function returns the list\nof MDO formulations available in |g| or in external modules\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "print(get_available_formulations())"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Get formulation schemas for (sub-)options\nFor a given MDO formulation, e.g. :code:`\"MDF\"`, we can:\n\n- get the options of an MDO formulation using the\n  :meth:`~gemseo.api.get_formulation_options_schema` function; e.g.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "print(get_formulation_options_schema(\"MDF\"))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "- get the default option values using the\n  :meth:`~gemseo.api.get_formulations_options_defaults` function; e.g.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "print(get_formulations_options_defaults(\"MDF\"))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "- get sub-options of an MDO formulation using the\n  :meth:`~gemseo.api.get_formulation_sub_options_schema` function; e.g.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "print(get_formulation_sub_options_schema(\"MDF\", main_mda_class=\"MDAGaussSeidel\"))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "- get the sub-option values using the\n  :meth:`~gemseo.api.get_formulations_sub_options_defaults` function; e.g.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "print(get_formulations_sub_options_defaults(\"MDF\", main_mda_class=\"MDAGaussSeidel\"))"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.8.13"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}