1 #include "IClpDualRowPivotBase.h"
2 #include "ICoinIndexedVector.hpp"
3
4 int
pivotRow()5 CppClpDualRowPivotBase::pivotRow()
6 {
7 //std::cout << "::Cy..Base::pivotRow()...\n";
8 if (this->obj && this->runPivotRow) {
9 return this->runPivotRow(this->obj);
10 }
11 std::cerr << "** pivotRow: invalid cy-state: obj [" << this->obj << "] fct: ["
12 << this->runPivotRow << "]\n";
13 return -100;
14 }
15
clone(bool copyData) const16 ClpDualRowPivot * CppClpDualRowPivotBase::clone(bool copyData) const {
17 //std::cout << "::Cy..Base::clone()...\n";
18 if (this->obj && this->runDualPivotClone) {
19 return this->runDualPivotClone(this->obj,copyData);
20 }
21 std::cerr << "** clone: invalid cy-state: obj [" << this->obj << "] fct: ["
22 << this->runDualPivotClone << "]\n";
23 return NULL;
24 }
25
updateWeights(CoinIndexedVector * input,CoinIndexedVector * spare,CoinIndexedVector * spare2,CoinIndexedVector * updatedColumn)26 double CppClpDualRowPivotBase::updateWeights(CoinIndexedVector * input,
27 CoinIndexedVector * spare,
28 CoinIndexedVector * spare2,
29 CoinIndexedVector * updatedColumn) {
30 if (this->obj && this->runUpdateWeights) {
31 return this->runUpdateWeights(this->obj, input, spare, spare2, updatedColumn);
32 }
33 std::cerr << "** clone: invalid cy-state: obj [" << this->obj << "] fct: ["
34 << this->runUpdateWeights << "]\n";
35 return -1;
36 }
37
updatePrimalSolution(CoinIndexedVector * primalUpdate,double primalRatio,double & objectiveChange)38 void CppClpDualRowPivotBase::updatePrimalSolution(
39 CoinIndexedVector * primalUpdate,
40 double primalRatio,
41 double & objectiveChange){
42 if (this->obj && this->runUpdatePrimalSolution) {
43 return this->runUpdatePrimalSolution(this->obj, primalUpdate,
44 primalRatio, &objectiveChange);
45 }
46 std::cerr << "** clone: invalid cy-state: obj [" << this->obj << "] fct: ["
47 << this->runUpdatePrimalSolution << "]\n";
48 return;
49
50 }
51
52
CppClpDualRowPivotBase(PyObject * obj,runPivotRow_t runPivotRow,runDualPivotClone_t runDualPivotClone,runUpdateWeights_t runUpdateWeights,runUpdatePrimalSolution_t runUpdatePrimalSolution)53 CppClpDualRowPivotBase::CppClpDualRowPivotBase(PyObject *obj,
54 runPivotRow_t runPivotRow,
55 runDualPivotClone_t runDualPivotClone,
56 runUpdateWeights_t runUpdateWeights,
57 runUpdatePrimalSolution_t runUpdatePrimalSolution) :
58 obj(obj),
59 runPivotRow(runPivotRow),
60 runDualPivotClone(runDualPivotClone),
61 runUpdateWeights(runUpdateWeights),
62 runUpdatePrimalSolution(runUpdatePrimalSolution)
63 {
64 }
65
~CppClpDualRowPivotBase()66 CppClpDualRowPivotBase::~CppClpDualRowPivotBase()
67 {
68 }
69
setModel(IClpSimplex * m)70 void CppClpDualRowPivotBase::setModel(IClpSimplex* m)
71 {
72 ClpSimplex* s = static_cast<ClpSimplex*>(m);
73 model_ = s;
74 }
75
model()76 IClpSimplex* CppClpDualRowPivotBase::model()
77 {
78 return static_cast<IClpSimplex*> (model_);
79 }
80
81
82
83