1from cython.operator cimport dereference as deref 2cimport cpython.ref as cpy_ref 3from cpython.ref cimport PyObject 4from cylp.cy cimport CyClpSimplex 5from cylp.cy.CyCoinIndexedVector cimport CppCoinIndexedVector 6import numpy as np 7cimport numpy as np 8 9cdef extern from "ClpDualRowPivot.hpp": 10 cdef cppclass CyClpDualRowPivot "ClpDualRowPivot": 11 pass 12 CyClpDualRowPivot* new_CyClpDualRowPivot \ 13 "new ClpDualRowPivot" () 14 15cdef extern from "ClpFactorization.hpp": 16 cdef cppclass ClpFactorization: 17 int updateColumnTranspose (CppCoinIndexedVector * regionSparse, 18 CppCoinIndexedVector * regionSparse2) 19 20cdef extern from "IClpDualRowPivotBase.h": 21 #cdef cppclass CoinIndexedVector: 22 # pass 23 ctypedef int (*runPivotRow_t)(void *obj) 24 ctypedef CyClpDualRowPivot* (*runDualPivotClone_t)(void *obj, bint copyData) 25 ctypedef double (*runUpdateWeights_t)(void* obj, 26 CppCoinIndexedVector* inp, 27 CppCoinIndexedVector* spare, 28 CppCoinIndexedVector* spare2, 29 CppCoinIndexedVector* updatedColumn) 30 31 ctypedef void (*runUpdatePrimalSolution_t)(void* obj, 32 CppCoinIndexedVector * inp, 33 double theta, 34 double * changeInObjective) 35 36 cdef cppclass CppClpDualRowPivotBase: 37 CyClpSimplex.CppIClpSimplex* model() 38 void setModel(CyClpSimplex.CppIClpSimplex* m) 39 CppClpDualRowPivotBase(PyObject* obj, 40 runPivotRow_t runPivotRow, 41 runDualPivotClone_t runDualPivotClone, 42 runUpdateWeights_t runUpdateWeights, 43 runUpdatePrimalSolution_t runUpdatePrimalSolution) 44 45 int pivotRow() 46 47 CyClpDualRowPivot* clone(bint copyData) 48 double updateWeights(CppCoinIndexedVector* inp, 49 CppCoinIndexedVector* spare, 50 CppCoinIndexedVector* spare2, 51 CppCoinIndexedVector* updatedColumn) 52 53 void updatePrimalSolution(CppCoinIndexedVector * inp, 54 double theta, 55 double * changeInObjective) 56 57 58 59cdef int RunPivotRow(void *ptr) 60 61cdef CyClpDualRowPivot* RunDualPivotClone(void *ptr, bint copyData) 62cdef double RunUpdateWeights(void *ptr, CppCoinIndexedVector* inp, 63 CppCoinIndexedVector* spare, 64 CppCoinIndexedVector* spare2, 65 CppCoinIndexedVector* updatedColumn) 66cdef void RunUpdatePrimalSolution(void *ptr, 67 CppCoinIndexedVector * inp, 68 double theta, 69 double * changeInObjective) 70 71 72cdef class CyClpDualRowPivotBase: 73 cdef CppClpDualRowPivotBase* CppSelf 74 cdef CyClpSimplex.CyClpSimplex cyModel 75 #cpdef cyModel 76 cdef pivotRow(self) 77 78 cdef CyClpDualRowPivot * clone(self, bint copyData) 79 cdef double updateWeights(self, CppCoinIndexedVector* inp, 80 CppCoinIndexedVector* spare, 81 CppCoinIndexedVector* spare2, 82 CppCoinIndexedVector* updatedColumn) 83 cdef void updatePrimalSolution(self, CppCoinIndexedVector * inp, 84 double theta, 85 np.ndarray[np.double_t,ndim=1] changeInObjective) 86 cdef CyClpSimplex.CppIClpSimplex* model(self) 87 cdef void setModel(self, CyClpSimplex.CppIClpSimplex* m) 88 cdef double* getReducedCosts(self) 89