← Back
Editing: _linprog.cpython-311.pyc
� d�cs � �� � d Z ddlZddlmZmZ ddlmZ ddlmZ ddl m Z ddl m Z dd lmZ dd lm Z mZmZmZmZmZ ddlmZmZmZmZmZmZmZmZ ddlmZ g d �ZdZg d�Z d� Z!d� Z" dd�Z#dS )z� A top-level linear programming interface. .. versionadded:: 0.15.0 Functions --------- .. autosummary:: :toctree: generated/ linprog linprog_verbose_callback linprog_terse_callback � N� )�OptimizeResult�OptimizeWarning)�warn)�_linprog_highs)�_linprog_ip)�_linprog_simplex)�_linprog_rs)�_linprog_highs_doc�_linprog_ip_doc�_linprog_rs_doc�_linprog_simplex_doc�_linprog_highs_ipm_doc�_linprog_highs_ds_doc)�_parse_linprog� _presolve�_get_Abc� _LPProblem� _autoscale� _postsolve� _check_result�_display_summary)�deepcopy)�linprog�linprog_verbose_callback�linprog_terse_callbackzrestructuredtext en)�simplex�revised simplex�interior-point�highs�highs-ds� highs-ipmc � � | d }| d }| d }| d }| d }| d }| d }t j � � }t j dd d � i�� � |rAt d� � t d � |� � � � t |� � nV|r2t d� � t d� |� � � � n"t d� |� � � � |dk rp|dk rt d� � nt d� � t d|� � t � � t d� � t d|� � t � � t j di |�� dS )a� A sample callback function demonstrating the linprog callback interface. This callback produces detailed output to sys.stdout before each iteration and after the final iteration of the simplex algorithm. Parameters ---------- res : A `scipy.optimize.OptimizeResult` consisting of the following fields: x : 1-D array The independent variable vector which optimizes the linear programming problem. fun : float Value of the objective function. success : bool True if the algorithm succeeded in finding an optimal solution. slack : 1-D array The values of the slack variables. Each slack variable corresponds to an inequality constraint. If the slack is zero, then the corresponding constraint is active. con : 1-D array The (nominally zero) residuals of the equality constraints, that is, ``b - A_eq @ x`` phase : int The phase of the optimization being executed. In phase 1 a basic feasible solution is sought and the T has an additional row representing an alternate objective function. status : int An integer representing the exit status of the optimization:: 0 : Optimization terminated successfully 1 : Iteration limit reached 2 : Problem appears to be infeasible 3 : Problem appears to be unbounded 4 : Serious numerical difficulties encountered nit : int The number of iterations performed. message : str A string descriptor of the exit status of the optimization. �x�fun�phase�status�nit�message�completei� �floatc �, � d� | � � S )Nz {0: 12.4f})�format)r$ s �9/usr/lib/python3/dist-packages/scipy/optimize/_linprog.py�<lambda>z*linprog_verbose_callback.<locals>.<lambda>\ s � �l�6I�6I�!�6L�6L� � )� linewidth� formatterz%--------- Simplex Early Exit ------- z1The simplex method exited early with status {0:d}z$--------- Simplex Complete -------- zIterations required: {}z%--------- Iteration {0:d} --------- r r zCurrent Pseudo-Objective Value:zCurrent Objective Value:zf = zCurrent Solution Vector:zx = N� )�np�get_printoptions�set_printoptions�printr- ) �resr$ r% r&