{
  "id": "task_libraries:linear-programming/python",
  "path": "/exapedia/python-linear-programming-libraries",
  "template": {
    "id": "task_libraries",
    "version": 4
  },
  "title": "Python linear programming libraries",
  "answer": [
    {
      "t": "text",
      "text": "Python linear programming libraries model optimization problems as a linear objective with linear constraints and solve them for the best values. A modeling library builds the problem and hands it to a separate solver engine. These libraries let developers plan schedules, routes, and production mixes within fixed limits."
    }
  ],
  "breadcrumb": [
    {
      "label": "Tools"
    },
    {
      "label": "Python linear programming libraries"
    }
  ],
  "sections": [
    {
      "id": "libraries_popularity",
      "anchor": "popularity",
      "heading": "Popularity",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Monthly downloads",
            "Stars",
            "Last release",
            "License"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#scipy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F126"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F127"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F135"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F130"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F128"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#or-tools",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F145"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F146"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F152"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F149"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F147"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#highspy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F163"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F164"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F170"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F167"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F165"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#osqp",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F180"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F181"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F189"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F184"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F182"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pulp",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F200"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F201"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F207"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F204"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F202"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#clarabel",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F217"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F218"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F226"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F221"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F219"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#scs",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F237"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F238"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F246"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F241"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F239"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#cvxpy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F257"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F258"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F266"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F261"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F259"
                }
              ]
            ]
          ],
          "variant": "pop",
          "caption": [
            {
              "t": "text",
              "text": "Downloads: "
            },
            {
              "t": "text",
              "text": "PyPI"
            },
            {
              "t": "text",
              "text": ", last thirty days. Stars and releases: GitHub. Amber: no release in over a year."
            }
          ]
        }
      ],
      "note": [
        {
          "t": "link",
          "href": "#scipy",
          "label": [
            {
              "t": "text",
              "text": "SciPy"
            }
          ]
        },
        {
          "t": "text",
          "text": " has the most monthly downloads in this comparison, at "
        },
        {
          "t": "fact",
          "fact": "F127"
        },
        {
          "t": "text",
          "text": ", a count that covers all its scientific computing."
        }
      ]
    },
    {
      "id": "libraries_capabilities",
      "anchor": "capabilities",
      "heading": "Capabilities",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Integer variables",
            "Native cone constraints",
            "Named algebraic models"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#scipy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F126"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F136"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F137"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F138"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#or-tools",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F145"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F153"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F154"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F155"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#highspy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F163"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F171"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F172"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F173"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#osqp",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F180"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F190"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F191"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F192"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pulp",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F200"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F208"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F209"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F210"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#clarabel",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F217"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F227"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F228"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F229"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#scs",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F237"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F247"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F248"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F249"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#cvxpy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F257"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F267"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F268"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F269"
                }
              ]
            ]
          ],
          "variant": "cap"
        }
      ]
    },
    {
      "id": "libraries_entries",
      "anchor": "libraries",
      "heading": "Libraries",
      "blocks": [
        {
          "b": "entry",
          "anchor": "scipy",
          "name": [
            {
              "t": "fact",
              "fact": "F126"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/scipy/scipy"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/scipy"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/scipy/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F133"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F127"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F135"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F129"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F128"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/scipy/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F126"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F143"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F144"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/cvxpy/cvxpy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F143"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def solve_via_data(self, data, warm_start: bool, verbose: bool, solver_opts, solver_cache=None):\n    from scipy import optimize as opt\n\n    # Set default method which can be overridden by user inputs.\n    meth = \"highs\"\n\n    # Check if the problem is a MIP.\n    problem_is_a_mip = data[s.BOOL_IDX] or data[s.INT_IDX]\n\n    # Build variable bounds from BOUNDED_VARIABLES data\n    n = data[s.C].shape[0]\n    lb = data.get(s.LOWER_BOUNDS)\n    ub = data.get(s.UPPER_BOUNDS)\n\n    # Track variable integrality options. An entry of zero implies that\n    # the variable is continuous. An entry of one implies that the\n    # variable is either binary or an integer with bounds.\n    if problem_is_a_mip:\n        integrality = [0] * n\n\n        for index in data[s.BOOL_IDX] + data[s.INT_IDX]:\n            integrality[index] = 1\n\n        bounds = [(\n            lb[i] if lb is not None else None,\n            ub[i] if ub is not None else None,\n        ) for i in range(n)]\n\n        for index in data[s.BOOL_IDX]:\n            cur_lb, cur_ub = bounds[index]\n            new_lb = max(0, cur_lb) if cur_lb is not None else 0\n            new_ub = min(1, cur_ub) if cur_ub is not None else 1\n            bounds[index] = (new_lb, new_ub)\n    else:\n        integrality = None\n        if lb is not None or ub is not None:\n            bounds = [(\n                lb[i] if lb is not None else None,\n                ub[i] if ub is not None else None,\n            ) for i in range(n)]\n        else:\n            bounds = (None, None)\n\n    # Extract solver options which are not part of the options dictionary\n    if solver_opts:\n\n        # Raise error message if the parameters are not passed in\n        # a dictionary called 'scipy_options'.\n        if \"scipy_options\" not in solver_opts:\n            raise ValueError(\"All parameters for the SCIPY solver should \"\n                             \"be encased within a dictionary called \"\n                             \"scipy_options e.g. \\n\"\n                             \"prob.solve(solver='SCIPY', verbose=True,\"\n                             \" scipy_options={'method':'highs-ds', 'maxiter':10000})\")\n\n        if \"method\" in solver_opts[\"scipy_options\"]:\n            meth = solver_opts[\"scipy_options\"].pop(\"method\")\n\n        # Disable the 'bounds' parameter to avoid problems with\n        # canonicalised problems.\n        if \"bounds\" in solver_opts['scipy_options']:\n            raise ValueError(\"Please do not specify bounds through \"\n                             \"scipy_options. Please specify bounds \"\n                             \"through CVXPY.\")\n\n        # Check that the 'integrality' parameter isn't specified.\n        if \"integrality\" in solver_opts['scipy_options']:\n            raise ValueError(\"Please do not specify variable integrality through \"\n                             \"scipy_options. Please specify variable types \"\n                             \"through CVXPY.\")\n\n        # Check for SciPy method support (i.e., only 'highs' supports MIP models).\n        method_supports_mip = meth == 'highs'\n\n        if problem_is_a_mip and not method_supports_mip:\n            raise ValueError(\"Only the 'highs' SciPy method can solve MIP models.\")\n\n        # Not supported by HiGHS solvers:\n        # callback = solver_opts['scipy_options'].pop(\"callback\", None)\n        # x0 = solver_opts['scipy_options'].pop(\"x0\", None)\n    else:\n        # Instantiate an empty `scipy_options` entry.\n        solver_opts['scipy_options'] = {}\n\n    if problem_is_a_mip:\n        constraints = []\n        G = data[s.G]\n        if G is not None:\n            ineq = scipy.optimize.LinearConstraint(G, ub=data[s.H])\n            # ensure that index arrays are int32\n            ineq.A.indptr = ineq.A.indptr.astype(np.int32)\n            ineq.A.indices = ineq.A.indices.astype(np.int32)\n            constraints.append(ineq)\n        A = data[s.A]\n        if A is not None:\n            eq = scipy.optimize.LinearConstraint(A,data[s.B], data[s.B])\n            constraints.append(eq)\n        lb = [t[0] if t[0] is not None else -np.inf for t in bounds]\n        ub = [t[1] if t[1] is not None else np.inf for t in bounds]\n        bounds = scipy.optimize.Bounds(lb, ub)\n        solution = opt.milp(data[s.C],\n                            constraints=constraints,\n                            options=solver_opts['scipy_options'],\n                            integrality=integrality,\n                            bounds=bounds)\n    else:\n        solution = opt.linprog(data[s.C], A_ub=data[s.G], b_ub=data[s.H],\n                               A_eq=data[s.A], b_eq=data[s.B], method=meth,\n                               options=solver_opts['scipy_options'],\n                               bounds=bounds)\n\n    # Replace `scipy_options` method to avoid future warnings.\n    solver_opts[\"scipy_options\"][\"method\"] = meth\n\n    if verbose is True:\n        print(\"Solver terminated with message: \" + solution.message)\n\n    return solution",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/cvxpy/cvxpy/blob/0fc467a64a66f5a0f3b7cc721779dca5f1b7ce6f/cvxpy/reductions/solvers/conic_solvers/scipy_conif.py#L103-L220",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F142"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=scipy%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F126"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from scipy.optimize import linprog\n\nresult = linprog([-1.0], bounds=[(0.0, 1.0)], method='highs')\nprint(result.message)",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.linprog.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "scipy.optimize.linprog.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F131"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "or-tools",
          "name": [
            {
              "t": "fact",
              "fact": "F145"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/google/or-tools"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/ortools"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/ortools/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F12"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F146"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F152"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F148"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F147"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/ortools/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F145"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F13"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F14"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F15"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F16"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F17"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F18"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F19"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F20"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F161"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F162"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/guillermo-navas-palencia/optbinning",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F161"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def build_model(self, divergence, n_nonevent, n_event, trend_change):\n    # Parameters\n    [D, V, pvalue_violation_indices,\n     min_diff_violation_indices] = model_data(\n        divergence, n_nonevent, n_event, self.max_pvalue,\n        self.max_pvalue_policy, self.min_event_rate_diff)\n\n    n = len(n_nonevent)\n    n_records = n_nonevent + n_event\n\n    # Initialize solver\n    if self.mip_solver == \"bop\":\n        solver = pywraplp.Solver(\n            'BinningMIP', pywraplp.Solver.BOP_INTEGER_PROGRAMMING)\n    elif self.mip_solver == \"cbc\":\n        solver = pywraplp.Solver(\n            'BinningMIP', pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)\n\n    # Decision variables\n    x, y, t, d, u, bin_size_diff = self.decision_variables(solver, n)\n\n    # Objective function\n    if self.gamma:\n        total_records = int(n_records.sum())\n        regularization = self.gamma / total_records\n        pmax = solver.IntVar(0, total_records, \"pmax\")\n        pmin = solver.IntVar(0, total_records, \"pmin\")\n\n        solver.Maximize(solver.Sum([(V[i][i] * x[i, i]) +\n                        solver.Sum([(V[i][j] - V[i][j+1]) * x[i, j]\n                                    for j in range(i)])\n                                    for i in range(n)]) -\n                        regularization * (pmax - pmin))\n    else:\n        solver.Maximize(solver.Sum([(V[i][i] * x[i, i]) +\n                        solver.Sum([(V[i][j] - V[i][j+1]) * x[i, j]\n                                    for j in range(i)])\n                                    for i in range(n)]))\n\n    # Constraint: unique assignment\n    self.add_constraint_unique_assignment(solver, n, x)\n\n    # Constraint: continuity\n    self.add_constraint_continuity(solver, n, x)\n\n    # Constraint: min / max bins\n    self.add_constraint_min_max_bins(solver, n, x, d)\n\n    # Constraint: min / max bin size\n    self.add_constraint_min_max_bin_size(solver, n, x, u, n_records,\n                                         bin_size_diff)\n\n    # Constraint: min / max n_nonevent per bin\n    if (self.min_bin_n_nonevent is not None or\n            self.max_bin_n_nonevent is not None):\n        for i in range(n):\n            bin_ne_size = solver.Sum([n_nonevent[j] * x[i, j]\n                                      for j in range(i + 1)])\n\n            if self.min_bin_n_nonevent is not None:\n                solver.Add(bin_ne_size >= self.min_bin_n_nonevent*x[i, i])\n\n            if self.max_bin_n_nonevent is not None:\n                solver.Add(bin_ne_size <= self.max_bin_n_nonevent*x[i, i])\n\n    # Constraint: min / max n_event per bin\n    if (self.min_bin_n_event is not None or\n            self.max_bin_n_event is not None):\n        for i in range(n):\n            bin_e_size = solver.Sum([n_event[j] * x[i, j]\n                                     for j in range(i + 1)])\n\n            if self.min_bin_n_event is not None:\n                solver.Add(bin_e_size >= self.min_bin_n_event * x[i, i])\n\n            if self.max_bin_n_event is not None:\n                solver.Add(bin_e_size <= self.max_bin_n_event * x[i, i])\n\n    # Constraints: monotonicity\n    if self.monotonic_trend == \"ascending\":\n        self.add_constraint_monotonic_ascending(solver, n, D, x)\n\n    elif self.monotonic_trend == \"descending\":\n        self.add_constraint_monotonic_descending(solver, n, D, x)\n\n    elif self.monotonic_trend == \"concave\":\n        self.add_constraint_monotonic_concave(solver, n, D, x)\n\n    elif self.monotonic_trend == \"convex\":\n        self.add_constraint_monotonic_convex(solver, n, D, x)\n\n    elif self.monotonic_trend in (\"peak\", \"valley\"):\n        for i in range(n):\n            solver.Add(t >= i - n * (1 - y[i]))\n            solver.Add(t <= i + n * y[i])\n\n        if self.monotonic_trend == \"peak\":\n            self.add_constraint_monotonic_peak(solver, n, D, x, y)\n        else:\n            self.add_constraint_monotonic_valley(solver, n, D, x, y)\n\n    elif self.monotonic_trend == \"peak_heuristic\":\n        self.add_constraint_monotonic_peak_heuristic(\n            solver, n, D, x, trend_change)\n\n    elif self.monotonic_trend == \"valley_heuristic\":\n        self.add_constraint_monotonic_valley_heuristic(\n            solver, n, D, x, trend_change)\n\n    # Constraint: reduction of dominating bins\n    if self.gamma:\n        for i in range(n):\n            bin_size = solver.Sum([n_records[j] * x[i, j]\n                                   for j in range(i + 1)])\n\n            solver.Add(pmin <= total_records * (1 - x[i, i]) + bin_size)\n            solver.Add(pmax >= bin_size)\n        solver.Add(pmin <= pmax)\n\n    # Constraint: max-pvalue\n    self.add_constraint_violation(solver, x, pvalue_violation_indices)\n\n    # Constraint: min diff\n    self.add_constraint_violation(solver, x, min_diff_violation_indices)\n\n    # Constraint: fixed splits\n    self.add_constraint_fixed_splits(solver, n, x)\n\n    self.solver_ = solver\n    self._n = n\n    self._x = x",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/guillermo-navas-palencia/optbinning/blob/b5d8458454728a3a5be2bbde45ba5384663f1346/optbinning/binning/mip.py#L48-L178",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F160"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Projects%20using%20ortools%20to%20build%20linear%20or%20mixed-integer%20programs&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F145"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from ortools.linear_solver import pywraplp\n\nsolver = pywraplp.Solver.CreateSolver('GLOP')\nx = solver.NumVar(0, 1, 'x')\nsolver.Maximize(x)\nstatus = solver.Solve()\nprint(status)",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://developers.google.com/optimization/lp/lp_example",
                  "label": [
                    {
                      "t": "text",
                      "text": "linear_programming_example.py"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F150"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "highspy",
          "name": [
            {
              "t": "fact",
              "fact": "F163"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/ERGO-Code/HiGHS"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/highspy"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/highspy/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F38"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F164"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F170"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F166"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F165"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/highspy/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F163"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F39"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F40"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F41"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F42"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F43"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F44"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F178"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F179"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/cvxpy/cvxpy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F178"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def solve_via_data(\n    self, data, warm_start: bool, verbose: bool, solver_opts, solver_cache=None\n):\n    \"\"\"Returns the result of the call to the solver.\n\n    minimize          cx\n        subject to    A x <=  b\n\n    in HiGHS, the opt problem format is,\n\n    minimize          cx\n        subject to    lboundA <= A x <= uboundA\n\n    Parameters\n    ----------\n    data : dict\n        Data used by the solver.\n    warm_start : bool\n        Whether to warm_start HiGHS.\n    verbose : bool\n        Should the solver print output?\n    solver_opts : dict\n        Additional arguments for the solver.\n\n    Returns\n    -------\n    tuple\n        (status, optimal value, primal, equality dual, inequality dual)\n    \"\"\"\n    import highspy as hp\n\n    # setup problem data\n    inf = hp.Highs().inf\n    dims = dims_to_solver_dict(data[s.DIMS])\n\n    c = data[s.C]\n    # A = sp.vstack([data[s.A], data[s.F]]).tocsc()\n    A = data[s.A].tocsc()\n    data[\"Ax\"] = A\n\n    leq_start = dims[s.EQ_DIM]\n    leq_end = dims[s.EQ_DIM] + dims[s.LEQ_DIM]\n    uboundA = data[s.B]\n    data[\"u\"] = uboundA\n    lboundA = np.concatenate(\n        [data[s.B][:leq_start], -inf * np.ones(data[s.B][leq_start:leq_end].shape)]\n    )\n    data[\"l\"] = lboundA\n\n    # setup highs model\n    model = hp.HighsModel()\n    lp = model.lp_\n    lp.num_col_ = A.shape[1]\n    # assert data['n_var'] == A.shape[1]\n    lp.num_row_ = A.shape[0]\n    # assert data['n_eq'] + data['n_ineq'] == A.shape[0]\n\n    # offset already applied in invert()\n    lp.offset_ = 0\n    lp.col_cost_ = c\n    lp.row_lower_ = lboundA\n    lp.row_upper_ = uboundA\n\n    assert A.format == \"csc\"\n    lp.a_matrix_.format_ = hp.MatrixFormat.kColwise\n    lp.a_matrix_.start_ = A.indptr\n    lp.a_matrix_.index_ = A.indices\n    lp.a_matrix_.value_ = A.data\n\n    # Define Variable bounds\n    lb = data[s.LOWER_BOUNDS]\n    ub = data[s.UPPER_BOUNDS]\n    col_lower = np.full(lp.num_col_, -inf, dtype=c.dtype) if lb is None else lb.copy()\n    col_upper = np.full(lp.num_col_, inf, dtype=c.dtype) if ub is None else ub.copy()\n    # update col_lower and col_upper to account for boolean variables,\n    # also set integrality_ for boolean or integers variables\n    if data[s.BOOL_IDX] or data[s.INT_IDX]:\n        # note that integrality_ can only be assigned a list\n        integrality = [hp.HighsVarType.kContinuous] * lp.num_col_\n        if data[s.BOOL_IDX]:\n            for ind in data[s.BOOL_IDX]:\n                integrality[ind] = hp.HighsVarType.kInteger\n            bool_mask = np.array(data[s.BOOL_IDX], dtype=int)\n            col_lower[bool_mask] = np.maximum(col_lower[bool_mask], 0)\n            col_upper[bool_mask] = np.minimum(col_upper[bool_mask], 1)\n        for ind in data[s.INT_IDX]:\n            integrality[ind] = hp.HighsVarType.kInteger\n        lp.integrality_ = integrality\n    lp.col_lower_ = col_lower\n    lp.col_upper_ = col_upper\n\n    solver = hp.Highs()\n\n    # setup options\n    unpack_highs_options_inplace(solver_opts)\n    write_model_file = solver_opts.pop(\"write_model_file\", None)\n    solver.setOptionValue(\"log_to_console\", verbose)\n    for name, value in solver_opts.items():\n        # note that calling setOptionValue directly on the solver\n        # allows one to pass advanced options that aren't available\n        # on the HighOptions class (e.g., presolve_rule_off)\n        if solver.setOptionValue(name, value) == hp.HighsStatus.kError:\n            raise ValueError(\n                f\"HIGHS returned status kError for option (name, value): ({name}, {value})\"\n            )\n\n    if write_model_file:\n        # TODO: Names can be collected upstream more systematically\n        # (or in the parent class) to be used by all solvers.\n        set_column_names_from_variables(lp, data[s.PARAM_PROB].variables)\n\n    solver.passModel(model)\n\n    if write_model_file:\n        solver.writeModel(write_model_file)\n\n    if warm_start and solver_cache is not None and self.name() in solver_cache:\n        old_solver, old_data, old_result = solver_cache[self.name()]\n        old_status = self.STATUS_MAP.get(old_result[\"model_status\"], s.SOLVER_ERROR)\n        if old_status in s.SOLUTION_PRESENT:\n            solver.setSolution(old_result[\"solution\"])\n\n    # initialize and solve problem\n    try:\n        solver.run()\n        results = {\n            \"solution\": solver.getSolution(),\n            \"basis\": solver.getBasis(),\n            \"info\": solver.getInfo(),\n            \"model_status\": solver.getModelStatus().name,\n            \"run_time\": solver.getRunTime(),\n        }\n        if results[\"model_status\"] == \"kInfeasible\":\n            results[\"dual_ray\"] = solver.getDualRay()\n    except ValueError as e:\n        raise SolverError(e)\n\n    if solver_cache is not None:\n        solver_cache[self.name()] = (solver, data, results)\n\n    return results",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/cvxpy/cvxpy/blob/0fc467a64a66f5a0f3b7cc721779dca5f1b7ce6f/cvxpy/reductions/solvers/conic_solvers/highs_conif.py#L217-L357",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F177"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Projects%20using%20highspy%20to%20build%20linear%20or%20mixed-integer%20programs&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F163"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import highspy\n\nsolver = highspy.Highs()\nx = solver.addVariable(lb=0, ub=1, obj=-1)\nsolver.run()\nprint(solver.getModelStatus())",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://ergo-code.github.io/HiGHS/dev/interfaces/python/example-py/",
                  "label": [
                    {
                      "t": "text",
                      "text": "example-py.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F168"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "osqp",
          "name": [
            {
              "t": "fact",
              "fact": "F180"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/osqp/osqp-python"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/osqp"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/osqp/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F187"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F181"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F189"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F183"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F182"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/osqp/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F180"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F198"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F199"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/cvxpy/cvxpy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F198"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def solve_via_data(self, data, warm_start: bool, verbose: bool, solver_opts,\n                   solver_cache=None):\n    import osqp\n    is_pre_v1 = float(osqp.__version__.split('.')[0]) < 1\n\n    P = data[s.P]\n    q = data[s.Q]\n    A = sp.vstack([data[s.A], data[s.F]]).tocsc()\n    data['Ax'] = A\n    uA = np.concatenate((data[s.B], data[s.G]))\n    data['u'] = uA\n    lA = np.concatenate([data[s.B], -np.inf*np.ones(data[s.G].shape)])\n    data['l'] = lA\n\n    if P is not None:\n        P = sp.csc_matrix((P.data, P.indices, P.indptr), shape=P.shape)\n    if A is not None:\n        A = sp.csc_matrix((A.data, A.indices, A.indptr), shape=A.shape)\n\n    # Overwrite defaults eps_abs=eps_rel=1e-3, max_iter=4000\n    solver_opts['eps_abs'] = solver_opts.get('eps_abs', 1e-5)\n    solver_opts['eps_rel'] = solver_opts.get('eps_rel', 1e-5)\n    solver_opts['max_iter'] = solver_opts.get('max_iter', 10000)\n\n    # Use cached data\n    if warm_start and solver_cache is not None and self.name() in solver_cache:\n        solver, old_data, results = solver_cache[self.name()]\n        new_args = {}\n        for key in ['q', 'l', 'u']:\n            if any(data[key] != old_data[key]):\n                new_args[key] = data[key]\n        factorizing = False\n        if P.data.shape != old_data[s.P].data.shape or any(\n                P.data != old_data[s.P].data):\n            P_triu = sp.csc_array(sp.triu(P, format='csc'))\n            new_args['Px'] = P_triu.data\n            factorizing = True\n        if A.data.shape != old_data['Ax'].data.shape or any(\n                A.data != old_data['Ax'].data):\n            new_args['Ax'] = A.data\n            factorizing = True\n\n        if new_args:\n            solver.update(**new_args)\n        # Map OSQP statuses back to CVXPY statuses\n        status_map = self.STATUS_MAP_PRE_V1 if is_pre_v1 else self.STATUS_MAP\n        status = status_map.get(results.info.status_val, s.SOLVER_ERROR)\n        if status == s.OPTIMAL:\n            solver.warm_start(results.x, results.y)\n        # Polish if factorizing.\n        polish_param = 'polish' if is_pre_v1 else 'polishing'\n        solver_opts[polish_param] = solver_opts.get(polish_param, factorizing)\n        solver.update_settings(verbose=verbose, **solver_opts)\n    else:\n        # Initialize and solve problem\n        polish_param = 'polish' if is_pre_v1 else 'polishing'\n        solver_opts[polish_param] = solver_opts.get(polish_param, True)\n        solver = osqp.OSQP()\n        try:\n            solver.setup(P, q, A, lA, uA, verbose=verbose, **solver_opts)\n        except Exception as e:\n            raise SolverError(e)\n\n    results = solver.solve(raise_error=False)\n\n    if solver_cache is not None:\n        solver_cache[self.name()] = (solver, data, results)\n    return results",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/cvxpy/cvxpy/blob/0fc467a64a66f5a0f3b7cc721779dca5f1b7ce6f/cvxpy/reductions/solvers/qp_solvers/osqp_qpif.py#L93-L160",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F197"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=osqp%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F180"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import numpy as np\nfrom scipy import sparse\nimport osqp\n\nsolver = osqp.OSQP()\nsolver.setup(P=sparse.csc_matrix((1, 1)), q=np.array([-1.0]),\n             A=sparse.csc_matrix([[1.0]]), l=np.array([0.0]), u=np.array([1.0]))\nresult = solver.solve(raise_error=False)\nprint(result.info.status)",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://osqp.org/docs/interfaces/python.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "python.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F185"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "pulp",
          "name": [
            {
              "t": "fact",
              "fact": "F200"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/coin-or/pulp"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/pulp"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/pulp/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F62"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F201"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F207"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F203"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F202"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/pulp/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F200"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F63"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F64"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F65"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F66"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F67"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F68"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F69"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F70"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F215"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F216"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/snakemake/snakemake",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F215"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def __contains__(self, x: object) -> bool:\n        try:\n            import pulp\n\n            return pulp.getSolver(x).available()\n        except Exception:  # noqa: BLE001\n            return False",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/snakemake/snakemake/blob/6d007cf012b0d4dfb80d3a7a21c2cd39bec8f7c8/src/snakemake/scheduling/milp.py#L49-L55",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F214"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Projects%20using%20pulp%20to%20build%20linear%20or%20mixed-integer%20programs&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F200"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from pulp import LpProblem, LpMinimize\n\nproblem = LpProblem('first_model', LpMinimize)\nx = problem.add_variable('x', lowBound=0, upBound=1)\nproblem += -x\nstats = problem.solve()\nprint(stats.status_str)",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/coin-or/pulp/blob/956e63864a86659d52692b28d54fc7271a566c5b/README.rst",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.rst"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F205"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "clarabel",
          "name": [
            {
              "t": "fact",
              "fact": "F217"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/oxfordcontrol/Clarabel.rs"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/clarabel"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/clarabel/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F224"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F218"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F226"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F220"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F219"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/clarabel/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F217"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F235"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F236"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/cvxpy/cvxpy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F235"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def solve_via_data(self, data, warm_start: bool, verbose: bool, solver_opts, solver_cache=None):\n    \"\"\"Returns the result of the call to the solver.\n\n    Parameters\n    ----------\n    data : dict\n        Data generated via an apply call.\n    warm_start : Bool\n        Whether to warm_start Clarabel.\n    verbose : Bool\n        Control the verbosity.\n    solver_opts : dict\n        Clarabel-specific solver options.\n\n    Returns\n    -------\n    The result returned by a call to clarabel.solve().\n    \"\"\"\n    import clarabel\n\n    A = data[s.A]\n    b = data[s.B]\n    q = data[s.C]\n\n    if s.P in data:\n        P = data[s.P]\n    else:\n        nvars = q.size\n        P = sp.csc_array((nvars, nvars))\n\n    P = sp.triu(P).tocsc()\n\n    cones = dims_to_solver_cones(data[ConicSolver.DIMS])\n\n    def new_solver():\n\n        _settings = self.parse_solver_opts(verbose, solver_opts)\n        _solver = clarabel.DefaultSolver(P, q, A, b, cones, _settings)\n        return _solver\n\n    def updated_solver():\n\n        if (not warm_start) or (solver_cache is None) or (self.name() not in solver_cache):\n            return None\n\n        _solver = solver_cache[self.name()]\n\n        if not hasattr(_solver, \"update\"):\n            return None\n        elif not _solver.is_data_update_allowed():\n            # disallow when presolve or chordal decomposition is used\n            return None\n        else:\n            # current internal settings, to be updated if needed\n            oldsettings = _solver.get_settings()\n            newsettings = self.parse_solver_opts(verbose, solver_opts, oldsettings)\n\n            # this overwrites all data in the solver but will not\n            # reallocate internal memory.  Could be faster if it\n            # were known which terms (or partial terms) have changed.\n            try:\n                _solver.update(P=P, q=q, A=A, b=b, settings=newsettings)\n                return _solver\n            except Exception:\n                # If sparsity pattern or dimensions changed, update() fails.\n                # Return None to trigger a full new_solver() re-initialization.\n                return None\n\n    # Try to get cached data\n    solver = updated_solver()\n\n    if solver is None:\n        solver = new_solver()\n\n    results = solver.solve()\n\n    if solver_cache is not None:\n        solver_cache[self.name()] = solver\n\n    return results",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/cvxpy/cvxpy/blob/0fc467a64a66f5a0f3b7cc721779dca5f1b7ce6f/cvxpy/reductions/solvers/conic_solvers/clarabel_conif.py#L194-L273",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F234"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=clarabel%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F217"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import clarabel\nimport numpy as np\nfrom scipy import sparse\n\nsolver = clarabel.DefaultSolver(\n    sparse.csc_matrix((1, 1)), np.array([-1.0]),\n    sparse.csc_matrix([[1.0], [-1.0]]), np.array([1.0, 0.0]),\n    [clarabel.NonnegativeConeT(2)], clarabel.DefaultSettings())\nsolution = solver.solve()\nprint(solution.status)",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://clarabel.org/stable/python/getting_started_py/",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F222"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "scs",
          "name": [
            {
              "t": "fact",
              "fact": "F237"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/bodono/scs-python"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/scs"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/scs/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F244"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F238"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F246"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F240"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F239"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/scs/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F237"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F255"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F256"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/cvxpy/cvxpy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F255"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def solve_via_data(self, data, warm_start: bool, verbose: bool, solver_opts, solver_cache=None):\n    \"\"\"Returns the result of the call to the solver.\n\n    Parameters\n    ----------\n    data : dict\n        Data generated via an apply call.\n    warm_start : Bool\n        Whether to warm_start SCS.\n    verbose : Bool\n        Control the verbosity.\n    solver_opts : dict\n        SCS-specific solver options.\n\n    Returns\n    -------\n    The result returned by a call to scs.solve().\n    \"\"\"\n    import scs\n    args = {\"A\": data[s.A], \"b\": data[s.B], \"c\": data[s.C]}\n    if s.P in data:\n        args[\"P\"] = data[s.P]\n    if warm_start and solver_cache is not None and \\\n            self.name() in solver_cache:\n        args[\"x\"] = solver_cache[self.name()][\"x\"]\n        args[\"y\"] = solver_cache[self.name()][\"y\"]\n        args[\"s\"] = solver_cache[self.name()][\"s\"]\n    cones = dims_to_solver_dict(data[ConicSolver.DIMS])\n\n    def solve(_solver_opts):\n        _results = scs.solve(args, cones, verbose=verbose, **_solver_opts)\n        _status = self.STATUS_MAP[_results[\"info\"][\"status_val\"]]\n        return _results, _status\n\n    solver_opts = SCS.parse_solver_options(solver_opts)\n    results, status = solve(solver_opts)\n    if solver_cache is not None and status == s.OPTIMAL:\n        solver_cache[self.name()] = results\n    return results",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/cvxpy/cvxpy/blob/0fc467a64a66f5a0f3b7cc721779dca5f1b7ce6f/cvxpy/reductions/solvers/conic_solvers/scs_conif.py#L200-L238",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F254"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=scs%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F237"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import numpy as np\nfrom scipy import sparse\nimport scs\n\ndata = {'A': sparse.csc_matrix([[1.0], [-1.0]]),\n        'b': np.array([1.0, 0.0]), 'c': np.array([-1.0])}\nsolver = scs.SCS(data, {'l': 2})\nresult = solver.solve()\nprint(result['info']['status'])",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://pypi.org/pypi/scs/3.3.2/json#info.description",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F242"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "cvxpy",
          "name": [
            {
              "t": "fact",
              "fact": "F257"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/cvxpy/cvxpy"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/cvxpy"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/cvxpy/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F264"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F258"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F266"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F260"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F259"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/cvxpy/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F257"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F274"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F275"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/PyPortfolio/PyPortfolioOpt",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F274"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def _solve_cvxpy_opt_problem(self):\n    \"\"\"\n    Helper method to solve the cvxpy problem and check output,\n    once objectives and constraints have been defined\n\n    Raises\n    ------\n    exceptions.OptimizationError\n        if problem is not solvable by cvxpy\n    \"\"\"\n    try:\n        if self._opt is None:\n            self._opt = cp.Problem(cp.Minimize(self._objective), self._constraints)\n            self._initial_objective = self._objective.id\n            self._initial_constraint_ids = {const.id for const in self._constraints}\n        else:\n            if not self._objective.id == self._initial_objective:\n                raise InstantiationError(\n                    \"The objective function was changed after the initial optimization. \"\n                    \"Please create a new instance instead.\"\n                )\n\n            constr_ids = {const.id for const in self._constraints}\n            if not constr_ids == self._initial_constraint_ids:\n                raise InstantiationError(\n                    \"The constraints were changed after the initial optimization. \"\n                    \"Please create a new instance instead.\"\n                )\n        self._opt.solve(\n            solver=self._solver, verbose=self._verbose, **self._solver_options\n        )\n\n    except (TypeError, cp.DCPError) as e:\n        raise OptimizationError from e\n\n    if self._opt.status not in {\"optimal\", \"optimal_inaccurate\"}:\n        raise OptimizationError(\"Solver status: {}\".format(self._opt.status))\n    self.weights = self._w.value.round(16) + 0.0  # +0.0 removes signed zero\n    return self._make_output_weights()",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/PyPortfolio/PyPortfolioOpt/blob/a6638d2e06dae6f444fd022cfd4b3c528902a85b/pypfopt/base/_base_optimizer.py#L307-L345",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F273"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=cvxpy%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F257"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import cvxpy as cp\n\nx = cp.Variable()\nproblem = cp.Problem(cp.Minimize(-x), [x >= 0, x <= 1])\nproblem.solve()\nprint(problem.status)",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://www.cvxpy.org/api_reference/cvxpy.problems.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "cvxpy.problems.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F262"
            }
          ]
        }
      ]
    }
  ],
  "questions": [
    {
      "q": "Which Python linear programming library should I use?",
      "a": [
        {
          "t": "link",
          "href": "#pulp",
          "label": [
            {
              "t": "text",
              "text": "PuLP"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits linear and mixed-integer models that can run on several solvers. "
        },
        {
          "t": "link",
          "href": "#or-tools",
          "label": [
            {
              "t": "text",
              "text": "OR-Tools"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits models built from named variables through its MPSolver interface. "
        },
        {
          "t": "link",
          "href": "#scipy",
          "label": [
            {
              "t": "text",
              "text": "SciPy"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits problems already expressed as arrays."
        }
      ]
    },
    {
      "q": "What is CVXPY?",
      "a": [
        {
          "t": "link",
          "href": "#cvxpy",
          "label": [
            {
              "t": "text",
              "text": "CVXPY"
            }
          ]
        },
        {
          "t": "text",
          "text": " is a modeling language for convex optimization problems. It checks a problem against disciplined convex programming rules and dispatches it to a compatible installed solver."
        }
      ]
    },
    {
      "q": "What is PuLP?",
      "a": [
        {
          "t": "link",
          "href": "#pulp",
          "label": [
            {
              "t": "text",
              "text": "PuLP"
            }
          ]
        },
        {
          "t": "text",
          "text": " is a linear programming modeler that writes MPS or LP files and calls solvers such as GLPK, CBC, CPLEX, and Gurobi."
        }
      ]
    },
    {
      "q": "How do I solve a linear program with SciPy?",
      "a": [
        {
          "t": "link",
          "href": "#scipy",
          "label": [
            {
              "t": "text",
              "text": "SciPy"
            }
          ]
        },
        {
          "t": "text",
          "text": " exposes linear and mixed-integer programming through functions that take the objective and constraints as arrays."
        }
      ]
    }
  ],
  "facts": {
    "F1": {
      "label": "Library name, ortools",
      "display": "OR-Tools",
      "asOf": "2026-11-17"
    },
    "F2": {
      "label": "Monthly downloads, ortools",
      "display": "7.8M",
      "asOf": "2026-11-17"
    },
    "F3": {
      "label": "License, ortools",
      "display": "Apache-2.0",
      "asOf": "2026-11-17"
    },
    "F4": {
      "label": "Package release, ortools",
      "display": "9.15.6755, Jan 2026",
      "asOf": "2026-01-14"
    },
    "F5": {
      "label": "Package release date, ortools",
      "display": "Jan 2026",
      "asOf": "2026-01-14"
    },
    "F6": {
      "label": "Repository stars, ortools",
      "display": "14.4K",
      "asOf": "2026-11-17"
    },
    "F7": {
      "label": "Integer variables, ortools",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F8": {
      "label": "Solution hints, ortools",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F9": {
      "label": "Dual values, ortools",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F10": {
      "label": "Named constraints, ortools",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F11": {
      "label": "Install, ortools",
      "display": "pip install ortools",
      "asOf": "2026-11-17"
    },
    "F12": {
      "label": "What it does, ortools",
      "display": "Builds and solves linear models through the MPSolver interface.",
      "asOf": "2026-11-17"
    },
    "F13": {
      "label": "strengths lead, ortools",
      "display": "Builds linear models with GLOP",
      "asOf": "2026-11-17"
    },
    "F14": {
      "label": "strengths, ortools",
      "display": "Use GLOP with numeric variables and linear constraints.",
      "asOf": "2026-11-17"
    },
    "F15": {
      "label": "strengths lead, ortools",
      "display": "Accepts candidate solutions",
      "asOf": "2026-11-17"
    },
    "F16": {
      "label": "strengths, ortools",
      "display": "Pass an assignment through SetHint before solving.",
      "asOf": "2026-11-17"
    },
    "F17": {
      "label": "limitations lead, ortools",
      "display": "Hints can be ignored",
      "asOf": "2026-11-17"
    },
    "F18": {
      "label": "limitations, ortools",
      "display": "Solvers do not guarantee using a supplied hint.",
      "asOf": "2026-11-17"
    },
    "F19": {
      "label": "limitations lead, ortools",
      "display": "Duals require continuous problems",
      "asOf": "2026-11-17"
    },
    "F20": {
      "label": "limitations, ortools",
      "display": "Read constraint dual values only for continuous models.",
      "asOf": "2026-11-17"
    },
    "F21": {
      "label": "Quickstart, ortools",
      "display": "#!/usr/bin/env python3\n# Copyright 2010-2025 Google LLC\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Linear optimization example.\"\"\"\n# [START program]\n# [START import]\nfrom ortools.linear_solver import pywraplp\n\n# [END import]\n\n\ndef LinearProgrammingExample():\n    \"\"\"Linear programming sample.\"\"\"\n    # Instantiate a Glop solver, naming it LinearExample.\n    # [START solver]\n    solver = pywraplp.Solver.CreateSolver(\"GLOP\")\n    if not solver:\n        return\n    # [END solver]\n\n    # Create the two variables and let them take on any non-negative value.\n    # [START variables]\n    x = solver.NumVar(0, solver.infinity(), \"x\")\n    y = solver.NumVar(0, solver.infinity(), \"y\")\n\n    print(\"Number of variables =\", solver.NumVariables())\n    # [END variables]\n\n    # [START constraints]\n    # Constraint 0: x + 2y <= 14.\n    solver.Add(x + 2 * y <= 14.0)\n\n    # Constraint 1: 3x - y >= 0.\n    solver.Add(3 * x - y >= 0.0)\n\n    # Constraint 2: x - y <= 2.\n    solver.Add(x - y <= 2.0)\n\n    print(\"Number of constraints =\", solver.NumConstraints())\n    # [END constraints]\n\n    # [START objective]\n    # Objective function: 3x + 4y.\n    solver.Maximize(3 * x + 4 * y)\n    # [END objective]\n\n    # Solve the system.\n    # [START solve]\n    print(f\"Solving with {solver.SolverVersion()}\")\n    status = solver.Solve()\n    # [END solve]\n\n    # [START print_solution]\n    if status == pywraplp.Solver.OPTIMAL:\n        print(\"Solution:\")\n        print(f\"Objective value = {solver.Objective().Value():0.1f}\")\n        print(f\"x = {x.solution_value():0.1f}\")\n        print(f\"y = {y.solution_value():0.1f}\")\n    else:\n        print(\"The problem does not have an optimal solution.\")\n    # [END print_solution]\n\n    # [START advanced]\n    print(\"\\nAdvanced usage:\")\n    print(f\"Problem solved in {solver.wall_time():d} milliseconds\")\n    print(f\"Problem solved in {solver.iterations():d} iterations\")\n    # [END advanced]\n\n\nLinearProgrammingExample()\n# [END program]\n",
      "asOf": "2026-11-17"
    },
    "F22": {
      "label": "Project function, ortools",
      "display": "def build_model(self, divergence, n_nonevent, n_event, trend_change):\n    # Parameters\n    [D, V, pvalue_violation_indices,\n     min_diff_violation_indices] = model_data(\n        divergence, n_nonevent, n_event, self.max_pvalue,\n        self.max_pvalue_policy, self.min_event_rate_diff)\n\n    n = len(n_nonevent)\n    n_records = n_nonevent + n_event\n\n    # Initialize solver\n    if self.mip_solver == \"bop\":\n        solver = pywraplp.Solver(\n            'BinningMIP', pywraplp.Solver.BOP_INTEGER_PROGRAMMING)\n    elif self.mip_solver == \"cbc\":\n        solver = pywraplp.Solver(\n            'BinningMIP', pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)\n\n    # Decision variables\n    x, y, t, d, u, bin_size_diff = self.decision_variables(solver, n)\n\n    # Objective function\n    if self.gamma:\n        total_records = int(n_records.sum())\n        regularization = self.gamma / total_records\n        pmax = solver.IntVar(0, total_records, \"pmax\")\n        pmin = solver.IntVar(0, total_records, \"pmin\")\n\n        solver.Maximize(solver.Sum([(V[i][i] * x[i, i]) +\n                        solver.Sum([(V[i][j] - V[i][j+1]) * x[i, j]\n                                    for j in range(i)])\n                                    for i in range(n)]) -\n                        regularization * (pmax - pmin))\n    else:\n        solver.Maximize(solver.Sum([(V[i][i] * x[i, i]) +\n                        solver.Sum([(V[i][j] - V[i][j+1]) * x[i, j]\n                                    for j in range(i)])\n                                    for i in range(n)]))\n\n    # Constraint: unique assignment\n    self.add_constraint_unique_assignment(solver, n, x)\n\n    # Constraint: continuity\n    self.add_constraint_continuity(solver, n, x)\n\n    # Constraint: min / max bins\n    self.add_constraint_min_max_bins(solver, n, x, d)\n\n    # Constraint: min / max bin size\n    self.add_constraint_min_max_bin_size(solver, n, x, u, n_records,\n                                         bin_size_diff)\n\n    # Constraint: min / max n_nonevent per bin\n    if (self.min_bin_n_nonevent is not None or\n            self.max_bin_n_nonevent is not None):\n        for i in range(n):\n            bin_ne_size = solver.Sum([n_nonevent[j] * x[i, j]\n                                      for j in range(i + 1)])\n\n            if self.min_bin_n_nonevent is not None:\n                solver.Add(bin_ne_size >= self.min_bin_n_nonevent*x[i, i])\n\n            if self.max_bin_n_nonevent is not None:\n                solver.Add(bin_ne_size <= self.max_bin_n_nonevent*x[i, i])\n\n    # Constraint: min / max n_event per bin\n    if (self.min_bin_n_event is not None or\n            self.max_bin_n_event is not None):\n        for i in range(n):\n            bin_e_size = solver.Sum([n_event[j] * x[i, j]\n                                     for j in range(i + 1)])\n\n            if self.min_bin_n_event is not None:\n                solver.Add(bin_e_size >= self.min_bin_n_event * x[i, i])\n\n            if self.max_bin_n_event is not None:\n                solver.Add(bin_e_size <= self.max_bin_n_event * x[i, i])\n\n    # Constraints: monotonicity\n    if self.monotonic_trend == \"ascending\":\n        self.add_constraint_monotonic_ascending(solver, n, D, x)\n\n    elif self.monotonic_trend == \"descending\":\n        self.add_constraint_monotonic_descending(solver, n, D, x)\n\n    elif self.monotonic_trend == \"concave\":\n        self.add_constraint_monotonic_concave(solver, n, D, x)\n\n    elif self.monotonic_trend == \"convex\":\n        self.add_constraint_monotonic_convex(solver, n, D, x)\n\n    elif self.monotonic_trend in (\"peak\", \"valley\"):\n        for i in range(n):\n            solver.Add(t >= i - n * (1 - y[i]))\n            solver.Add(t <= i + n * y[i])\n\n        if self.monotonic_trend == \"peak\":\n            self.add_constraint_monotonic_peak(solver, n, D, x, y)\n        else:\n            self.add_constraint_monotonic_valley(solver, n, D, x, y)\n\n    elif self.monotonic_trend == \"peak_heuristic\":\n        self.add_constraint_monotonic_peak_heuristic(\n            solver, n, D, x, trend_change)\n\n    elif self.monotonic_trend == \"valley_heuristic\":\n        self.add_constraint_monotonic_valley_heuristic(\n            solver, n, D, x, trend_change)\n\n    # Constraint: reduction of dominating bins\n    if self.gamma:\n        for i in range(n):\n            bin_size = solver.Sum([n_records[j] * x[i, j]\n                                   for j in range(i + 1)])\n\n            solver.Add(pmin <= total_records * (1 - x[i, i]) + bin_size)\n            solver.Add(pmax >= bin_size)\n        solver.Add(pmin <= pmax)\n\n    # Constraint: max-pvalue\n    self.add_constraint_violation(solver, x, pvalue_violation_indices)\n\n    # Constraint: min diff\n    self.add_constraint_violation(solver, x, min_diff_violation_indices)\n\n    # Constraint: fixed splits\n    self.add_constraint_fixed_splits(solver, n, x)\n\n    self.solver_ = solver\n    self._n = n\n    self._x = x\n",
      "asOf": "2026-11-17"
    },
    "F23": {
      "label": "Project function reference, ortools",
      "display": "mip.py · build_model()",
      "asOf": "2026-11-17"
    },
    "F24": {
      "label": "Project repository, ortools",
      "display": "guillermo-navas-palencia/optbinning",
      "asOf": "2026-11-17"
    },
    "F25": {
      "label": "Project stars, guillermo-navas-palencia/optbinning",
      "display": "539",
      "asOf": "2026-11-17"
    },
    "F26": {
      "label": "Project push date, guillermo-navas-palencia/optbinning",
      "display": "Nov 2026",
      "asOf": "2026-11-16"
    },
    "F27": {
      "label": "Library name, highspy",
      "display": "highspy",
      "asOf": "2026-11-17"
    },
    "F28": {
      "label": "Monthly downloads, highspy",
      "display": "6.7M",
      "asOf": "2026-11-17"
    },
    "F29": {
      "label": "License, highspy",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F30": {
      "label": "Package release, highspy",
      "display": "1.16.0, Nov 2026",
      "asOf": "2026-11-11"
    },
    "F31": {
      "label": "Package release date, highspy",
      "display": "Nov 2026",
      "asOf": "2026-11-11"
    },
    "F32": {
      "label": "Repository stars, highspy",
      "display": "1.9K",
      "asOf": "2026-11-17"
    },
    "F33": {
      "label": "Integer variables, highspy",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F34": {
      "label": "Solution hints, highspy",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F35": {
      "label": "Dual values, highspy",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F36": {
      "label": "Named constraints, highspy",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F37": {
      "label": "Install, highspy",
      "display": "pip install highspy",
      "asOf": "2026-11-17"
    },
    "F38": {
      "label": "What it does, highspy",
      "display": "Exposes HiGHS model building and solver operations to Python.",
      "asOf": "2026-11-17"
    },
    "F39": {
      "label": "strengths lead, highspy",
      "display": "Builds models through Python expressions",
      "asOf": "2026-11-17"
    },
    "F40": {
      "label": "strengths, highspy",
      "display": "Create variables and constraints with addVariable and addConstr.",
      "asOf": "2026-11-17"
    },
    "F41": {
      "label": "strengths lead, highspy",
      "display": "Exposes constraint dual values",
      "asOf": "2026-11-17"
    },
    "F42": {
      "label": "strengths, highspy",
      "display": "Read the dual value of a selected constraint after solving.",
      "asOf": "2026-11-17"
    },
    "F43": {
      "label": "limitations lead, highspy",
      "display": "HiPO needs an extra package",
      "asOf": "2026-11-17"
    },
    "F44": {
      "label": "limitations, highspy",
      "display": "Install highspy-extras to use HiPO through Python.",
      "asOf": "2026-11-17"
    },
    "F45": {
      "label": "Quickstart, highspy",
      "display": "# model and solve the LP\n#\n# maximize 10 x1 + 25x2\n# s. t.       x1 +  2x2 <=  80\n#             x1 +  4x2 <= 120\n#             x1 >= 0; x2 >= 0\nimport highspy\n\nh = highspy.Highs()\n\nx1 = h.addVariable()\nx2 = h.addVariable()\n\nh.addConstr(x1 + 2*x2 <=  80)\nh.addConstr(x1 + 4*x2 <= 120)\n\nh.maximize(10*x1 + 25*x2)\n\nprint(\"x1 = \", h.val(x1))\nprint(\"x2 = \", h.val(x2))\n",
      "asOf": "2026-11-17"
    },
    "F46": {
      "label": "Project function, highspy",
      "display": "def solve_via_data(\n    self, data, warm_start: bool, verbose: bool, solver_opts, solver_cache=None\n):\n    \"\"\"Returns the result of the call to the solver.\n\n    minimize          cx\n        subject to    A x <=  b\n\n    in HiGHS, the opt problem format is,\n\n    minimize          cx\n        subject to    lboundA <= A x <= uboundA\n\n    Parameters\n    ----------\n    data : dict\n        Data used by the solver.\n    warm_start : bool\n        Whether to warm_start HiGHS.\n    verbose : bool\n        Should the solver print output?\n    solver_opts : dict\n        Additional arguments for the solver.\n\n    Returns\n    -------\n    tuple\n        (status, optimal value, primal, equality dual, inequality dual)\n    \"\"\"\n    import highspy as hp\n\n    # setup problem data\n    inf = hp.Highs().inf\n    dims = dims_to_solver_dict(data[s.DIMS])\n\n    c = data[s.C]\n    # A = sp.vstack([data[s.A], data[s.F]]).tocsc()\n    A = data[s.A].tocsc()\n    data[\"Ax\"] = A\n\n    leq_start = dims[s.EQ_DIM]\n    leq_end = dims[s.EQ_DIM] + dims[s.LEQ_DIM]\n    uboundA = data[s.B]\n    data[\"u\"] = uboundA\n    lboundA = np.concatenate(\n        [data[s.B][:leq_start], -inf * np.ones(data[s.B][leq_start:leq_end].shape)]\n    )\n    data[\"l\"] = lboundA\n\n    # setup highs model\n    model = hp.HighsModel()\n    lp = model.lp_\n    lp.num_col_ = A.shape[1]\n    # assert data['n_var'] == A.shape[1]\n    lp.num_row_ = A.shape[0]\n    # assert data['n_eq'] + data['n_ineq'] == A.shape[0]\n\n    # offset already applied in invert()\n    lp.offset_ = 0\n    lp.col_cost_ = c\n    lp.row_lower_ = lboundA\n    lp.row_upper_ = uboundA\n\n    assert A.format == \"csc\"\n    lp.a_matrix_.format_ = hp.MatrixFormat.kColwise\n    lp.a_matrix_.start_ = A.indptr\n    lp.a_matrix_.index_ = A.indices\n    lp.a_matrix_.value_ = A.data\n\n    # Define Variable bounds\n    lb = data[s.LOWER_BOUNDS]\n    ub = data[s.UPPER_BOUNDS]\n    col_lower = np.full(lp.num_col_, -inf, dtype=c.dtype) if lb is None else lb.copy()\n    col_upper = np.full(lp.num_col_, inf, dtype=c.dtype) if ub is None else ub.copy()\n    # update col_lower and col_upper to account for boolean variables,\n    # also set integrality_ for boolean or integers variables\n    if data[s.BOOL_IDX] or data[s.INT_IDX]:\n        # note that integrality_ can only be assigned a list\n        integrality = [hp.HighsVarType.kContinuous] * lp.num_col_\n        if data[s.BOOL_IDX]:\n            for ind in data[s.BOOL_IDX]:\n                integrality[ind] = hp.HighsVarType.kInteger\n            bool_mask = np.array(data[s.BOOL_IDX], dtype=int)\n            col_lower[bool_mask] = np.maximum(col_lower[bool_mask], 0)\n            col_upper[bool_mask] = np.minimum(col_upper[bool_mask], 1)\n        for ind in data[s.INT_IDX]:\n            integrality[ind] = hp.HighsVarType.kInteger\n        lp.integrality_ = integrality\n    lp.col_lower_ = col_lower\n    lp.col_upper_ = col_upper\n\n    solver = hp.Highs()\n\n    # setup options\n    unpack_highs_options_inplace(solver_opts)\n    write_model_file = solver_opts.pop(\"write_model_file\", None)\n    solver.setOptionValue(\"log_to_console\", verbose)\n    for name, value in solver_opts.items():\n        # note that calling setOptionValue directly on the solver\n        # allows one to pass advanced options that aren't available\n        # on the HighOptions class (e.g., presolve_rule_off)\n        if solver.setOptionValue(name, value) == hp.HighsStatus.kError:\n            raise ValueError(\n                f\"HIGHS returned status kError for option (name, value): ({name}, {value})\"\n            )\n\n    if write_model_file:\n        # TODO: Names can be collected upstream more systematically\n        # (or in the parent class) to be used by all solvers.\n        set_column_names_from_variables(lp, data[s.PARAM_PROB].variables)\n\n    solver.passModel(model)\n\n    if write_model_file:\n        solver.writeModel(write_model_file)\n\n    if warm_start and solver_cache is not None and self.name() in solver_cache:\n        old_solver, old_data, old_result = solver_cache[self.name()]\n        old_status = self.STATUS_MAP.get(old_result[\"model_status\"], s.SOLVER_ERROR)\n        if old_status in s.SOLUTION_PRESENT:\n            solver.setSolution(old_result[\"solution\"])\n\n    # initialize and solve problem\n    try:\n        solver.run()\n        results = {\n            \"solution\": solver.getSolution(),\n            \"basis\": solver.getBasis(),\n            \"info\": solver.getInfo(),\n            \"model_status\": solver.getModelStatus().name,\n            \"run_time\": solver.getRunTime(),\n        }\n        if results[\"model_status\"] == \"kInfeasible\":\n            results[\"dual_ray\"] = solver.getDualRay()\n    except ValueError as e:\n        raise SolverError(e)\n\n    if solver_cache is not None:\n        solver_cache[self.name()] = (solver, data, results)\n\n    return results\n",
      "asOf": "2026-11-17"
    },
    "F47": {
      "label": "Project function reference, highspy",
      "display": "highs_conif.py · solve_via_data()",
      "asOf": "2026-11-17"
    },
    "F48": {
      "label": "Project repository, highspy",
      "display": "cvxpy/cvxpy",
      "asOf": "2026-11-17"
    },
    "F49": {
      "label": "Project stars, cvxpy/cvxpy",
      "display": "6.4K",
      "asOf": "2026-11-17"
    },
    "F50": {
      "label": "Project push date, cvxpy/cvxpy",
      "display": "Nov 2026",
      "asOf": "2026-11-16"
    },
    "F51": {
      "label": "Library name, pulp",
      "display": "PuLP",
      "asOf": "2026-11-17"
    },
    "F52": {
      "label": "Monthly downloads, pulp",
      "display": "6.1M",
      "asOf": "2026-11-17"
    },
    "F53": {
      "label": "License, pulp",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F54": {
      "label": "Package release, pulp",
      "display": "4.2.0, Oct 2026",
      "asOf": "2026-10-22"
    },
    "F55": {
      "label": "Package release date, pulp",
      "display": "Oct 2026",
      "asOf": "2026-10-22"
    },
    "F56": {
      "label": "Repository stars, pulp",
      "display": "2.5K",
      "asOf": "2026-11-17"
    },
    "F57": {
      "label": "Integer variables, pulp",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F58": {
      "label": "Solution hints, pulp",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F59": {
      "label": "Dual values, pulp",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F60": {
      "label": "Named constraints, pulp",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F61": {
      "label": "Install, pulp",
      "display": "python -m pip install 'pulp[cbc]'",
      "asOf": "2026-11-17"
    },
    "F62": {
      "label": "What it does, pulp",
      "display": "Models linear and mixed-integer problems for separate solver backends.",
      "asOf": "2026-11-17"
    },
    "F63": {
      "label": "strengths lead, pulp",
      "display": "Separates modeling from solver choice",
      "asOf": "2026-11-17"
    },
    "F64": {
      "label": "strengths, pulp",
      "display": "Build a model and select an available solver backend.",
      "asOf": "2026-11-17"
    },
    "F65": {
      "label": "strengths lead, pulp",
      "display": "Exports problems to JSON",
      "asOf": "2026-11-17"
    },
    "F66": {
      "label": "strengths, pulp",
      "display": "Serialize the model with toJson for later loading.",
      "asOf": "2026-11-17"
    },
    "F67": {
      "label": "limitations lead, pulp",
      "display": "CBC needs a separate installation",
      "asOf": "2026-11-17"
    },
    "F68": {
      "label": "limitations, pulp",
      "display": "Install the CBC extra or supply another solver before solving.",
      "asOf": "2026-11-17"
    },
    "F69": {
      "label": "limitations lead, pulp",
      "display": "Variables now belong to problems",
      "asOf": "2026-11-17"
    },
    "F70": {
      "label": "limitations, pulp",
      "display": "Create variables through prob.add_variable before adding expressions.",
      "asOf": "2026-11-17"
    },
    "F71": {
      "label": "Quickstart, pulp",
      "display": "from pulp import *\nprob = LpProblem(\"myProblem\", LpMinimize)\nx = prob.add_variable(\"x\", 0, 3)\n\ny = prob.add_variable(\"y\", cat=\"Binary\")\n\nprob += x + y <= 2\n\nprob += -4*x + y\n\nstats = prob.solve()\n\nstats.status_str\n\nvalue(x)\n",
      "asOf": "2026-11-17"
    },
    "F72": {
      "label": "Project function, pulp",
      "display": "def _from_sparse_matrix(self) -> None:\n    \"\"\"\n    Create the k nearest p-median problem from the sparse distance matrix.\n\n    Returns\n    -------\n\n    None\n    \"\"\"\n    n_cli = self.sparse_matrix.shape[0]\n    r_cli = range(n_cli)\n    r_fac = range(self.sparse_matrix.shape[1])\n\n    self.weights = np.reshape(self.weights, (n_cli, 1))\n    # create and store the weighted sparse matrix\n    self.aij = self.sparse_matrix.multiply(self.weights).tocsr()\n\n    # create the model/problem\n    self.problem = pulp.LpProblem(self.name, pulp.LpMinimize)\n\n    # add all the 1)decision variable, 2)objective function, and 3)constraints\n\n    # Facility integer decision variable\n    FacilityModelBuilder.add_facility_integer_variable(self, r_fac, \"y[{i}]\")\n    fac_vars = getattr(self, \"fac_vars\")\n\n    # Placeholder facility decision variable\n    placeholder_vars = pulp.LpVariable.dicts(\n        \"g\", (i for i in r_cli), 0, 1, pulp.LpBinary\n    )\n    setattr(self, \"placeholder_vars\", placeholder_vars)\n\n    # Client assignment integer decision variables\n    row_indices, col_indices, values = find(self.aij)\n\n    cli_assgn_vars = pulp.LpVariable.dicts(\n        \"z\", list(zip(row_indices, col_indices, strict=True)), 0, 1, pulp.LpBinary\n    )\n    setattr(self, \"cli_assgn_vars\", cli_assgn_vars)\n\n    # Add the objective function\n    max_distance = self.aij.max(axis=1).toarray().flatten()\n    self.__add_obj(max_distance, r_cli, r_fac)\n\n    # Create the capacity constraints\n    if self.capacities is not None:\n        sorted_capacities = np.sort(self.capacities)\n        highest_possible_capacity = sorted_capacities[-self.p_facilities :].sum()\n        if highest_possible_capacity < self.ai_sum:\n            raise SpecificationError(\n                \"Problem is infeasible. The highest possible capacity \"\n                f\"({highest_possible_capacity}), coming from the \"\n                f\"{self.p_facilities} sites with the highest capacity, \"\n                f\"is smaller than the total demand ({self.ai_sum}).\"\n            )\n        for j in col_indices:\n            self.problem += (\n                pulp.lpSum(\n                    self.weights[i] * cli_assgn_vars.get((i, j), 0) for i in r_cli\n                )\n                <= fac_vars[j] * self.capacities[j]\n            )\n\n    # Create assignment constraints.\n    for i in r_cli:\n        self.problem += (\n            pulp.lpSum(cli_assgn_vars.get((i, j), 0) for j in set(col_indices))\n            + placeholder_vars[i]\n            == 1\n        )\n    # Create the facility constraint\n    FacilityModelBuilder.add_facility_constraint(self, self.p_facilities)\n\n    # Create opening constraints\n    FacilityModelBuilder.add_opening_constraint(self, r_fac, r_cli)\n",
      "asOf": "2026-11-17"
    },
    "F73": {
      "label": "Project function reference, pulp",
      "display": "p_median.py · _from_sparse_matrix()",
      "asOf": "2026-11-17"
    },
    "F74": {
      "label": "Project repository, pulp",
      "display": "pysal/spopt",
      "asOf": "2026-11-17"
    },
    "F75": {
      "label": "Project stars, pysal/spopt",
      "display": "387",
      "asOf": "2026-11-17"
    },
    "F76": {
      "label": "Project push date, pysal/spopt",
      "display": "Oct 2026",
      "asOf": "2026-10-12"
    },
    "F77": {
      "label": "Library name, mip",
      "display": "Python-MIP",
      "asOf": "2026-11-17"
    },
    "F78": {
      "label": "Monthly downloads, mip",
      "display": "165.4K",
      "asOf": "2026-11-17"
    },
    "F79": {
      "label": "License, mip",
      "display": "Eclipse Public License 2.0 (EPL-2.0)",
      "asOf": "2026-11-17"
    },
    "F80": {
      "label": "Package release, mip",
      "display": "2.0.2, Nov 2026",
      "asOf": "2026-11-09"
    },
    "F81": {
      "label": "Package release date, mip",
      "display": "Nov 2026",
      "asOf": "2026-11-09"
    },
    "F82": {
      "label": "Repository stars, mip",
      "display": "607",
      "asOf": "2026-11-17"
    },
    "F83": {
      "label": "Integer variables, mip",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F84": {
      "label": "Solution hints, mip",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F85": {
      "label": "Dual values, mip",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F86": {
      "label": "Named constraints, mip",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F87": {
      "label": "Install, mip",
      "display": "pip install mip",
      "asOf": "2026-11-17"
    },
    "F88": {
      "label": "What it does, mip",
      "display": "Builds and optimizes mixed-integer models through a Python Model API.",
      "asOf": "2026-11-17"
    },
    "F89": {
      "label": "strengths lead, mip",
      "display": "Accepts partial integer starts",
      "asOf": "2026-11-17"
    },
    "F90": {
      "label": "strengths, mip",
      "display": "Provide nonzero integer decisions; auxiliary and continuous values are computed automatically.",
      "asOf": "2026-11-17"
    },
    "F91": {
      "label": "strengths lead, mip",
      "display": "Controls the search time budget",
      "asOf": "2026-11-17"
    },
    "F92": {
      "label": "strengths, mip",
      "display": "Set an optimize time limit and inspect the returned solution status.",
      "asOf": "2026-11-17"
    },
    "F93": {
      "label": "limitations lead, mip",
      "display": "Feasible does not prove optimal",
      "asOf": "2026-11-17"
    },
    "F94": {
      "label": "limitations, mip",
      "display": "Check OPTIMAL separately from FEASIBLE after a time-limited search.",
      "asOf": "2026-11-17"
    },
    "F95": {
      "label": "limitations lead, mip",
      "display": "Constraint duals need continuous models",
      "asOf": "2026-11-17"
    },
    "F96": {
      "label": "limitations, mip",
      "display": "Read pi only after solving a pure continuous linear program.",
      "asOf": "2026-11-17"
    },
    "F97": {
      "label": "Quickstart, mip",
      "display": "\"\"\"0/1 Knapsack example\"\"\"\n\nfrom mip import Model, xsum, maximize, BINARY\n\np = [10, 13, 18, 31, 7, 15]\nw = [11, 15, 20, 35, 10, 33]\nc, I = 47, range(len(w))\n\nm = Model(\"knapsack\")\n\nx = [m.add_var(var_type=BINARY) for i in I]\n\nm.objective = maximize(xsum(p[i] * x[i] for i in I))\n\nm += xsum(w[i] * x[i] for i in I) <= c\n\nm.optimize()\n\nselected = [i for i in I if x[i].x >= 0.99]\nprint(\"selected items: {}\".format(selected))\n\n# sanity tests\nfrom mip import OptimizationStatus\n\nassert m.status == OptimizationStatus.OPTIMAL\nassert round(m.objective_value) == 41\nassert round(m.constrs[0].slack) == 1\n",
      "asOf": "2026-11-17"
    },
    "F98": {
      "label": "Developer need",
      "display": "Choosing a solver after modeling",
      "asOf": "2026-11-17"
    },
    "F99": {
      "label": "Why choose pulp",
      "display": "its solver-independent modeling interface",
      "asOf": "2026-11-17"
    },
    "F100": {
      "label": "Developer need in introduction",
      "display": "choosing a solver after modeling",
      "asOf": "2026-11-17"
    },
    "F101": {
      "label": "Developer need",
      "display": "Supplying a candidate assignment",
      "asOf": "2026-11-17"
    },
    "F102": {
      "label": "Why choose ortools",
      "display": "the SetHint interface",
      "asOf": "2026-11-17"
    },
    "F103": {
      "label": "Developer need in introduction",
      "display": "supplying a candidate assignment",
      "asOf": "2026-11-17"
    },
    "F104": {
      "label": "When to consider pulp",
      "display": "selecting among separate solver backends matters",
      "asOf": "2026-11-17"
    },
    "F105": {
      "label": "Developer need",
      "display": "Working directly with HiGHS constraint duals",
      "asOf": "2026-11-17"
    },
    "F106": {
      "label": "Why choose highspy",
      "display": "its native constraint-dual accessor",
      "asOf": "2026-11-17"
    },
    "F107": {
      "label": "Developer need in introduction",
      "display": "working directly with HiGHS constraint duals",
      "asOf": "2026-11-17"
    },
    "F108": {
      "label": "When to consider mip",
      "display": "partial integer starts fit the modeling workflow",
      "asOf": "2026-11-17"
    },
    "F109": {
      "label": "Developer need",
      "display": "Supplying partial integer starts",
      "asOf": "2026-11-17"
    },
    "F110": {
      "label": "Why choose mip",
      "display": "its partial initial-solution interface",
      "asOf": "2026-11-17"
    },
    "F111": {
      "label": "Developer need in introduction",
      "display": "supplying partial integer starts",
      "asOf": "2026-11-17"
    },
    "F112": {
      "label": "Page introduction",
      "display": "Python linear programming libraries let developers build and solve linear optimization models.",
      "asOf": "2026-11-17"
    },
    "F113": {
      "label": "FAQ: Does plain PuLP include a solver?",
      "display": "CBC is not shipped in the PuLP package; install its CBC extra or provide another solver.",
      "asOf": "2026-11-17"
    },
    "F114": {
      "label": "FAQ: What changed when PuLP moved to its new model core?",
      "display": "Variables are created through prob.add_variable rather than free-standing constructors.",
      "asOf": "2026-11-17"
    },
    "F115": {
      "label": "FAQ: What changed when PuLP moved to its new model core?",
      "display": "Its solve call returns an LpSolveStats object rather than the older status code.",
      "asOf": "2026-11-17"
    },
    "F116": {
      "label": "FAQ: Can a PuLP model reuse an initial solution?",
      "display": "Supported solver APIs include COIN_CMD, with initial variable values and warmStart=True.",
      "asOf": "2026-11-17"
    },
    "F117": {
      "label": "FAQ: Does an OR-Tools solution hint have to be used?",
      "display": "The solver does not guarantee using a hint or returning an assignment close to it.",
      "asOf": "2026-11-17"
    },
    "F118": {
      "label": "FAQ: Are constraint dual values available for an integer solution?",
      "display": "OR-Tools exposes the selected constraint-dual API only for continuous problems.",
      "asOf": "2026-11-17"
    },
    "F119": {
      "label": "FAQ: Are constraint dual values available for an integer solution?",
      "display": "Python-MIP pi likewise requires solving a pure continuous linear program.",
      "asOf": "2026-11-17"
    },
    "F120": {
      "label": "FAQ: How are constraints named in a highspy model?",
      "display": "addConstr accepts an optional name argument.",
      "asOf": "2026-11-17"
    },
    "F121": {
      "label": "FAQ: Does highspy expose a native initial-solution interface?",
      "display": "Its setSolution overloads accept a HighsSolution or indexed variable values.",
      "asOf": "2026-11-17"
    },
    "F122": {
      "label": "FAQ: Does installing highspy enable every HiGHS method?",
      "display": "HiPO also needs the highspy-extras package.",
      "asOf": "2026-11-17"
    },
    "F123": {
      "label": "FAQ: How complete must a Python-MIP initial solution be?",
      "display": "Provide the main nonzero integer decisions; auxiliary and continuous variables are computed automatically.",
      "asOf": "2026-11-17"
    },
    "F124": {
      "label": "FAQ: Does FEASIBLE mean the optimum was proved?",
      "display": "Python-MIP distinguishes a feasible solution from a proved optimum.",
      "asOf": "2026-11-17"
    },
    "F125": {
      "label": "FAQ: What does the JSON output cell mean?",
      "display": "PuLP creates a JSON file containing the model information.",
      "asOf": "2026-11-17"
    },
    "F126": {
      "label": "Library name, scipy",
      "display": "SciPy",
      "asOf": "2026-11-20"
    },
    "F127": {
      "label": "Monthly downloads, scipy",
      "display": "392.1M",
      "asOf": "2026-11-20"
    },
    "F128": {
      "label": "License, scipy",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-20"
    },
    "F129": {
      "label": "Package release, scipy",
      "display": "1.18.1",
      "asOf": "2026-11-20"
    },
    "F130": {
      "label": "Package release date, scipy",
      "display": "Aug 2026",
      "asOf": "2026-11-20"
    },
    "F131": {
      "label": "Install, scipy",
      "display": "pip install scipy",
      "asOf": "2026-11-20"
    },
    "F132": {
      "label": "Quickstart, scipy",
      "display": "from scipy.optimize import linprog\n\nresult = linprog([-1.0], bounds=[(0.0, 1.0)], method='highs')\nprint(result.message)",
      "asOf": "2026-11-20"
    },
    "F133": {
      "label": "Official description, scipy",
      "display": "Provides fundamental algorithms for scientific computing.",
      "asOf": "2026-11-20"
    },
    "F134": {
      "label": "Quickstart source file, scipy",
      "display": "reference/generated/scipy.optimize.linprog.html",
      "asOf": "2026-11-20"
    },
    "F135": {
      "label": "Repository stars, scipy",
      "display": "15.2K",
      "asOf": "2026-11-20"
    },
    "F136": {
      "label": "Integer variables, scipy",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F137": {
      "label": "Native cone constraints, scipy",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F138": {
      "label": "Named algebraic models, scipy",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F139": {
      "label": "Python requirement, scipy",
      "display": ">=3.12",
      "asOf": "2026-11-20"
    },
    "F140": {
      "label": "Modeling and solver role, scipy",
      "display": "Scientific-array LP and MILP interface",
      "asOf": "2026-11-20"
    },
    "F141": {
      "label": "Project function, scipy",
      "display": "def solve_via_data(self, data, warm_start: bool, verbose: bool, solver_opts, solver_cache=None):\n    from scipy import optimize as opt\n\n    # Set default method which can be overridden by user inputs.\n    meth = \"highs\"\n\n    # Check if the problem is a MIP.\n    problem_is_a_mip = data[s.BOOL_IDX] or data[s.INT_IDX]\n\n    # Build variable bounds from BOUNDED_VARIABLES data\n    n = data[s.C].shape[0]\n    lb = data.get(s.LOWER_BOUNDS)\n    ub = data.get(s.UPPER_BOUNDS)\n\n    # Track variable integrality options. An entry of zero implies that\n    # the variable is continuous. An entry of one implies that the\n    # variable is either binary or an integer with bounds.\n    if problem_is_a_mip:\n        integrality = [0] * n\n\n        for index in data[s.BOOL_IDX] + data[s.INT_IDX]:\n            integrality[index] = 1\n\n        bounds = [(\n            lb[i] if lb is not None else None,\n            ub[i] if ub is not None else None,\n        ) for i in range(n)]\n\n        for index in data[s.BOOL_IDX]:\n            cur_lb, cur_ub = bounds[index]\n            new_lb = max(0, cur_lb) if cur_lb is not None else 0\n            new_ub = min(1, cur_ub) if cur_ub is not None else 1\n            bounds[index] = (new_lb, new_ub)\n    else:\n        integrality = None\n        if lb is not None or ub is not None:\n            bounds = [(\n                lb[i] if lb is not None else None,\n                ub[i] if ub is not None else None,\n            ) for i in range(n)]\n        else:\n            bounds = (None, None)\n\n    # Extract solver options which are not part of the options dictionary\n    if solver_opts:\n\n        # Raise error message if the parameters are not passed in\n        # a dictionary called 'scipy_options'.\n        if \"scipy_options\" not in solver_opts:\n            raise ValueError(\"All parameters for the SCIPY solver should \"\n                             \"be encased within a dictionary called \"\n                             \"scipy_options e.g. \\n\"\n                             \"prob.solve(solver='SCIPY', verbose=True,\"\n                             \" scipy_options={'method':'highs-ds', 'maxiter':10000})\")\n\n        if \"method\" in solver_opts[\"scipy_options\"]:\n            meth = solver_opts[\"scipy_options\"].pop(\"method\")\n\n        # Disable the 'bounds' parameter to avoid problems with\n        # canonicalised problems.\n        if \"bounds\" in solver_opts['scipy_options']:\n            raise ValueError(\"Please do not specify bounds through \"\n                             \"scipy_options. Please specify bounds \"\n                             \"through CVXPY.\")\n\n        # Check that the 'integrality' parameter isn't specified.\n        if \"integrality\" in solver_opts['scipy_options']:\n            raise ValueError(\"Please do not specify variable integrality through \"\n                             \"scipy_options. Please specify variable types \"\n                             \"through CVXPY.\")\n\n        # Check for SciPy method support (i.e., only 'highs' supports MIP models).\n        method_supports_mip = meth == 'highs'\n\n        if problem_is_a_mip and not method_supports_mip:\n            raise ValueError(\"Only the 'highs' SciPy method can solve MIP models.\")\n\n        # Not supported by HiGHS solvers:\n        # callback = solver_opts['scipy_options'].pop(\"callback\", None)\n        # x0 = solver_opts['scipy_options'].pop(\"x0\", None)\n    else:\n        # Instantiate an empty `scipy_options` entry.\n        solver_opts['scipy_options'] = {}\n\n    if problem_is_a_mip:\n        constraints = []\n        G = data[s.G]\n        if G is not None:\n            ineq = scipy.optimize.LinearConstraint(G, ub=data[s.H])\n            # ensure that index arrays are int32\n            ineq.A.indptr = ineq.A.indptr.astype(np.int32)\n            ineq.A.indices = ineq.A.indices.astype(np.int32)\n            constraints.append(ineq)\n        A = data[s.A]\n        if A is not None:\n            eq = scipy.optimize.LinearConstraint(A,data[s.B], data[s.B])\n            constraints.append(eq)\n        lb = [t[0] if t[0] is not None else -np.inf for t in bounds]\n        ub = [t[1] if t[1] is not None else np.inf for t in bounds]\n        bounds = scipy.optimize.Bounds(lb, ub)\n        solution = opt.milp(data[s.C],\n                            constraints=constraints,\n                            options=solver_opts['scipy_options'],\n                            integrality=integrality,\n                            bounds=bounds)\n    else:\n        solution = opt.linprog(data[s.C], A_ub=data[s.G], b_ub=data[s.H],\n                               A_eq=data[s.A], b_eq=data[s.B], method=meth,\n                               options=solver_opts['scipy_options'],\n                               bounds=bounds)\n\n    # Replace `scipy_options` method to avoid future warnings.\n    solver_opts[\"scipy_options\"][\"method\"] = meth\n\n    if verbose is True:\n        print(\"Solver terminated with message: \" + solution.message)\n\n    return solution",
      "asOf": "2026-11-20"
    },
    "F142": {
      "label": "Project source file, scipy",
      "display": "cvxpy/reductions/solvers/conic_solvers/scipy_conif.py",
      "asOf": "2026-11-20"
    },
    "F143": {
      "label": "Project full_name, scipy",
      "display": "cvxpy/cvxpy",
      "asOf": "2026-11-20"
    },
    "F144": {
      "label": "Project stargazers_count, scipy",
      "display": "6.4K",
      "asOf": "2026-11-20"
    },
    "F145": {
      "label": "Library name, ortools",
      "display": "OR-Tools",
      "asOf": "2026-11-20"
    },
    "F146": {
      "label": "Monthly downloads, ortools",
      "display": "8.4M",
      "asOf": "2026-11-20"
    },
    "F147": {
      "label": "License, ortools",
      "display": "Apache-2.0",
      "asOf": "2026-11-20"
    },
    "F148": {
      "label": "Package release, ortools",
      "display": "9.15.6755",
      "asOf": "2026-11-20"
    },
    "F149": {
      "label": "Package release date, ortools",
      "display": "Jan 2026",
      "asOf": "2026-11-20"
    },
    "F150": {
      "label": "Install, ortools",
      "display": "pip install ortools",
      "asOf": "2026-11-20"
    },
    "F151": {
      "label": "Quickstart, ortools",
      "display": "from ortools.linear_solver import pywraplp\n\nsolver = pywraplp.Solver.CreateSolver('GLOP')\nx = solver.NumVar(0, 1, 'x')\nsolver.Maximize(x)\nstatus = solver.Solve()\nprint(status)",
      "asOf": "2026-11-20"
    },
    "F152": {
      "label": "Repository stars, ortools",
      "display": "14.4K",
      "asOf": "2026-11-20"
    },
    "F153": {
      "label": "Integer variables, ortools",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F154": {
      "label": "Native cone constraints, ortools",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F155": {
      "label": "Named algebraic models, ortools",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F156": {
      "label": "Python requirement, ortools",
      "display": ">=3.9",
      "asOf": "2026-11-20"
    },
    "F157": {
      "label": "Modeling and solver role, ortools",
      "display": "Named MPSolver variables and linear expressions",
      "asOf": "2026-11-20"
    },
    "F158": {
      "label": "Other modeling namespace, ortools",
      "display": "MathOpt Model is separate from pywraplp MPSolver",
      "asOf": "2026-11-20"
    },
    "F159": {
      "label": "Project function, ortools",
      "display": "def build_model(self, divergence, n_nonevent, n_event, trend_change):\n    # Parameters\n    [D, V, pvalue_violation_indices,\n     min_diff_violation_indices] = model_data(\n        divergence, n_nonevent, n_event, self.max_pvalue,\n        self.max_pvalue_policy, self.min_event_rate_diff)\n\n    n = len(n_nonevent)\n    n_records = n_nonevent + n_event\n\n    # Initialize solver\n    if self.mip_solver == \"bop\":\n        solver = pywraplp.Solver(\n            'BinningMIP', pywraplp.Solver.BOP_INTEGER_PROGRAMMING)\n    elif self.mip_solver == \"cbc\":\n        solver = pywraplp.Solver(\n            'BinningMIP', pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)\n\n    # Decision variables\n    x, y, t, d, u, bin_size_diff = self.decision_variables(solver, n)\n\n    # Objective function\n    if self.gamma:\n        total_records = int(n_records.sum())\n        regularization = self.gamma / total_records\n        pmax = solver.IntVar(0, total_records, \"pmax\")\n        pmin = solver.IntVar(0, total_records, \"pmin\")\n\n        solver.Maximize(solver.Sum([(V[i][i] * x[i, i]) +\n                        solver.Sum([(V[i][j] - V[i][j+1]) * x[i, j]\n                                    for j in range(i)])\n                                    for i in range(n)]) -\n                        regularization * (pmax - pmin))\n    else:\n        solver.Maximize(solver.Sum([(V[i][i] * x[i, i]) +\n                        solver.Sum([(V[i][j] - V[i][j+1]) * x[i, j]\n                                    for j in range(i)])\n                                    for i in range(n)]))\n\n    # Constraint: unique assignment\n    self.add_constraint_unique_assignment(solver, n, x)\n\n    # Constraint: continuity\n    self.add_constraint_continuity(solver, n, x)\n\n    # Constraint: min / max bins\n    self.add_constraint_min_max_bins(solver, n, x, d)\n\n    # Constraint: min / max bin size\n    self.add_constraint_min_max_bin_size(solver, n, x, u, n_records,\n                                         bin_size_diff)\n\n    # Constraint: min / max n_nonevent per bin\n    if (self.min_bin_n_nonevent is not None or\n            self.max_bin_n_nonevent is not None):\n        for i in range(n):\n            bin_ne_size = solver.Sum([n_nonevent[j] * x[i, j]\n                                      for j in range(i + 1)])\n\n            if self.min_bin_n_nonevent is not None:\n                solver.Add(bin_ne_size >= self.min_bin_n_nonevent*x[i, i])\n\n            if self.max_bin_n_nonevent is not None:\n                solver.Add(bin_ne_size <= self.max_bin_n_nonevent*x[i, i])\n\n    # Constraint: min / max n_event per bin\n    if (self.min_bin_n_event is not None or\n            self.max_bin_n_event is not None):\n        for i in range(n):\n            bin_e_size = solver.Sum([n_event[j] * x[i, j]\n                                     for j in range(i + 1)])\n\n            if self.min_bin_n_event is not None:\n                solver.Add(bin_e_size >= self.min_bin_n_event * x[i, i])\n\n            if self.max_bin_n_event is not None:\n                solver.Add(bin_e_size <= self.max_bin_n_event * x[i, i])\n\n    # Constraints: monotonicity\n    if self.monotonic_trend == \"ascending\":\n        self.add_constraint_monotonic_ascending(solver, n, D, x)\n\n    elif self.monotonic_trend == \"descending\":\n        self.add_constraint_monotonic_descending(solver, n, D, x)\n\n    elif self.monotonic_trend == \"concave\":\n        self.add_constraint_monotonic_concave(solver, n, D, x)\n\n    elif self.monotonic_trend == \"convex\":\n        self.add_constraint_monotonic_convex(solver, n, D, x)\n\n    elif self.monotonic_trend in (\"peak\", \"valley\"):\n        for i in range(n):\n            solver.Add(t >= i - n * (1 - y[i]))\n            solver.Add(t <= i + n * y[i])\n\n        if self.monotonic_trend == \"peak\":\n            self.add_constraint_monotonic_peak(solver, n, D, x, y)\n        else:\n            self.add_constraint_monotonic_valley(solver, n, D, x, y)\n\n    elif self.monotonic_trend == \"peak_heuristic\":\n        self.add_constraint_monotonic_peak_heuristic(\n            solver, n, D, x, trend_change)\n\n    elif self.monotonic_trend == \"valley_heuristic\":\n        self.add_constraint_monotonic_valley_heuristic(\n            solver, n, D, x, trend_change)\n\n    # Constraint: reduction of dominating bins\n    if self.gamma:\n        for i in range(n):\n            bin_size = solver.Sum([n_records[j] * x[i, j]\n                                   for j in range(i + 1)])\n\n            solver.Add(pmin <= total_records * (1 - x[i, i]) + bin_size)\n            solver.Add(pmax >= bin_size)\n        solver.Add(pmin <= pmax)\n\n    # Constraint: max-pvalue\n    self.add_constraint_violation(solver, x, pvalue_violation_indices)\n\n    # Constraint: min diff\n    self.add_constraint_violation(solver, x, min_diff_violation_indices)\n\n    # Constraint: fixed splits\n    self.add_constraint_fixed_splits(solver, n, x)\n\n    self.solver_ = solver\n    self._n = n\n    self._x = x",
      "asOf": "2026-11-20"
    },
    "F160": {
      "label": "Project source file, ortools",
      "display": "optbinning/binning/mip.py",
      "asOf": "2026-11-20"
    },
    "F161": {
      "label": "Project full_name, ortools",
      "display": "guillermo-navas-palencia/optbinning",
      "asOf": "2026-11-20"
    },
    "F162": {
      "label": "Project stargazers_count, ortools",
      "display": "539",
      "asOf": "2026-11-20"
    },
    "F163": {
      "label": "Library name, highspy",
      "display": "HiGHS",
      "asOf": "2026-11-20"
    },
    "F164": {
      "label": "Monthly downloads, highspy",
      "display": "7.2M",
      "asOf": "2026-11-20"
    },
    "F165": {
      "label": "License, highspy",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F166": {
      "label": "Package release, highspy",
      "display": "1.16.0",
      "asOf": "2026-11-20"
    },
    "F167": {
      "label": "Package release date, highspy",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F168": {
      "label": "Install, highspy",
      "display": "pip install highspy",
      "asOf": "2026-11-20"
    },
    "F169": {
      "label": "Quickstart, highspy",
      "display": "import highspy\n\nsolver = highspy.Highs()\nx = solver.addVariable(lb=0, ub=1, obj=-1)\nsolver.run()\nprint(solver.getModelStatus())",
      "asOf": "2026-11-20"
    },
    "F170": {
      "label": "Repository stars, highspy",
      "display": "1.9K",
      "asOf": "2026-11-20"
    },
    "F171": {
      "label": "Integer variables, highspy",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F172": {
      "label": "Native cone constraints, highspy",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F173": {
      "label": "Named algebraic models, highspy",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F174": {
      "label": "Python requirement, highspy",
      "display": ">=3.9",
      "asOf": "2026-11-20"
    },
    "F175": {
      "label": "Modeling and solver role, highspy",
      "display": "Direct HiGHS engine with matrix and high-level Python modeling APIs",
      "asOf": "2026-11-20"
    },
    "F176": {
      "label": "Project function, highspy",
      "display": "def solve_via_data(\n    self, data, warm_start: bool, verbose: bool, solver_opts, solver_cache=None\n):\n    \"\"\"Returns the result of the call to the solver.\n\n    minimize          cx\n        subject to    A x <=  b\n\n    in HiGHS, the opt problem format is,\n\n    minimize          cx\n        subject to    lboundA <= A x <= uboundA\n\n    Parameters\n    ----------\n    data : dict\n        Data used by the solver.\n    warm_start : bool\n        Whether to warm_start HiGHS.\n    verbose : bool\n        Should the solver print output?\n    solver_opts : dict\n        Additional arguments for the solver.\n\n    Returns\n    -------\n    tuple\n        (status, optimal value, primal, equality dual, inequality dual)\n    \"\"\"\n    import highspy as hp\n\n    # setup problem data\n    inf = hp.Highs().inf\n    dims = dims_to_solver_dict(data[s.DIMS])\n\n    c = data[s.C]\n    # A = sp.vstack([data[s.A], data[s.F]]).tocsc()\n    A = data[s.A].tocsc()\n    data[\"Ax\"] = A\n\n    leq_start = dims[s.EQ_DIM]\n    leq_end = dims[s.EQ_DIM] + dims[s.LEQ_DIM]\n    uboundA = data[s.B]\n    data[\"u\"] = uboundA\n    lboundA = np.concatenate(\n        [data[s.B][:leq_start], -inf * np.ones(data[s.B][leq_start:leq_end].shape)]\n    )\n    data[\"l\"] = lboundA\n\n    # setup highs model\n    model = hp.HighsModel()\n    lp = model.lp_\n    lp.num_col_ = A.shape[1]\n    # assert data['n_var'] == A.shape[1]\n    lp.num_row_ = A.shape[0]\n    # assert data['n_eq'] + data['n_ineq'] == A.shape[0]\n\n    # offset already applied in invert()\n    lp.offset_ = 0\n    lp.col_cost_ = c\n    lp.row_lower_ = lboundA\n    lp.row_upper_ = uboundA\n\n    assert A.format == \"csc\"\n    lp.a_matrix_.format_ = hp.MatrixFormat.kColwise\n    lp.a_matrix_.start_ = A.indptr\n    lp.a_matrix_.index_ = A.indices\n    lp.a_matrix_.value_ = A.data\n\n    # Define Variable bounds\n    lb = data[s.LOWER_BOUNDS]\n    ub = data[s.UPPER_BOUNDS]\n    col_lower = np.full(lp.num_col_, -inf, dtype=c.dtype) if lb is None else lb.copy()\n    col_upper = np.full(lp.num_col_, inf, dtype=c.dtype) if ub is None else ub.copy()\n    # update col_lower and col_upper to account for boolean variables,\n    # also set integrality_ for boolean or integers variables\n    if data[s.BOOL_IDX] or data[s.INT_IDX]:\n        # note that integrality_ can only be assigned a list\n        integrality = [hp.HighsVarType.kContinuous] * lp.num_col_\n        if data[s.BOOL_IDX]:\n            for ind in data[s.BOOL_IDX]:\n                integrality[ind] = hp.HighsVarType.kInteger\n            bool_mask = np.array(data[s.BOOL_IDX], dtype=int)\n            col_lower[bool_mask] = np.maximum(col_lower[bool_mask], 0)\n            col_upper[bool_mask] = np.minimum(col_upper[bool_mask], 1)\n        for ind in data[s.INT_IDX]:\n            integrality[ind] = hp.HighsVarType.kInteger\n        lp.integrality_ = integrality\n    lp.col_lower_ = col_lower\n    lp.col_upper_ = col_upper\n\n    solver = hp.Highs()\n\n    # setup options\n    unpack_highs_options_inplace(solver_opts)\n    write_model_file = solver_opts.pop(\"write_model_file\", None)\n    solver.setOptionValue(\"log_to_console\", verbose)\n    for name, value in solver_opts.items():\n        # note that calling setOptionValue directly on the solver\n        # allows one to pass advanced options that aren't available\n        # on the HighOptions class (e.g., presolve_rule_off)\n        if solver.setOptionValue(name, value) == hp.HighsStatus.kError:\n            raise ValueError(\n                f\"HIGHS returned status kError for option (name, value): ({name}, {value})\"\n            )\n\n    if write_model_file:\n        # TODO: Names can be collected upstream more systematically\n        # (or in the parent class) to be used by all solvers.\n        set_column_names_from_variables(lp, data[s.PARAM_PROB].variables)\n\n    solver.passModel(model)\n\n    if write_model_file:\n        solver.writeModel(write_model_file)\n\n    if warm_start and solver_cache is not None and self.name() in solver_cache:\n        old_solver, old_data, old_result = solver_cache[self.name()]\n        old_status = self.STATUS_MAP.get(old_result[\"model_status\"], s.SOLVER_ERROR)\n        if old_status in s.SOLUTION_PRESENT:\n            solver.setSolution(old_result[\"solution\"])\n\n    # initialize and solve problem\n    try:\n        solver.run()\n        results = {\n            \"solution\": solver.getSolution(),\n            \"basis\": solver.getBasis(),\n            \"info\": solver.getInfo(),\n            \"model_status\": solver.getModelStatus().name,\n            \"run_time\": solver.getRunTime(),\n        }\n        if results[\"model_status\"] == \"kInfeasible\":\n            results[\"dual_ray\"] = solver.getDualRay()\n    except ValueError as e:\n        raise SolverError(e)\n\n    if solver_cache is not None:\n        solver_cache[self.name()] = (solver, data, results)\n\n    return results",
      "asOf": "2026-11-20"
    },
    "F177": {
      "label": "Project source file, highspy",
      "display": "cvxpy/reductions/solvers/conic_solvers/highs_conif.py",
      "asOf": "2026-11-20"
    },
    "F178": {
      "label": "Project full_name, highspy",
      "display": "cvxpy/cvxpy",
      "asOf": "2026-11-20"
    },
    "F179": {
      "label": "Project stargazers_count, highspy",
      "display": "6.4K",
      "asOf": "2026-11-20"
    },
    "F180": {
      "label": "Library name, osqp",
      "display": "OSQP",
      "asOf": "2026-11-20"
    },
    "F181": {
      "label": "Monthly downloads, osqp",
      "display": "6.6M",
      "asOf": "2026-11-20"
    },
    "F182": {
      "label": "License, osqp",
      "display": "Apache-2.0",
      "asOf": "2026-11-20"
    },
    "F183": {
      "label": "Package release, osqp",
      "display": "1.1.3",
      "asOf": "2026-11-20"
    },
    "F184": {
      "label": "Package release date, osqp",
      "display": "Jun 2026",
      "asOf": "2026-11-20"
    },
    "F185": {
      "label": "Install, osqp",
      "display": "pip install osqp",
      "asOf": "2026-11-20"
    },
    "F186": {
      "label": "Quickstart, osqp",
      "display": "import numpy as np\nfrom scipy import sparse\nimport osqp\n\nsolver = osqp.OSQP()\nsolver.setup(P=sparse.csc_matrix((1, 1)), q=np.array([-1.0]),\n             A=sparse.csc_matrix([[1.0]]), l=np.array([0.0]), u=np.array([1.0]))\nresult = solver.solve(raise_error=False)\nprint(result.info.status)",
      "asOf": "2026-11-20"
    },
    "F187": {
      "label": "Official description, osqp",
      "display": "Solves quadratic programs with operator splitting.",
      "asOf": "2026-11-20"
    },
    "F188": {
      "label": "Quickstart source file, osqp",
      "display": "interfaces/python",
      "asOf": "2026-11-20"
    },
    "F189": {
      "label": "Repository stars, osqp",
      "display": "130",
      "asOf": "2026-11-20"
    },
    "F190": {
      "label": "Integer variables, osqp",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F191": {
      "label": "Native cone constraints, osqp",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F192": {
      "label": "Named algebraic models, osqp",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F193": {
      "label": "Python requirement, osqp",
      "display": ">=3.8",
      "asOf": "2026-11-20"
    },
    "F194": {
      "label": "Modeling and solver role, osqp",
      "display": "Direct sparse continuous convex QP/LP solver",
      "asOf": "2026-11-20"
    },
    "F195": {
      "label": "Repeated-solve updates, osqp",
      "display": "Native cached numerical solver state",
      "asOf": "2026-11-20"
    },
    "F196": {
      "label": "Project function, osqp",
      "display": "def solve_via_data(self, data, warm_start: bool, verbose: bool, solver_opts,\n                   solver_cache=None):\n    import osqp\n    is_pre_v1 = float(osqp.__version__.split('.')[0]) < 1\n\n    P = data[s.P]\n    q = data[s.Q]\n    A = sp.vstack([data[s.A], data[s.F]]).tocsc()\n    data['Ax'] = A\n    uA = np.concatenate((data[s.B], data[s.G]))\n    data['u'] = uA\n    lA = np.concatenate([data[s.B], -np.inf*np.ones(data[s.G].shape)])\n    data['l'] = lA\n\n    if P is not None:\n        P = sp.csc_matrix((P.data, P.indices, P.indptr), shape=P.shape)\n    if A is not None:\n        A = sp.csc_matrix((A.data, A.indices, A.indptr), shape=A.shape)\n\n    # Overwrite defaults eps_abs=eps_rel=1e-3, max_iter=4000\n    solver_opts['eps_abs'] = solver_opts.get('eps_abs', 1e-5)\n    solver_opts['eps_rel'] = solver_opts.get('eps_rel', 1e-5)\n    solver_opts['max_iter'] = solver_opts.get('max_iter', 10000)\n\n    # Use cached data\n    if warm_start and solver_cache is not None and self.name() in solver_cache:\n        solver, old_data, results = solver_cache[self.name()]\n        new_args = {}\n        for key in ['q', 'l', 'u']:\n            if any(data[key] != old_data[key]):\n                new_args[key] = data[key]\n        factorizing = False\n        if P.data.shape != old_data[s.P].data.shape or any(\n                P.data != old_data[s.P].data):\n            P_triu = sp.csc_array(sp.triu(P, format='csc'))\n            new_args['Px'] = P_triu.data\n            factorizing = True\n        if A.data.shape != old_data['Ax'].data.shape or any(\n                A.data != old_data['Ax'].data):\n            new_args['Ax'] = A.data\n            factorizing = True\n\n        if new_args:\n            solver.update(**new_args)\n        # Map OSQP statuses back to CVXPY statuses\n        status_map = self.STATUS_MAP_PRE_V1 if is_pre_v1 else self.STATUS_MAP\n        status = status_map.get(results.info.status_val, s.SOLVER_ERROR)\n        if status == s.OPTIMAL:\n            solver.warm_start(results.x, results.y)\n        # Polish if factorizing.\n        polish_param = 'polish' if is_pre_v1 else 'polishing'\n        solver_opts[polish_param] = solver_opts.get(polish_param, factorizing)\n        solver.update_settings(verbose=verbose, **solver_opts)\n    else:\n        # Initialize and solve problem\n        polish_param = 'polish' if is_pre_v1 else 'polishing'\n        solver_opts[polish_param] = solver_opts.get(polish_param, True)\n        solver = osqp.OSQP()\n        try:\n            solver.setup(P, q, A, lA, uA, verbose=verbose, **solver_opts)\n        except Exception as e:\n            raise SolverError(e)\n\n    results = solver.solve(raise_error=False)\n\n    if solver_cache is not None:\n        solver_cache[self.name()] = (solver, data, results)\n    return results",
      "asOf": "2026-11-20"
    },
    "F197": {
      "label": "Project source file, osqp",
      "display": "cvxpy/reductions/solvers/qp_solvers/osqp_qpif.py",
      "asOf": "2026-11-20"
    },
    "F198": {
      "label": "Project full_name, osqp",
      "display": "cvxpy/cvxpy",
      "asOf": "2026-11-20"
    },
    "F199": {
      "label": "Project stargazers_count, osqp",
      "display": "6.4K",
      "asOf": "2026-11-20"
    },
    "F200": {
      "label": "Library name, pulp",
      "display": "PuLP",
      "asOf": "2026-11-20"
    },
    "F201": {
      "label": "Monthly downloads, pulp",
      "display": "6.4M",
      "asOf": "2026-11-20"
    },
    "F202": {
      "label": "License, pulp",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F203": {
      "label": "Package release, pulp",
      "display": "4.2.0",
      "asOf": "2026-11-20"
    },
    "F204": {
      "label": "Package release date, pulp",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F205": {
      "label": "Install, pulp",
      "display": "pip install pulp[cbc]",
      "asOf": "2026-11-20"
    },
    "F206": {
      "label": "Quickstart, pulp",
      "display": "from pulp import LpProblem, LpMinimize\n\nproblem = LpProblem('first_model', LpMinimize)\nx = problem.add_variable('x', lowBound=0, upBound=1)\nproblem += -x\nstats = problem.solve()\nprint(stats.status_str)",
      "asOf": "2026-11-20"
    },
    "F207": {
      "label": "Repository stars, pulp",
      "display": "2.5K",
      "asOf": "2026-11-20"
    },
    "F208": {
      "label": "Integer variables, pulp",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F209": {
      "label": "Native cone constraints, pulp",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F210": {
      "label": "Named algebraic models, pulp",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F211": {
      "label": "Python requirement, pulp",
      "display": ">=3.12",
      "asOf": "2026-11-20"
    },
    "F212": {
      "label": "Modeling and solver role, pulp",
      "display": "Problem-owned linear/MILP modeler with optional solver backends",
      "asOf": "2026-11-20"
    },
    "F213": {
      "label": "Project function, pulp",
      "display": "def __contains__(self, x: object) -> bool:\n        try:\n            import pulp\n\n            return pulp.getSolver(x).available()\n        except Exception:  # noqa: BLE001\n            return False",
      "asOf": "2026-11-20"
    },
    "F214": {
      "label": "Project source file, pulp",
      "display": "src/snakemake/scheduling/milp.py",
      "asOf": "2026-11-20"
    },
    "F215": {
      "label": "Project full_name, pulp",
      "display": "snakemake/snakemake",
      "asOf": "2026-11-20"
    },
    "F216": {
      "label": "Project stargazers_count, pulp",
      "display": "2.9K",
      "asOf": "2026-11-20"
    },
    "F217": {
      "label": "Library name, clarabel",
      "display": "Clarabel",
      "asOf": "2026-11-20"
    },
    "F218": {
      "label": "Monthly downloads, clarabel",
      "display": "5.4M",
      "asOf": "2026-11-20"
    },
    "F219": {
      "label": "License, clarabel",
      "display": "Apache-2.0",
      "asOf": "2026-11-20"
    },
    "F220": {
      "label": "Package release, clarabel",
      "display": "0.11.1",
      "asOf": "2026-11-20"
    },
    "F221": {
      "label": "Package release date, clarabel",
      "display": "Jun 2025",
      "asOf": "2026-11-20"
    },
    "F222": {
      "label": "Install, clarabel",
      "display": "pip install clarabel",
      "asOf": "2026-11-20"
    },
    "F223": {
      "label": "Quickstart, clarabel",
      "display": "import clarabel\nimport numpy as np\nfrom scipy import sparse\n\nsolver = clarabel.DefaultSolver(\n    sparse.csc_matrix((1, 1)), np.array([-1.0]),\n    sparse.csc_matrix([[1.0], [-1.0]]), np.array([1.0, 0.0]),\n    [clarabel.NonnegativeConeT(2)], clarabel.DefaultSettings())\nsolution = solver.solve()\nprint(solution.status)",
      "asOf": "2026-11-20"
    },
    "F224": {
      "label": "Official description, clarabel",
      "display": "Solves conic problems with an interior-point method.",
      "asOf": "2026-11-20"
    },
    "F225": {
      "label": "Quickstart source file, clarabel",
      "display": "python/getting_started_py",
      "asOf": "2026-11-20"
    },
    "F226": {
      "label": "Repository stars, clarabel",
      "display": "629",
      "asOf": "2026-11-20"
    },
    "F227": {
      "label": "Integer variables, clarabel",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F228": {
      "label": "Native cone constraints, clarabel",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F229": {
      "label": "Named algebraic models, clarabel",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F230": {
      "label": "Python requirement, clarabel",
      "display": ">=3.9",
      "asOf": "2026-11-20"
    },
    "F231": {
      "label": "Modeling and solver role, clarabel",
      "display": "Interior-point continuous quadratic/conic solver",
      "asOf": "2026-11-20"
    },
    "F232": {
      "label": "Repeated-solve updates, clarabel",
      "display": "Native cached numerical solver state",
      "asOf": "2026-11-20"
    },
    "F233": {
      "label": "Project function, clarabel",
      "display": "def solve_via_data(self, data, warm_start: bool, verbose: bool, solver_opts, solver_cache=None):\n    \"\"\"Returns the result of the call to the solver.\n\n    Parameters\n    ----------\n    data : dict\n        Data generated via an apply call.\n    warm_start : Bool\n        Whether to warm_start Clarabel.\n    verbose : Bool\n        Control the verbosity.\n    solver_opts : dict\n        Clarabel-specific solver options.\n\n    Returns\n    -------\n    The result returned by a call to clarabel.solve().\n    \"\"\"\n    import clarabel\n\n    A = data[s.A]\n    b = data[s.B]\n    q = data[s.C]\n\n    if s.P in data:\n        P = data[s.P]\n    else:\n        nvars = q.size\n        P = sp.csc_array((nvars, nvars))\n\n    P = sp.triu(P).tocsc()\n\n    cones = dims_to_solver_cones(data[ConicSolver.DIMS])\n\n    def new_solver():\n\n        _settings = self.parse_solver_opts(verbose, solver_opts)\n        _solver = clarabel.DefaultSolver(P, q, A, b, cones, _settings)\n        return _solver\n\n    def updated_solver():\n\n        if (not warm_start) or (solver_cache is None) or (self.name() not in solver_cache):\n            return None\n\n        _solver = solver_cache[self.name()]\n\n        if not hasattr(_solver, \"update\"):\n            return None\n        elif not _solver.is_data_update_allowed():\n            # disallow when presolve or chordal decomposition is used\n            return None\n        else:\n            # current internal settings, to be updated if needed\n            oldsettings = _solver.get_settings()\n            newsettings = self.parse_solver_opts(verbose, solver_opts, oldsettings)\n\n            # this overwrites all data in the solver but will not\n            # reallocate internal memory.  Could be faster if it\n            # were known which terms (or partial terms) have changed.\n            try:\n                _solver.update(P=P, q=q, A=A, b=b, settings=newsettings)\n                return _solver\n            except Exception:\n                # If sparsity pattern or dimensions changed, update() fails.\n                # Return None to trigger a full new_solver() re-initialization.\n                return None\n\n    # Try to get cached data\n    solver = updated_solver()\n\n    if solver is None:\n        solver = new_solver()\n\n    results = solver.solve()\n\n    if solver_cache is not None:\n        solver_cache[self.name()] = solver\n\n    return results",
      "asOf": "2026-11-20"
    },
    "F234": {
      "label": "Project source file, clarabel",
      "display": "cvxpy/reductions/solvers/conic_solvers/clarabel_conif.py",
      "asOf": "2026-11-20"
    },
    "F235": {
      "label": "Project full_name, clarabel",
      "display": "cvxpy/cvxpy",
      "asOf": "2026-11-20"
    },
    "F236": {
      "label": "Project stargazers_count, clarabel",
      "display": "6.4K",
      "asOf": "2026-11-20"
    },
    "F237": {
      "label": "Library name, scs",
      "display": "SCS",
      "asOf": "2026-11-20"
    },
    "F238": {
      "label": "Monthly downloads, scs",
      "display": "5.3M",
      "asOf": "2026-11-20"
    },
    "F239": {
      "label": "License, scs",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F240": {
      "label": "Package release, scs",
      "display": "3.3.2",
      "asOf": "2026-11-20"
    },
    "F241": {
      "label": "Package release date, scs",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F242": {
      "label": "Install, scs",
      "display": "pip install scs",
      "asOf": "2026-11-20"
    },
    "F243": {
      "label": "Quickstart, scs",
      "display": "import numpy as np\nfrom scipy import sparse\nimport scs\n\ndata = {'A': sparse.csc_matrix([[1.0], [-1.0]]),\n        'b': np.array([1.0, 0.0]), 'c': np.array([-1.0])}\nsolver = scs.SCS(data, {'l': 2})\nresult = solver.solve()\nprint(result['info']['status'])",
      "asOf": "2026-11-20"
    },
    "F244": {
      "label": "Official description, scs",
      "display": "Solves conic problems with a splitting method.",
      "asOf": "2026-11-20"
    },
    "F245": {
      "label": "Quickstart source file, scs",
      "display": "README.md",
      "asOf": "2026-11-20"
    },
    "F246": {
      "label": "Repository stars, scs",
      "display": "48",
      "asOf": "2026-11-20"
    },
    "F247": {
      "label": "Integer variables, scs",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F248": {
      "label": "Native cone constraints, scs",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F249": {
      "label": "Named algebraic models, scs",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F250": {
      "label": "Python requirement, scs",
      "display": ">=3.9",
      "asOf": "2026-11-20"
    },
    "F251": {
      "label": "Modeling and solver role, scs",
      "display": "Splitting conic solver with configurable numerical linear-system backends",
      "asOf": "2026-11-20"
    },
    "F252": {
      "label": "Repeated-solve updates, scs",
      "display": "Native cached numerical solver state",
      "asOf": "2026-11-20"
    },
    "F253": {
      "label": "Project function, scs",
      "display": "def solve_via_data(self, data, warm_start: bool, verbose: bool, solver_opts, solver_cache=None):\n    \"\"\"Returns the result of the call to the solver.\n\n    Parameters\n    ----------\n    data : dict\n        Data generated via an apply call.\n    warm_start : Bool\n        Whether to warm_start SCS.\n    verbose : Bool\n        Control the verbosity.\n    solver_opts : dict\n        SCS-specific solver options.\n\n    Returns\n    -------\n    The result returned by a call to scs.solve().\n    \"\"\"\n    import scs\n    args = {\"A\": data[s.A], \"b\": data[s.B], \"c\": data[s.C]}\n    if s.P in data:\n        args[\"P\"] = data[s.P]\n    if warm_start and solver_cache is not None and \\\n            self.name() in solver_cache:\n        args[\"x\"] = solver_cache[self.name()][\"x\"]\n        args[\"y\"] = solver_cache[self.name()][\"y\"]\n        args[\"s\"] = solver_cache[self.name()][\"s\"]\n    cones = dims_to_solver_dict(data[ConicSolver.DIMS])\n\n    def solve(_solver_opts):\n        _results = scs.solve(args, cones, verbose=verbose, **_solver_opts)\n        _status = self.STATUS_MAP[_results[\"info\"][\"status_val\"]]\n        return _results, _status\n\n    solver_opts = SCS.parse_solver_options(solver_opts)\n    results, status = solve(solver_opts)\n    if solver_cache is not None and status == s.OPTIMAL:\n        solver_cache[self.name()] = results\n    return results",
      "asOf": "2026-11-20"
    },
    "F254": {
      "label": "Project source file, scs",
      "display": "cvxpy/reductions/solvers/conic_solvers/scs_conif.py",
      "asOf": "2026-11-20"
    },
    "F255": {
      "label": "Project full_name, scs",
      "display": "cvxpy/cvxpy",
      "asOf": "2026-11-20"
    },
    "F256": {
      "label": "Project stargazers_count, scs",
      "display": "6.4K",
      "asOf": "2026-11-20"
    },
    "F257": {
      "label": "Library name, cvxpy",
      "display": "CVXPY",
      "asOf": "2026-11-20"
    },
    "F258": {
      "label": "Monthly downloads, cvxpy",
      "display": "5.3M",
      "asOf": "2026-11-20"
    },
    "F259": {
      "label": "License, cvxpy",
      "display": "Apache-2.0",
      "asOf": "2026-11-20"
    },
    "F260": {
      "label": "Package release, cvxpy",
      "display": "1.9.3",
      "asOf": "2026-11-20"
    },
    "F261": {
      "label": "Package release date, cvxpy",
      "display": "Sep 2026",
      "asOf": "2026-11-20"
    },
    "F262": {
      "label": "Install, cvxpy",
      "display": "pip install cvxpy",
      "asOf": "2026-11-20"
    },
    "F263": {
      "label": "Quickstart, cvxpy",
      "display": "import cvxpy as cp\n\nx = cp.Variable()\nproblem = cp.Problem(cp.Minimize(-x), [x >= 0, x <= 1])\nproblem.solve()\nprint(problem.status)",
      "asOf": "2026-11-20"
    },
    "F264": {
      "label": "Official description, cvxpy",
      "display": "Models convex optimization problems in a domain-specific language.",
      "asOf": "2026-11-20"
    },
    "F265": {
      "label": "Quickstart source file, cvxpy",
      "display": "api_reference/cvxpy.problems.html",
      "asOf": "2026-11-20"
    },
    "F266": {
      "label": "Repository stars, cvxpy",
      "display": "6.4K",
      "asOf": "2026-11-20"
    },
    "F267": {
      "label": "Integer variables, cvxpy",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F268": {
      "label": "Native cone constraints, cvxpy",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F269": {
      "label": "Named algebraic models, cvxpy",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F270": {
      "label": "Python requirement, cvxpy",
      "display": ">=3.11",
      "asOf": "2026-11-20"
    },
    "F271": {
      "label": "Modeling and solver role, cvxpy",
      "display": "DCP modeler that dispatches to compatible installed solvers",
      "asOf": "2026-11-20"
    },
    "F272": {
      "label": "Project function, cvxpy",
      "display": "def _solve_cvxpy_opt_problem(self):\n    \"\"\"\n    Helper method to solve the cvxpy problem and check output,\n    once objectives and constraints have been defined\n\n    Raises\n    ------\n    exceptions.OptimizationError\n        if problem is not solvable by cvxpy\n    \"\"\"\n    try:\n        if self._opt is None:\n            self._opt = cp.Problem(cp.Minimize(self._objective), self._constraints)\n            self._initial_objective = self._objective.id\n            self._initial_constraint_ids = {const.id for const in self._constraints}\n        else:\n            if not self._objective.id == self._initial_objective:\n                raise InstantiationError(\n                    \"The objective function was changed after the initial optimization. \"\n                    \"Please create a new instance instead.\"\n                )\n\n            constr_ids = {const.id for const in self._constraints}\n            if not constr_ids == self._initial_constraint_ids:\n                raise InstantiationError(\n                    \"The constraints were changed after the initial optimization. \"\n                    \"Please create a new instance instead.\"\n                )\n        self._opt.solve(\n            solver=self._solver, verbose=self._verbose, **self._solver_options\n        )\n\n    except (TypeError, cp.DCPError) as e:\n        raise OptimizationError from e\n\n    if self._opt.status not in {\"optimal\", \"optimal_inaccurate\"}:\n        raise OptimizationError(\"Solver status: {}\".format(self._opt.status))\n    self.weights = self._w.value.round(16) + 0.0  # +0.0 removes signed zero\n    return self._make_output_weights()",
      "asOf": "2026-11-20"
    },
    "F273": {
      "label": "Project source file, cvxpy",
      "display": "pypfopt/base/_base_optimizer.py",
      "asOf": "2026-11-20"
    },
    "F274": {
      "label": "Project full_name, cvxpy",
      "display": "PyPortfolio/PyPortfolioOpt",
      "asOf": "2026-11-20"
    },
    "F275": {
      "label": "Project stargazers_count, cvxpy",
      "display": "6.2K",
      "asOf": "2026-11-20"
    }
  },
  "dataCheckedAt": "2026-11-20",
  "agent": {
    "exaCall": {
      "endpoint": "/search",
      "body": {
        "query": "Best Python linear programming libraries PuLP OR-Tools highspy Python-MIP code examples",
        "numResults": 5
      },
      "docsUrl": "https://exa.ai/docs/reference/search"
    },
    "calls": []
  }
}
