casl.pxd 5.82 KB
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

cimport libc.stdio

cdef extern from "asl.h":

    ctypedef long fint

    ctypedef struct SputInfo:
        fint *hcolstarts;
        fint *hrownos
        size_t *hcs[2]
        int *hrn[2]
        ssize_t *ulinc
        ssize_t *ulcopy
        ssize_t *ulinc0
        ssize_t *ulcopy0
        ssize_t *ulcend
        ssize_t nod
        int nobj
        int ow
        int y
        int khinfo
        int khinfob
        int uptri
        int *uptolow
        size_t *hcolstartsZ

    ctypedef struct cgrad:
        double coef
        cgrad *next
        int varno
        int goff

    ctypedef struct ograd:
        double coef
        ograd *next
        int varno
    
    ctypedef struct Edaginfo:
        int ASLtype
        int amplflag_
        int need_nl_
        int nlmode
        void *funcs_
        void *funcsfirst_
        void *funcslast_
        void *xscanf_
        void *fhash_[23]
        double *adjoints_
        double *adionts_nv1_
        double* LUrhs_
        double* Urhsx_
        double* X0_
        double* LUv_
        double* Uvx_
        double* Lastx_
        double* pi0_
        char* objtype_
        char* havex0_
        char* havepi0_
        double* A_vals_
        int* A_rownos_
        int* A_colstarts_
        size_t* A_colstartsZ_
        cgrad** Cgrad_
        ograd** Ograd_
        cgrad** Cgrad0
        int Fortran_
        int amax_        
        int c_vars_
        int comb_
        int combc_
        int comc1_
        int comc_
        int como1_
        int como_
        int lnc_         
        int nbv_          
        int niv_          
        int nlc_         
        int n_eqn_
        int n_cc_
        int nlcc_
        int ndcc_
        int nzlb_
        int nlnc_
        int nlo_
        int nlvb_
        int nlvc_
        int nlvo_
        int nlvbi_
        int nlvci_
        int nlvoi_
        int nwv_
        int nzc_
        int nzo_
        int n_var_
        int n_con_
        int n_obj_
        int n_prob
        int n_lcon_
        int flags
        int n_conjac_[2]        
        int nclcon_
        int ncom0_
        int ncom1_
        int nderps_
        int nfunc_
        int o_vars_
        int want_deriv_
        int x0kind_
        int rflags
        size_t  nzjac_
        size_t  x0len_
        size_t  nZc_
        size_t  nZo_
        char    *filename_
        char    *stub_end_
        void    *archan_
        void    *awchan_
        int binary_nl_
        int return_nofile_
        int plterms_
        int maxrownamelen_
        int maxcolnamelen_
        int co_index_
        int cv_index_
        void *err_jmp_                    
        void *err_jmp1_
        fint    ampl_options_[10]
        fint    obj_no_
        int nranges_
        int want_xpi0_
        int *c_cexp1st_
        int *o_cexp1st_
        int *cvar_

    ctypedef struct ASLhead:
        ASLhead *next
        ASLhead *prev

    ctypedef struct Edagpars:
        ASLhead h
        double hffactor
        int FUNNEL_MIN_
        int maxfwd_
        int need_funcadd_
        int vrefGulp_
        int want_derivs_
        int ihd_limit_
        int solve_code_

        double (*Objval)(ASL*, int, double*, fint *nerror)
        double   (*Objval_nomap)(ASL*, int nobj, double *X, fint *nerror);
        void   (*Objgrd)(ASL*, int, double*, double*, fint *nerror)
        void   (*Objgrd_nomap)(ASL*, int nobj, double *X, double *G, fint *nerror);
        void   (*Conval)(ASL*, double*, double *, fint *nerror)
        void   (*Jacval)(ASL*, double*, double*, fint *nerror)
        double   (*Conival)(ASL*, int ncon, double *X, fint *nerror);
        double   (*Conival_nomap)(ASL*, int ncon, double *X, fint *nerror);
        void   (*Congrd)(ASL*, int nc, double *X, double *G, fint *nerror);
        void   (*Congrd_nomap)(ASL*, int nc, double *X, double *G, fint *nerror);
        void   (*Hvcomp)(ASL*, double*, double*, int, double*, double*)
        void   (*Hvcomp_nomap)(ASL*, double *hv, double *p, int no, double *ow, double *y);
        void (*Hvinit)          (ASL*, int hid_limit, int nobj, double *ow, double *y);
        void (*Hvinit_nomap)    (ASL*, int hid_limit, int nobj, double *ow, double *y);
        void (*Hesset)          (ASL*, int flags, int no, int nno, int nc, int nnc);
        int  (*Lconval)         (ASL*, int ncon, double *X, fint *nerror);
        void (*Xknown)          (ASL*, double*, fint*nerror);
        void (*Duthes)          (ASL*, double *H, int nobj, double *ow, double *y);
        void (*Duthes_nomap)    (ASL*, double *H, int nobj, double *ow, double *y);
        void (*Fulhes)          (ASL*, double *H, int LH, int no, double *ow, double *y);
        void (*Fulhes_nomap)    (ASL*, double *H, int LH, int no, double *ow, double *y);
        void (*Sphes)           (ASL*, SputInfo**, double *H, int nobj, double *ow, double *y);
        void (*Sphes_nomap)     (ASL*, SputInfo**, double *H, int nobj, double *ow, double *y);
        fint (*Sphset)          (ASL*, SputInfo**, int nobj, int ow, int y, int uptri);
        fint (*Sphset_nomap)    (ASL*, SputInfo**, int nobj, int ow, int y, int uptri);
        
    ctypedef struct ASL:
        Edagpars p
        Edaginfo i
        
    ctypedef struct Option_Info:
        pass
    
    ASL* ASL_alloc(int)
    libc.stdio.FILE* jac0dim_ASL(ASL*, char *stub, long stub_len)
    int fgh_read_ASL(ASL*, libc.stdio.FILE*, int)
    int pfgh_read_ASL(ASL*, libc.stdio.FILE*, int)
    void write_sol_ASL(ASL*, const char *msg, double *x, double *y, Option_Info*)