{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "nit",
              "annotation": "int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The number of iterations. Used to keep an accurate iteration total in the two-phase problem."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "status",
              "annotation": "int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "An integer representing the exit status of the optimization   "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "0 : Optimization terminated successfully\n1 : Iteration limit reached\n2 : Problem appears to be infeasible\n3 : Problem appears to be unbounded\n4 : Serious numerical difficulties encountered",
                  "execution_status": null
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Solve a linear programming problem in \"standard form\" using the Simplex Method. Linear Programming is intended to solve the following problem form:"
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "T",
              "annotation": "2-D array",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A 2-D array representing the simplex tableau, T, corresponding to the linear programming problem. It should have the form:"
                    }
                  ]
                },
                {
                  "__type": "DefList",
                  "__tag": 4033,
                  "children": [
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "[[A[0, 0], A[0, 1], ..., A[0, n_total], b[0]],"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "[A[1, 0], A[1, 1], ..., A[1, n_total], b[1]],  .  .  .  [A[m, 0], A[m, 1], ..., A[m, n_total], b[m]],  [c[0],   c[1], ...,   c[n_total],    0]]"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "for a Phase 2 problem, or the form:"
                    }
                  ]
                },
                {
                  "__type": "DefList",
                  "__tag": 4033,
                  "children": [
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "[[A[0, 0], A[0, 1], ..., A[0, n_total], b[0]],"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "[A[1, 0], A[1, 1], ..., A[1, n_total], b[1]],  .  .  .  [A[m, 0], A[m, 1], ..., A[m, n_total], b[m]],  [c[0],   c[1], ...,   c[n_total],   0],  [c'[0],  c'[1], ...,  c'[n_total],  0]]"
                            }
                          ]
                        },
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "for a Phase 1 problem (a problem in which a basic feasible solution is  sought prior to maximizing the actual objective. "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "T"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is modified in  place by "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "_solve_simplex"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "n",
              "annotation": "int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The number of true variables in the problem."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "basis",
              "annotation": "1-D array",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "An array of the indices of the basic variables, such that basis[i] contains the column corresponding to the basic variable for row i. Basis is modified in place by _solve_simplex"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "callback",
              "annotation": "callable, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If a callback function is provided, it will be called within each iteration of the algorithm. The callback must accept a "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "scipy.optimize.OptimizeResult",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": "scipy",
                        "version": "*",
                        "kind": "api",
                        "path": "scipy.optimize._optimize:OptimizeResult"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " consisting of the following fields:"
                    }
                  ]
                },
                {
                  "__type": "Blockquote",
                  "__tag": 4059,
                  "children": [
                    {
                      "__type": "DefList",
                      "__tag": 4033,
                      "children": [
                        {
                          "__type": "DefListItem",
                          "__tag": 4037,
                          "dt": {
                            "__type": "Paragraph",
                            "__tag": 4045,
                            "children": [
                              {
                                "__type": "Text",
                                "__tag": 4046,
                                "value": "x"
                              }
                            ]
                          },
                          "dd": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": "x"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "__type": "DefListItem",
                          "__tag": 4037,
                          "dt": {
                            "__type": "Paragraph",
                            "__tag": 4045,
                            "children": [
                              {
                                "__type": "Text",
                                "__tag": 4046,
                                "value": "fun"
                              }
                            ]
                          },
                          "dd": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": "fun"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "__type": "DefListItem",
                          "__tag": 4037,
                          "dt": {
                            "__type": "Paragraph",
                            "__tag": 4045,
                            "children": [
                              {
                                "__type": "Text",
                                "__tag": 4046,
                                "value": "success"
                              }
                            ]
                          },
                          "dd": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": "success"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "__type": "DefListItem",
                          "__tag": 4037,
                          "dt": {
                            "__type": "Paragraph",
                            "__tag": 4045,
                            "children": [
                              {
                                "__type": "Text",
                                "__tag": 4046,
                                "value": "slack"
                              }
                            ]
                          },
                          "dd": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": "slack"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "__type": "DefListItem",
                          "__tag": 4037,
                          "dt": {
                            "__type": "Paragraph",
                            "__tag": 4045,
                            "children": [
                              {
                                "__type": "Text",
                                "__tag": 4046,
                                "value": "con"
                              }
                            ]
                          },
                          "dd": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": "con"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "__type": "DefListItem",
                          "__tag": 4037,
                          "dt": {
                            "__type": "Paragraph",
                            "__tag": 4045,
                            "children": [
                              {
                                "__type": "Text",
                                "__tag": 4046,
                                "value": "phase"
                              }
                            ]
                          },
                          "dd": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": "phase"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "__type": "DefListItem",
                          "__tag": 4037,
                          "dt": {
                            "__type": "Paragraph",
                            "__tag": 4045,
                            "children": [
                              {
                                "__type": "Text",
                                "__tag": 4046,
                                "value": "status"
                              }
                            ]
                          },
                          "dd": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": "status"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "__type": "DefListItem",
                          "__tag": 4037,
                          "dt": {
                            "__type": "Paragraph",
                            "__tag": 4045,
                            "children": [
                              {
                                "__type": "Text",
                                "__tag": 4046,
                                "value": "nit"
                              }
                            ]
                          },
                          "dd": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": "nit"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "__type": "DefListItem",
                          "__tag": 4037,
                          "dt": {
                            "__type": "Paragraph",
                            "__tag": 4045,
                            "children": [
                              {
                                "__type": "Text",
                                "__tag": 4046,
                                "value": "message"
                              }
                            ]
                          },
                          "dd": [
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": "message"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "postsolve_args",
              "annotation": "tuple",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Data needed by _postsolve to convert the solution to the standard-form problem into the solution to the original problem."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "maxiter",
              "annotation": "int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The maximum number of iterations to perform before aborting the optimization."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "tol",
              "annotation": "float",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The tolerance which determines when a solution is \"close enough\" to zero in Phase 1 to be considered a basic feasible solution or close enough to positive to serve as an optimal solution."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "phase",
              "annotation": "int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The phase of the optimization being executed. In phase 1 a basic feasible solution is sought and the T has an additional row representing an alternate objective function."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "bland",
              "annotation": "bool",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If True, choose pivots using Bland's rule "
                    },
                    {
                      "__type": "FootnoteReference",
                      "__tag": 4066,
                      "label": "3"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". In problems which fail to converge due to cycling, using Bland's rule can provide convergence at the expense of a less optimal path about the simplex."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "nit0",
              "annotation": "int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The initial iteration number used to keep an accurate iteration total in a two-phase problem."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Minimize      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "c @ x",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Subject to      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "A @ x == b\n    x >= 0",
          "execution_status": null
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/scipy/optimize/_linprog_simplex.py",
  "item_line": 232,
  "item_type": "function",
  "aliases": [
    "scipy.optimize._linprog_simplex._solve_simplex"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "T",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "n",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "basis",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "callback",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "postsolve_args",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "maxiter",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "1000"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "tol",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "1e-09"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "phase",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "2"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "bland",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "False"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "nit0",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "0"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "_solve_simplex"
  },
  "references": null,
  "qa": "scipy.optimize._linprog_simplex:_solve_simplex",
  "arbitrary": [],
  "local_refs": [
    "T",
    "basis",
    "bland",
    "callback",
    "maxiter",
    "n",
    "nit",
    "nit0",
    "phase",
    "postsolve_args",
    "status",
    "tol"
  ]
}