403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.37
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/scipy/optimize/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/scipy/optimize/tests/__pycache__/test_constraints.cpython-311.pyc
�

d�c� ���ddlZddlZddlmZmZddlmZddl	m
Z
mZmZm
Z
mZmZmZGd�de��Zd�Zd�Zd�Zd	�ZGd
�d��ZGd�d
��ZdS)�N)�TestCase�assert_array_equal)�Bounds�LinearConstraint�NonlinearConstraint�PreparedConstraint�new_bounds_to_old�old_bound_to_new�
strict_boundsc�&�eZdZd�Zd�Zd�Zd�ZdS)�TestStrictBoundsc��d}d}d}d}t||||��\}}t|tjtjtjg��t|tjtjtjg��d}t||||��\}}t|gd���t|gd���dS)N���FT)rrr)rrr�rr�np�inf��self�m�lb�ub�enforce_feasibility�	strict_lb�	strict_ubs       �G/usr/lib/python3/dist-packages/scipy/optimize/tests/test_constraints.py�+test_scalarvalue_unique_enforce_feasibilityz<TestStrictBounds.test_scalarvalue_unique_enforce_feasibilitys���
��
��
��#��,�R��-@�-.� 0� 0��	�9�	�9���w����"�&��&A�B�B�B��9�r�v�r�v�r�v�&>�?�?�?�"��,�R��-@�-.� 0� 0��	�9�	�9�i�i�i�0�0�0��9�i�i�i�0�0�0�0�0�c��d}gd�}gd�}d}t||||��\}}t|tjtjtjg��t|tjtjtjg��d}t||||��\}}t|gd���t|gd���dS)Nr��rr)r��FTrrs       r�+test_vectorvalue_unique_enforce_feasibilityz<TestStrictBounds.test_vectorvalue_unique_enforce_feasibilitys���
��
�Y�Y��
�Y�Y��#��,�R��.A�./� 1� 1��	�9�	�9���w����"�&��&A�B�B�B��9�r�v�r�v�r�v�&>�?�?�?�"��,�R��.A�./� 1� 1��	�9�	�9�i�i�i�0�0�0��9�i�i�i�0�0�0�0�0rc���d}d}d}gd�}t||||��\}}t|tjdtjg��t|tjdtjg��dS)Nrrr)FTFrrs       r�+test_scalarvalue_vector_enforce_feasibilityz<TestStrictBounds.test_scalarvalue_vector_enforce_feasibility/s}��
��
��
��2�2�2��,�R��-@�-.� 0� 0��	�9�	�9���w��B�F�7�&;�<�<�<��9�r�v�q�"�&�&9�:�:�:�:�:rc���d}gd�}ddtjg}gd�}t||||��\}}t|dtjdg��t|dtjtjg��dS)Nrr!rr$)TFTr")rrrrrs       r�+test_vectorvalue_vector_enforce_feasibilityz<TestStrictBounds.test_vectorvalue_vector_enforce_feasibility:s���
��
�Y�Y����B�F�^��1�1�1��,�R��-@�-.� 0� 0��	�9�	�9�q�2�6�'�1�o�6�6�6��9�q�"�&�"�&�&9�:�:�:�:�:rN)�__name__�
__module__�__qualname__rr%r'r)�rrr
r

sP������1�1�1�$1�1�1�$	;�	;�	;�	;�	;�	;�	;�	;rr
c����tjgd���}tjdtjdg��}tjgd���}tjgd�t���}t	|||��}tjtt||��tt	||��gd���}|�	gd���dk�
��sJ�|�	gd���dk���sJ�tjgd	���}tjgd	�gd
�gd�g���tjgd�t���}t�tjd|��}tjtt||��tt�tjd��gd	���}|�	gd	���dk�
��sJ�|�	gd
���dk���sJ��fd�}�fd�}d�}	t|tjd||	|��}
tjtt|
|��t|
gd
���}|�	gd	���dk�
��sJ�|�	gd
���dk���sJ�dS)N)r����?�Fr!)FTT)�dtyper)g�?��)r"rrr)r#rrr$)�r�r)TTT)���rr8rc�.����|��S�N)�dot��x�As �r�funz2test_prepare_constraint_infeasible_x0.<locals>.fun]s����u�u�Q�x�x�rc����Sr:r-r<s �r�jacz2test_prepare_constraint_infeasible_x0.<locals>.jac`s����rc�*�tjd��S)N)rr)�sps�
csr_matrix)r=�vs  r�hessz3test_prepare_constraint_infeasible_x0.<locals>.hesscs���~�f�%�%�%r)r�arrayr�boolr�pytest�raises�
ValueErrorr�	violation�any�allrr)rr�x0r�bounds�pc�linearr?rArF�	nonlinearr>s           @r�%test_prepare_constraint_infeasible_x0rTFs����	��+�+�+�	�	�B�	��3����#�	$�	$�B�	��)�)�)�	�	�B��(�#6�#6�#6�d�C�C�C��
�B��/�
0�
0�F�
�M�*�0�&�"�=�=�=�	�F�2�r�N�N�I�I�I�	6�	6�B��L�L����#�#�a�'�,�,�.�.�.�.�.��L�L����(�(�A�-�2�2�4�4�4�4�4�	��,�,�,�	�	�B�
��,�,�,����l�l�l�;�<�<�A��(�#5�#5�#5�T�B�B�B��
�a�"�&��!�-@�
A�
A�F�
�M�*�0�&�"�=�=�=�	�,�Q�����;�;�(�L�L�
*�
*�B��L�L����&�&��*�/�/�1�1�1�1�1��L�L�)�)�)�*�*�a�/�4�4�6�6�6�6�6�����������&�&�&�$�C�"�&��!�S�$�$7�9�9�I�
�M�*�0�)�R�@�@�@�	�I�'7�'7�'7�	8�	8�B��L�L����&�&��*�/�/�1�1�1�1�1��L�L�)�)�)�*�*�a�/�4�4�6�6�6�6�6�6�6rc�`�d�}t|ddgddg��}t|ddg��}t|�ddg��ddg��tj�|�ddg��dd	g��tj�|�ddg��d
dg��tj�|�d	dg��d
dg��tj�|�d	dg��ddg��dS)Nc�v�tj|ddz|dz|ddz|dz
g��S)Nrrr")rrG)r=s r�cons_fztest_violation.<locals>.cons_fps9���x��1����Q�q�T�)�1�Q�4�1�9�q��t�+;�<�=�=�=r���g333333�rr1r"�g333333�?g�������?g{�G�z�?rg333333�gR���Q�?g{�G�z�?g=
ףp=�?)rrrrLr�testing�assert_almost_equal)rW�nlcrQs   r�test_violationr]os��>�>�>��f�r�7�m�a��V�
<�
<�C�	�C�#�q��	*�	*�B��r�|�|�S�!�H�-�-��B�x�8�8�8��J�"�"�2�<�<��c�
�#;�#;�b�#�Y�G�G�G��J�"�"�2�<�<��c�
�#;�#;�d�A�Y�G�G�G��J�"�"�2�<�<��d��#<�#<�t�Q�i�H�H�H��J�"�"�2�<�<��a��#9�#9�D�$�<�H�H�H�H�Hrc���tjtjddg��}tjdtjdg��}gd�}tt	||d��|��gd�}tt	d|d��|��gd�}tt	tj|d��|��gd�}tt	|d	d��|��gd
�}tt	|tjd��|��gd�}tt	ddd��|��gd
�}tt	tjtjd��|��dS)Nrr�
)�Nr�rN)rr_))rXr�rXN)rXr_rX)r`�NN)Nr_))Nr/)rr/)rr/r/)rcra)rN)�r"rrdrdr")rcrcrc)rrGrrr	)	rrrP�bounds_single_lb�bounds_no_lb�bounds_single_ub�bounds_no_ub�bounds_single_both�bounds_no_boths	         r�test_new_bounds_to_oldrk�sb��	��B�F�7�A�q�/�	"�	"�B�	��1�b�f�b�/�	"�	"�B�
,�
,�
,�F��(��R��3�3�V�<�<�<�6�6�6���(��R��3�3�5E�F�F�F�8�8�8�L��(�"�&��"�a�8�8�,�G�G�G�5�5�5���(��R��3�3�5E�F�F�F�7�7�7�L��(��R�V�Q�7�7��F�F�F�1�1�1���(��A�q�1�1�3E�F�F�F�?�?�?�N��(�"�&��"�&�!�<�<�n�M�M�M�M�Mrc��ddgddf}tjdtjdg��}tjddtjg��}t|��\}}t	||��t	||��tjtjftjdg��tjdg��fg}t|��\}}t	|tjdg��t	|tjdg��dS)Nr"rr`rbrXr)rrGrr
r)rP�lb_true�ub_truerrs     r�test_old_bounds_to_newro�s����!�f�i��
,�F��h��B�F�7�B�'�(�(�G��h��1�b�f�~�&�&�G�
�f�
%�
%�F�B���r�7�#�#�#��r�7�#�#�#���w����"�(�A�3�-�-���1�#���!?�
@�F�
�f�
%�
%�F�B���r�R�V�G�Q�<�(�(�(��r�B�F�A�;�'�'�'�'�'rc�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)�
TestBoundsc	�\�ddlm}m}ddtjdftjdtjg��tjdtjg��ftjdtjg��tjdtjg��tjddg��ffD]|}t	|�}tt
t	|�����}t|j|j��t|j	|j	��t|j
|j
���}dS)	Nr)rGr)��g@rsT��?g@F)�numpyrGrrr�eval�reprrrr�
keep_feasible)rrGr�argsrP�bounds2s      r�	test_reprzTestBounds.test_repr�s��$�$�$�$�$�$�$�$��
�2�6�4� �
�X�s�R�V�G�n�
%�
%�r�x��b�f�
�'>�'>�?�
�X�s�R�V�G�n�
%�
%�r�x��b�f�
�'>�'>�
�X�t�U�m�
$�
$�
&�	
�	L�	L�D��T�]�F��4���
�.�.�/�/�G��v�y�'�*�5�5�5��v�y�'�*�5�5�5��v�3�W�5J�K�K�K�K�	L�	Lrc��tddgddg���}t|jtj��sJ�t|jtj��sJ�dS)NrYrt)rr)r�
isinstancerr�ndarrayr)r�bs  r�
test_arrayzTestBounds.test_array�sV���s�C�j�c�3�Z�0�0�0���!�$��
�+�+�+�+�+��!�$��
�+�+�+�+�+�+�+rc��t��}ttjtj��tjtj����}|j|jksJ�|j|jksJ�dSr:)rr�asarrayrrr)r�b1�b2s   r�
test_defaultszTestBounds.test_defaults�sZ��
�X�X��
�B�J���w�'�'���B�F�);�);�
<�
<���u���~�~�~�~��u���~�~�~�~�~�~rc��d}tjt|���5tddggd���ddd��dS#1swxYwYdS)Nz6`lb`, `ub`, and `keep_feasible` must be broadcastable.��matchr"rr!)rIrJrKr)r�messages  r�test_input_validationz TestBounds.test_input_validation�s���J��
�]�:�W�
5�
5�
5�	&�	&��A�q�6�9�9�9�%�%�%�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&�	&�	&s�A�A�Ac��tdd��}ddg}tj�|�|��ddgddgf��dS)N���rrXrr"r#)rrrZ�assert_allclose�residual)rrPrOs   r�
test_residualzTestBounds.test_residual�sO����A�����!�W��
�
�"�"�6�?�?�2�#6�#6�!�Q��!�Q��8H�I�I�I�I�IrN)r*r+r,r{r�r�r�r�r-rrrqrq�sg������L�L�L� ,�,�,����&�&�&�
J�J�J�J�Jrrqc� �eZdZd�Zd�Zd�ZdS)�TestLinearConstraintc��tjd��}t|��}t|tjtj��}t	|j|j��t	|j|j��dS)Nr)r�eyerrrrr)rr>�lc�lc2s    rr�z"TestLinearConstraint.test_defaults�sa���F�1�I�I��
�a�
 �
 ���q�2�6�'�2�6�2�2���2�5�#�&�)�)�)��2�5�#�&�)�)�)�)�)rc�t�tjd��}d}tjt|���5t|ddggd���ddd��n#1swxYwYtjd��}d}tjt|���5t|��ddd��dS#1swxYwYdS)	Nrz5`lb`, `ub`, and `keep_feasible` must be broadcastabler�r"rr!)rrr#z%`A` must have exactly two dimensions.)rr�rIrJrKr�empty)rr>r�s   rr�z*TestLinearConstraint.test_input_validation�s5���F�1�I�I��I��
�]�:�W�
5�
5�
5�	3�	3��Q��A��	�	�	�2�2�2�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�
�H�Y����9��
�]�:�W�
5�
5�
5�	 �	 ��Q����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �	 �	 s#�A�A�A�B-�-B1�4B1c���tjd��}t|dd��}ddg}tj�|�|��ddgddgf��dS)Nrr�rrXr"r#)rr�rrZr�r�)rr>r�rOs    rr�z"TestLinearConstraint.test_residual�s^���F�1�I�I��
�a��Q�
'�
'���!�W��
�
�"�"�2�;�;�r�?�?�a��V�a��V�4D�E�E�E�E�ErN)r*r+r,r�r�r�r-rrr�r��sF������*�*�*�	 �	 �	 �F�F�F�F�Frr�)rIrur�
numpy.testingrr�scipy.sparse�sparserC�scipy.optimize._constraintsrrrrr	r
rr
rTr]rkrorqr�r-rr�<module>r�sy��
�
�
�
�����6�6�6�6�6�6�6�6�������8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�
9;�9;�9;�9;�9;�x�9;�9;�9;�x&7�&7�&7�RI�I�I�$N�N�N�4
(�
(�
(� %J�%J�%J�%J�%J�%J�%J�%J�PF�F�F�F�F�F�F�F�F�Fr

Youez - 2016 - github.com/yon3zu
LinuXploit