← Back
Editing: _milp.cpython-311.pyc
� d�cK: � �x � d dl Z d dlZd dlmZmZ ddlmZ ddlm Z m Z ddlmZ ddl mZ d� Zd � Zddddd �d�ZdS )� N)� csc_array�vstack� )�_highs_wrapper)�LinearConstraint�Bounds)�OptimizeResult)�_highs_to_scipy_status_messagec � � d}g }g }g }t | t � � r| g} nt t | � � n"# t $ r}t |� � |�d}~ww xY wt | � � dk r. t | � g} n"# t t t j f$ r Y nw xY w| D ]�}t |t � � s- t |� }n"# t $ r}t |� � |�d}~ww xY w|� t |j � � � � |� t j |j � � � t j � � � � |� t j |j � � � t j � � � � ��t |� � dk r8t! |� � }t j |� � }t j |� � } n|d }|d }|d } ||| fS )a� Convert sequence of constraints to a single set of components A, b_l, b_u. `constraints` could be 1. A LinearConstraint 2. A tuple representing a LinearConstraint 3. An invalid object 4. A sequence of composed entirely of objects of type 1/2 5. A sequence containing at least one object of type 3 We want to accept 1, 2, and 4 and reject 3 and 5. �`constraints` (or each element within `constraints`) must be convertible into an instance of `scipy.optimize.LinearConstraint`.N� r r )� isinstancer �iter� TypeError� ValueError�len�np�VisibleDeprecationWarning�appendr �A� atleast_1d�lb�astype�double�ubr �concatenate) �constraints�message�As�b_ls�b_us�exc� constraintr �b_l�b_us �6/usr/lib/python3/dist-packages/scipy/optimize/_milp.py�_constraints_to_componentsr'