1 #include "Python.h" 2 #include <iostream> 3 using namespace std; 4 5 #include "ClpDualRowPivot.hpp" 6 #include "CoinIndexedVector.hpp" 7 #include "IClpSimplex.hpp" 8 //#include "ClpSimplex.hpp" 9 #include "ClpFactorization.hpp" 10 11 typedef int (*runPivotRow_t)(void *instance); 12 13 typedef ClpDualRowPivot* (*runDualPivotClone_t)(void *instance, bool copyData); 14 15 typedef double (*runUpdateWeights_t)(void *instance, 16 CoinIndexedVector * input, 17 CoinIndexedVector * spare, 18 CoinIndexedVector * spare2, 19 CoinIndexedVector * updatedColumn); 20 21 typedef void (*runUpdatePrimalSolution_t)(void *instance, 22 CoinIndexedVector * input, 23 double theta, 24 double * changeInObjective); 25 26 27 28 class CppClpDualRowPivotBase : public ClpDualRowPivot 29 { 30 public: 31 PyObject *obj; 32 runPivotRow_t runPivotRow; 33 runDualPivotClone_t runDualPivotClone; 34 runUpdateWeights_t runUpdateWeights; 35 runUpdatePrimalSolution_t runUpdatePrimalSolution; 36 37 //IClpSimplex model_; 38 39 CppClpDualRowPivotBase(PyObject *obj, runPivotRow_t , 40 runDualPivotClone_t , runUpdateWeights_t, runUpdatePrimalSolution_t ); 41 virtual ~CppClpDualRowPivotBase(); 42 43 virtual ClpDualRowPivot * clone(bool copyData = true) const; 44 //virtual void saveWeights(IClpSimplex * model,int mode); 45 virtual double updateWeights(CoinIndexedVector * input, 46 CoinIndexedVector * spare, 47 CoinIndexedVector * spare2, 48 CoinIndexedVector * updatedColumn); 49 50 virtual void updatePrimalSolution(CoinIndexedVector * input, 51 double theta, 52 double& changeInObjective); 53 54 virtual int pivotRow(); 55 56 void setModel(IClpSimplex* m); 57 IClpSimplex* model(); 58 }; 59 60 61