Ë
    WËhN  ã                   óP   — d Z ddlZddlmZmZmZmZ ddlm	Z	m
Z
 d„ Zd„ Zd„ Zd	„ Zy)
a  
This is a module evaluating the objective/constraint function with Nan/Inf handling.

Translated from Zaikun Zhang's modern-Fortran reference implementation in PRIMA.

Dedicated to late Professor M. J. D. Powell FRS (1936--2015).

Python translation by Nickolai Belakovski.
é    Né   )ÚFUNCMAXÚ	CONSTRMAXÚREALMAXÚ	DEBUGGING)ÚmatprodÚprimasumc                 óv   — d| t        j                  | «      <   t        j                  | t         t        «      } | S )zq
    This function moderates a decision variable. It replaces NaN by 0 and Inf/-Inf by
    REALMAX/-REALMAX.
    r   )ÚnpÚisnanÚclipr   )Úxs    ú\/var/www/html/jupyter_env/lib/python3.12/site-packages/scipy/_lib/pyprima/common/evaluate.pyÚ	moderatexr      s.   € ð
 €A„b‡hhˆqƒkNÜ
‰”G8œWÓ%€AØ€Hó    c                 ó€   — t        j                  | «      rt        n| } t        j                  | t         t        «      } | S )z‹
    This function moderates the function value of a MINIMIZATION problem. It replaces
    NaN and any value above FUNCMAX by FUNCMAX.
    )r   r   r   r   r   )Úfs    r   Ú	moderatefr      s0   € ô
 —8‘8˜A”; A€AÜ
‰”G8œWÓ%€Að €Hr   c                 ó~   — t        j                  | dt        ¬«       t        j                  | t         t        «      } | S )zß
    This function moderates the constraint value, the constraint demanding this value
    to be NONNEGATIVE. It replaces any value below -CONSTRMAX by -CONSTRMAX, and any
    NaN or value above CONSTRMAX by CONSTRMAX.
    F)ÚcopyÚnan)r   Ú
nan_to_numr   r   )Úcs    r   Ú	moderatecr   '   s-   € ô ‡MM!˜%¤YÕ/Ü
‰”I:œyÓ)€AØ€Hr   c                 óš  — |t        |«      nd}t        r t        t        j                  |«      «      rJ ‚t        j
                  ||z   «      }|t        ||j                  «      |z
  |d| t        t        j                  |«      «      r$t        |«      }t        j                  |«      |z  }n3 | t        |«      «      \  }||d t        |«      }t        ||d «      ||d t        rbt        j                  |«      st        j                  |«      rJ ‚t        t        j                  |«      t        j                  |«      z  «      rJ ‚||fS )z§
    This function evaluates CALCFC at X, returning the objective function value and the
    constraint value. Nan/Inf are handled by a moderated extreme barrier.
    Nr   )Úlenr   Úanyr   r   Úzerosr   ÚTr	   Úonesr   r   r   Úisposinf)Úcalcfcr   Úm_nlconÚamatÚbvecÚm_lconÚconstrr   s           r   Úevaluater(   2   s   € ð Ð*ŒSŒY°€Fõ ô ”r—x‘x “{Ô#Ð#Ð#ô X‰Xf˜wÑ&Ó'€FØÐÜ! ! T§V¡VÓ,¨tÑ3ˆˆwˆä
Œ28‰8A‹;Ôô Q‹KˆÜ—‘˜Ó! AÑ%‰á#¤I¨a£LÓ1Ñˆˆ6&'ˆ?ô
 a‹LˆÜ# F¨6¨7 OÓ4ˆˆvˆwˆõ ô —H‘H˜Q”K¤2§;¡;¨q¤>Ð2Ð2Ü”r—x‘x Ó'¬"¯+©+°fÓ*=Ñ=Ô>Ð>Ð>àˆfˆ9Ðr   )Ú__doc__Únumpyr   Úconstsr   r   r   r   Úlinalgr   r	   r   r   r   r(   © r   r   ú<module>r.      s,   ðñó ß :Ó :ß %ò
ò	òó1r   