Cgl  0.60.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CoinAbcBaseFactorization.hpp
Go to the documentation of this file.
1 /* $Id: CoinAbcBaseFactorization.hpp 2385 2019-01-06 19:43:06Z unxusr $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 /*
7  Authors
8 
9  John Forrest
10 
11  */
18 #include "AbcCommon.hpp"
20 #if ABC_PARALLEL
21 #define FACTOR_CPU 4
22 #else
23 #define FACTOR_CPU 1
24 #endif
25 #define LARGE_SET COIN_INT_MAX - 10
26 #define LARGE_UNSET (LARGE_SET + 1)
27 
29  friend void CoinAbcFactorizationUnitTest(const std::string &mpsDir);
30 
31 public:
40 
42  virtual ~CoinAbcTypeFactorization();
44  virtual CoinAbcAnyFactorization *clone() const;
46  void almostDestructor();
48  void show_self() const;
50  void sort() const;
54 
59 
61 
64  inline CoinSimplexInt *permute() const
66  {
67  return NULL; //permute_.array();
68  }
70  virtual inline CoinSimplexInt *indices() const
71  {
72  return indexRowU_.array();
73  }
75  virtual inline CoinSimplexInt *pivotColumn() const
76  {
77  return pivotColumn_.array();
78  }
80  virtual inline CoinFactorizationDouble *pivotRegion() const
81  {
82  return pivotRegionAddress_;
83  }
84 #if ABC_SMALL < 2
85  inline CoinBigIndex *startRowL() const
87  {
88  return startRowL_.array();
89  }
90 #endif
91 
93  inline CoinBigIndex *startColumnL() const
94  {
95  return startColumnL_.array();
96  }
97 
98 #if ABC_SMALL < 2
99  inline CoinSimplexInt *indexColumnL() const
101  {
102  return indexColumnL_.array();
103  }
104 #endif
105 
107  inline CoinSimplexInt *indexRowL() const
108  {
109  return indexRowL_.array();
110  }
111 
112 #if ABC_SMALL < 2
113  inline CoinFactorizationDouble *elementByRowL() const
115  {
116  return elementByRowL_.array();
117  }
118 #endif
119 
123  {
124  return firstCount_.array() + numberRows_ + 1;
125  }
127  {
128  return firstCount_.array() + 2 * numberRows_ + 3;
129  }
130  inline CoinSimplexInt *pivotLOrder() const
131  {
132  return firstCount_.array();
133  }
134 #if ABC_SMALL < 0
135 #define ABC_USE_FUNCTION_POINTERS 0
136 #define SMALL_PERMUTE
137 #endif
138 #ifdef ABC_USE_FUNCTION_POINTERS
140 #if ABC_USE_FUNCTION_POINTERS
141  typedef struct {
142  scatterUpdate functionPointer;
143  CoinBigIndex offset;
144  int number;
145  } scatterStruct;
146 #else
147  typedef struct {
148  CoinBigIndex offset;
149  int number;
150  } scatterStruct;
151 #endif
152  inline scatterStruct *scatterUColumn() const
154  {
155  return scatterPointersUColumnAddress_;
156  }
157 #endif
158 
160 
163  inline CoinSimplexInt *firstCount() const
164  {
165  return firstCount_.array();
166  }
167 
169  inline CoinSimplexInt *nextCount() const
170  {
171  return firstCount_.array() + numberRows_ + 2;
172  }
173 
175  inline CoinSimplexInt *lastCount() const
176  {
177  return firstCount_.array() + 3 * numberRows_ + 2;
178  }
179 
182  {
183  return numberRowsExtra_;
184  }
186  inline CoinBigIndex numberL() const
187  {
188  return numberL_;
189  }
190 
192  inline CoinBigIndex baseL() const
193  {
194  return baseL_;
195  }
198  {
199  return maximumRowsExtra_;
200  }
202  virtual inline CoinBigIndex numberElements() const
203  {
204  return totalElements_;
205  }
208  {
210  }
215  {
216  return messageLevel_;
217  }
218  void messageLevel(CoinSimplexInt value);
220  virtual void maximumPivots(CoinSimplexInt value);
221 
222 #if ABC_SMALL < 4
223  inline CoinSimplexInt denseThreshold() const
225  {
226  return denseThreshold_;
227  }
230  {
231  denseThreshold_ = value;
232  }
233 #endif
236 #if 0
237  inline bool forrestTomlin() const
239  { return doForrestTomlin_;}
240  inline void setForrestTomlin(bool value)
241  { doForrestTomlin_=value;}
242 #endif
243  inline bool spaceForForrestTomlin() const
245  {
247  CoinBigIndex space = lengthAreaU_ - (start + numberRowsExtra_);
248  return (space >= 0); //&&doForrestTomlin_;
249  }
251 
254 
257  {
258  return lengthU_;
259  }
261  inline void setNumberElementsU(CoinBigIndex value)
262  {
263  lengthU_ = value;
264  }
266  inline CoinBigIndex lengthAreaU() const
267  {
268  return lengthAreaU_;
269  }
272  {
273  return lengthL_;
274  }
276  inline CoinBigIndex lengthAreaL() const
277  {
278  return lengthAreaL_;
279  }
282  {
283  return lengthR_;
284  }
287  {
288  return numberCompressions_;
289  }
291  //virtual CoinSimplexInt * pivotRow() const;
293  //virtual CoinFactorizationDouble * workArea() const;
295  //virtual CoinSimplexInt * intWorkArea() const;
297  virtual inline CoinBigIndex *starts() const
298  {
299  return startColumnU_.array();
300  }
302  virtual inline CoinSimplexInt *numberInRow() const
303  {
304  return numberInRow_.array();
305  }
307  virtual inline CoinSimplexInt *numberInColumn() const
308  {
309  return numberInColumn_.array();
310  }
312  virtual inline CoinFactorizationDouble *elements() const
313  {
314  return elementU_.array();
315  }
317  inline CoinBigIndex *startColumnR() const
318  {
319  return reinterpret_cast< CoinBigIndex * >(firstCount_.array() + 3 * numberRows_ + 4);
320  }
323  {
324  return elementU_.array();
325  }
327  inline CoinSimplexInt *indexRowU() const
328  {
329  return indexRowU_.array();
330  }
332  inline CoinBigIndex *startColumnU() const
333  {
334  return startColumnU_.array();
335  }
336 #if COIN_BIG_DOUBLE == 1
337  void toLongArray(CoinIndexedVector *vector, int which) const;
340  void fromLongArray(CoinIndexedVector *vector) const;
342  void fromLongArray(int which) const;
344  long double *denseVector(CoinIndexedVector *vector) const;
346  long double *denseVector(CoinIndexedVector &vector) const;
348  const long double *denseVector(const CoinIndexedVector *vector) const;
350  const long double *denseVector(const CoinIndexedVector &vector) const;
352  void scan(CoinIndexedVector *vector) const;
354  void clearHiddenArrays();
355 #else
356  inline double *denseVector(CoinIndexedVector *vector) const
358  {
359  return vector->denseVector();
360  }
361  inline double *denseVector(CoinIndexedVector &vector) const
362  {
363  return vector.denseVector();
364  }
366  inline const double *denseVector(const CoinIndexedVector *vector) const
367  {
368  return vector->denseVector();
369  }
370  inline const double *denseVector(const CoinIndexedVector &vector) const
371  {
372  return vector.denseVector();
373  }
375  inline void toLongArray(CoinIndexedVector *vector, int which) const {}
377  inline void fromLongArray(CoinIndexedVector *vector) const {}
379  inline void fromLongArray(int which) const {}
381  inline void scan(CoinIndexedVector *vector) const
382  {
383  vector->scan(0, numberRows_, zeroTolerance_);
384  }
385 #endif
386 #ifdef ABC_ORDERED_FACTORIZATION
387  void permuteInForFtran(CoinIndexedVector &regionSparse, bool full = false) const;
390  void permuteInForBtranAndMultiply(CoinIndexedVector &regionSparse, bool full = false) const;
392  void permuteOutForBtran(CoinIndexedVector &regionSparse) const;
393 #endif
394 
399  //inline CoinSimplexInt persistenceFlag() const
400  //{ return persistenceFlag_;}
402 
405 #if 0
406 
410  virtual int checkReplace ( const AbcSimplex * model,
411  CoinIndexedVector * regionSparse,
412  int pivotRow,
413  CoinSimplexDouble & pivotCheck,
414  double acceptablePivot = 1.0e-8);
419  virtual CoinSimplexInt replaceColumn ( CoinIndexedVector * regionSparse,
421  CoinSimplexDouble pivotCheck ,
422  bool skipBtranU=false,
423  CoinSimplexDouble acceptablePivot=1.0e-8);
424 #endif
425 
429  virtual
430 #ifdef ABC_LONG_FACTORIZATION
431  long
432 #endif
433  double
434  checkReplacePart1(CoinIndexedVector *regionSparse,
435  int pivotRow);
440  virtual
441 #ifdef ABC_LONG_FACTORIZATION
442  long
443 #endif
444  double
445  checkReplacePart1(CoinIndexedVector *regionSparse,
446  CoinIndexedVector *partialUpdate,
447  int pivotRow);
448 #ifdef MOVE_REPLACE_PART1A
449 
453  virtual void checkReplacePart1a(CoinIndexedVector *regionSparse,
454  int pivotRow);
455  virtual
456 #ifdef ABC_LONG_FACTORIZATION
457  long
458 #endif
459  double
461  int pivotRow);
462 #endif
463 
465  virtual int checkReplacePart2(int pivotRow,
466  CoinSimplexDouble btranAlpha,
467  double ftranAlpha,
468 #ifdef ABC_LONG_FACTORIZATION
469  long
470 #endif
471  double ftAlpha,
472  double acceptablePivot = 1.0e-8);
475  virtual void replaceColumnPart3(const AbcSimplex *model,
476  CoinIndexedVector *regionSparse,
477  CoinIndexedVector *tableauColumn,
478  int pivotRow,
479 #ifdef ABC_LONG_FACTORIZATION
480  long
481 #endif
482  double alpha);
485  virtual void replaceColumnPart3(const AbcSimplex *model,
486  CoinIndexedVector *regionSparse,
487  CoinIndexedVector *tableauColumn,
488  CoinIndexedVector *partialUpdate,
489  int pivotRow,
490 #ifdef ABC_LONG_FACTORIZATION
491  long
492 #endif
493  double alpha);
494 #ifdef EARLY_FACTORIZE
495  virtual int replaceColumns(const AbcSimplex *model,
497  CoinIndexedVector &stuff,
498  int firstPivot, int lastPivot, bool cleanUp);
499 #endif
500  void updatePartialUpdate(CoinIndexedVector &partialUpdate);
503  inline virtual bool wantsTableauColumn() const
504  {
505  return false;
506  }
510  int replaceColumnU(CoinIndexedVector *regionSparse,
511  CoinBigIndex *deletedPosition,
512  CoinSimplexInt *deletedColumns,
515 
518 
520 
526  virtual CoinSimplexInt updateColumnFT(CoinIndexedVector &regionSparse);
527  virtual int updateColumnFTPart1(CoinIndexedVector &regionSparse);
528  virtual void updateColumnFTPart2(CoinIndexedVector &regionSparse);
532  virtual void updateColumnFT(CoinIndexedVector &regionSparseFT,
533  CoinIndexedVector &partialUpdate,
534  int which);
537  virtual CoinSimplexInt updateColumn(CoinIndexedVector &regionSparse) const;
544  CoinIndexedVector &regionOther);
549  virtual CoinSimplexInt updateColumnTranspose(CoinIndexedVector &regionSparse) const;
551  virtual void updateFullColumn(CoinIndexedVector &regionSparse) const;
553  virtual void updateFullColumnTranspose(CoinIndexedVector &regionSparse) const;
555  virtual void updateWeights(CoinIndexedVector &regionSparse) const;
557  virtual void updateColumnCpu(CoinIndexedVector &regionSparse, int whichCpu) const;
559  virtual void updateColumnTransposeCpu(CoinIndexedVector &regionSparse, int whichCpu) const;
560  void unpack(CoinIndexedVector *regionFrom,
561  CoinIndexedVector *regionTo) const;
562  void pack(CoinIndexedVector *regionFrom,
563  CoinIndexedVector *regionTo) const;
565  inline void goSparse() {}
566  void goSparse2();
567 #ifndef NDEBUG
568  virtual void checkMarkArrays() const;
569 #endif
570 #if ABC_SMALL < 2
571 
573  {
574  return sparseThreshold_;
575  }
576 #endif
577 
578  void sparseThreshold(CoinSimplexInt value);
580 
585  inline void clearArrays()
587  {
589  }
591 
592  void checkSparse();
595  void gutsOfDestructor(CoinSimplexInt type = 1);
597  void gutsOfInitialize(CoinSimplexInt type);
598  void gutsOfCopy(const CoinAbcTypeFactorization &other);
599 
601  void resetStatistics();
602  void printRegion(const CoinIndexedVector &vector, const char *where) const;
603 
605 
607  virtual void getAreas(CoinSimplexInt numberRows,
609  CoinSimplexInt numberColumns,
610  CoinBigIndex maximumL,
611  CoinBigIndex maximumU);
612 
614  virtual void preProcess();
617  double preProcess3();
618  void preProcess4();
620  virtual CoinSimplexInt factor(AbcSimplex *model);
621 #ifdef EARLY_FACTORIZE
622  virtual int factorize(AbcSimplex *model, CoinIndexedVector &stuff);
624 #endif
625  virtual void postProcess(const CoinSimplexInt *sequence, CoinSimplexInt *pivotVariable);
628  virtual void makeNonSingular(CoinSimplexInt *sequence);
629 
630 protected:
637 
651  int wantToGoDense();
652 
657  bool getColumnSpace(CoinSimplexInt iColumn,
658  CoinSimplexInt extraNeeded);
659 
662  bool reorderU();
667  CoinSimplexInt iRow);
674  CoinSimplexInt iRow);
678  bool getRowSpace(CoinSimplexInt iRow, CoinSimplexInt extraNeeded);
679 
684  CoinSimplexInt extraNeeded);
686  void checkConsistency();
687 //#define CHECK_LINKS
688 #ifdef CHECK_LINKS
689  void checkLinks(int x = 0);
690 #else
691 #define checkLinks(x)
692 #endif
693  inline void addLink(CoinSimplexInt index, CoinSimplexInt count)
695  {
699  CoinSimplexInt next = firstCount[count];
700  firstCount[count] = index;
701  nextCount[index] = next;
702  lastCount[index] = count - numberRows_ - 2; // points to firstCount[count]
703  if (next >= 0)
704  lastCount[next] = index;
705  }
707  inline void deleteLink(CoinSimplexInt index)
708  {
711  CoinSimplexInt next = nextCount[index];
712  CoinSimplexInt last = lastCount[index];
713  assert(next != index);
714  assert(last != index);
715  if (next >= 0)
716  lastCount[next] = last;
717  if (last >= 0) {
718  nextCount[last] = next;
719  } else {
720  int count = last + numberRows_ + 2;
722  firstCount[count] = next;
723  }
724  }
726  inline void modifyLink(CoinSimplexInt index, CoinSimplexInt count)
727  {
731  CoinSimplexInt next2 = firstCount[count];
732  if (next2 == index)
733  return;
734  firstCount[count] = index;
735  CoinSimplexInt next = nextCount[index];
736  CoinSimplexInt last = lastCount[index];
737  assert(next != index);
738  assert(last != index);
739  nextCount[index] = next2;
740  lastCount[index] = count - numberRows_ - 2; // points to firstCount[count]
741  if (next >= 0)
742  lastCount[next] = last;
743  if (next2 >= 0)
744  lastCount[next2] = index;
745  if (last >= 0) {
746  nextCount[last] = next;
747  } else {
748  int count = last + numberRows_ + 2;
749  firstCount[count] = next;
750  }
751  }
753  void separateLinks();
756  void cleanup();
758  void doAddresses();
759 
761  void updateColumnL(CoinIndexedVector *region
762 #if ABC_SMALL < 2
763  ,
764  CoinAbcStatistics &statistics
765 #endif
766 #if ABC_PARALLEL
767  ,
768  int whichSparse = 0
769 #endif
770  ) const;
772  void updateColumnLDensish(CoinIndexedVector *region) const;
774  void updateColumnLDense(CoinIndexedVector *region) const;
777 #if ABC_PARALLEL
778  ,
779  int whichSparse
780 #endif
781  ) const;
782 
784  void updateColumnR(CoinIndexedVector *region
785 #if ABC_SMALL < 2
786  ,
787  CoinAbcStatistics &statistics
788 #endif
789 #if ABC_PARALLEL
790  ,
791  int whichSparse = 0
792 #endif
793  ) const;
795  bool storeFT(
796 #if ABC_SMALL < 3
797  const
798 #endif
799  CoinIndexedVector *regionFT);
801  void updateColumnU(CoinIndexedVector *region
802 #if ABC_SMALL < 2
803  ,
804  CoinAbcStatistics &statistics
805 #endif
806 #if ABC_PARALLEL
807  ,
808  int whichSparse = 0
809 #endif
810  ) const;
811 
813  void updateColumnUSparse(CoinIndexedVector *regionSparse
814 #if ABC_PARALLEL
815  ,
816  int whichSparse
817 #endif
818  ) const;
820  void updateColumnUDensish(CoinIndexedVector *regionSparse) const;
822  void updateColumnUDense(CoinIndexedVector *regionSparse) const;
825  CoinSimplexInt &numberNonZero1,
828  CoinSimplexInt &numberNonZero2,
830  CoinSimplexInt *COIN_RESTRICT index2) const;
832  void updateColumnPFI(CoinIndexedVector *regionSparse) const;
834  void updateColumnTransposePFI(CoinIndexedVector *region) const;
838  CoinSimplexInt smallestIndex
839 #if ABC_SMALL < 2
840  ,
841  CoinAbcStatistics &statistics
842 #endif
843 #if ABC_PARALLEL
844  ,
845  int whichCpu
846 #endif
847  ) const;
851  CoinSimplexInt smallestIndex) const;
855 #if ABC_PARALLEL
856  ,
857  int whichSparse
858 #endif
859  ) const;
863  CoinSimplexInt smallestIndex) const;
864 
867 #if ABC_SMALL < 2
868  ,
869  CoinAbcStatistics &statistics
870 #endif
871  ) const;
876 
879 #if ABC_SMALL < 2
880  ,
881  CoinAbcStatistics &statistics
882 #endif
883 #if ABC_PARALLEL
884  ,
885  int whichSparse
886 #endif
887  ) const;
894 #if ABC_PARALLEL
895  ,
896  int whichSparse
897 #endif
898  ) const;
899 public:
906 
907 protected:
914  CoinBigIndex pivotRowPosition,
915  CoinBigIndex pivotColumnPosition,
918  CoinSimplexInt increment2,
919  int *COIN_RESTRICT markRow);
922  CoinBigIndex pivotRowPosition,
923  CoinBigIndex pivotColumnPosition,
924  int *COIN_RESTRICT markRow);
925 #if ABC_SMALL < 2
926 #define CONVERTROW 2
927 #elif ABC_SMALL < 4
928 #else
929 #undef ABC_DENSE_CODE
930 #define ABC_DENSE_CODE 0
931 #endif
932 
934 protected:
945 #ifdef ABC_USE_FUNCTION_POINTERS
946  scatterStruct *scatterPointersUColumnAddress_;
948  CoinFactorizationDouble *elementUColumnPlusAddress_;
949 #endif
951 #if CONVERTROW
953 #if CONVERTROW > 1
955 #endif
956 #endif
957 #if ABC_SMALL < 2
959 #endif
973  //CoinSimplexInt * saveColumnAddress2_;
979 #if ABC_SMALL < 2
981 #endif
992 #if ABC_SMALL < 4
994 #endif
998 #ifdef SMALL_PERMUTE
999  CoinSimplexInt *fromSmallToBigRow_;
1000  CoinSimplexInt *fromSmallToBigColumn_;
1001 #endif
1017 #if ABC_SMALL < 2
1020 #endif
1045 #ifdef ABC_USE_FUNCTION_POINTERS
1046  CoinBigIndex lastEntryByColumnUPlus_;
1049  CoinBigIndex lengthAreaUPlus_;
1050 #endif
1055 #if ABC_SMALL < 4
1058 #endif
1059 #if COIN_BIG_DOUBLE == 1
1063  mutable CoinIndexedVector *associatedVector_[FACTOR_CPU];
1064 #endif
1102 #ifdef ABC_USE_FUNCTION_POINTERS
1103  CoinArbitraryArrayWithLength scatterUColumn_;
1105 #endif
1106 #if CONVERTROW
1109 #if CONVERTROW > 1
1112 #endif
1113 #endif
1114 #if ABC_SMALL < 2
1117 #endif
1124 #if ABC_SMALL < 4
1127 #endif
1132 #if ABC_SMALL < 2
1141 #endif
1146  // last slack pivot row
1148 #if ABC_SMALL < 2
1149  mutable double ftranCountInput_;
1151  mutable double ftranCountAfterL_;
1152  mutable double ftranCountAfterR_;
1153  mutable double ftranCountAfterU_;
1157 #if FACTORIZATION_STATISTICS
1158  double ftranTwiddleFactor1_;
1159  double ftranTwiddleFactor2_;
1160 #endif
1162 #endif
1165 #if ABC_SMALL < 2
1166  mutable double ftranFTCountInput_;
1167  mutable double ftranFTCountAfterL_;
1168  mutable double ftranFTCountAfterR_;
1169  mutable double ftranFTCountAfterU_;
1173 #if FACTORIZATION_STATISTICS
1174  double ftranFTTwiddleFactor1_;
1175  double ftranFTTwiddleFactor2_;
1176 #endif
1178 #endif
1179 #if ABC_SMALL < 4
1182 #endif
1183 #if ABC_SMALL < 2
1184  mutable double btranCountInput_;
1185  mutable double btranCountAfterU_;
1186  mutable double btranCountAfterR_;
1187  mutable double btranCountAfterL_;
1191 #if FACTORIZATION_STATISTICS
1192  double btranTwiddleFactor1_;
1193  double btranTwiddleFactor2_;
1194 #endif
1196 #endif
1199 #if ABC_SMALL < 2
1200  mutable double ftranFullCountInput_;
1202  mutable double ftranFullCountAfterL_;
1203  mutable double ftranFullCountAfterR_;
1204  mutable double ftranFullCountAfterU_;
1208 #if FACTORIZATION_STATISTICS
1209  double ftranFullTwiddleFactor1_;
1210  double ftranFullTwiddleFactor2_;
1211 #endif
1213 #endif
1216 #if ABC_SMALL < 2
1217  mutable double btranFullCountInput_;
1219  mutable double btranFullCountAfterL_;
1220  mutable double btranFullCountAfterR_;
1221  mutable double btranFullCountAfterU_;
1225 #if FACTORIZATION_STATISTICS
1226  double btranFullTwiddleFactor1_;
1227  double btranFullTwiddleFactor2_;
1228 #endif
1230 #endif
1231 
1240 
1241 public:
1242 #if ABC_SMALL < 2
1243 #if ABC_SMALL >= 0
1244  inline bool gotLCopy() const
1245  {
1246  return ((state_ & ABC_FAC_GOT_LCOPY) != 0);
1247  }
1248  inline void setNoGotLCopy() { state_ &= ~ABC_FAC_GOT_LCOPY; }
1250  inline bool gotRCopy() const { return ((state_ & ABC_FAC_GOT_RCOPY) != 0); }
1251  inline void setNoGotRCopy() { state_ &= ~ABC_FAC_GOT_RCOPY; }
1253  inline bool gotUCopy() const { return ((state_ & ABC_FAC_GOT_UCOPY) != 0); }
1254  inline void setNoGotUCopy() { state_ &= ~ABC_FAC_GOT_UCOPY; }
1256  inline bool gotSparse() const { return ((state_ & ABC_FAC_GOT_SPARSE) != 0); }
1259 #else
1260  // force use of copies
1261  inline bool gotLCopy() const { return true; }
1262  inline void setNoGotLCopy() {}
1263  inline void setYesGotLCopy() {}
1264  inline bool gotRCopy() const { return true; }
1265  inline void setNoGotRCopy() {}
1266  inline void setYesGotRCopy() {}
1267  inline bool gotUCopy() const { return true; }
1268  inline void setNoGotUCopy() {}
1269  inline void setYesGotUCopy() {}
1270  inline bool gotSparse() const { return true; }
1271  inline void setNoGotSparse() {}
1272  inline void setYesGotSparse() {}
1273 #endif
1274 #else
1275  // force no use of copies
1276  inline bool gotLCopy() const { return false; }
1277  inline void setNoGotLCopy() {}
1278  inline void setYesGotLCopy() {}
1279  inline bool gotRCopy() const { return false; }
1280  inline void setNoGotRCopy() {}
1281  inline void setYesGotRCopy() {}
1282  inline bool gotUCopy() const { return false; }
1283  inline void setNoGotUCopy() {}
1284  inline void setYesGotUCopy() {}
1285  inline bool gotSparse() const { return false; }
1286  inline void setNoGotSparse() {}
1287  inline void setYesGotSparse() {}
1288 #endif
1289 
1294  //CoinSimplexInt persistenceFlag_;
1296 };
1297 
1298 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
1299 */
CoinBigIndex numberL_
Number in L.
CoinBigIndex * array() const
Get Array.
void updateColumnTransposeRDensish(CoinIndexedVector *region) const
Updates part of column transpose (BTRANR) when dense.
CoinIntArrayWithLength lastRow_
Previous Row in memory order.
CoinBigIndexArrayWithLength startRowL_
Start of each row in L.
void gutsOfInitialize(CoinSimplexInt type)
1 bit - tolerances etc, 2 more, 4 dummy arrays
void updateColumnTransposeUSparse(CoinIndexedVector *region) const
Updates part of column transpose (BTRANU) when sparse, assumes index is sorted i.e.
int numberRows_
Number of Rows in factorization.
CoinBigIndex * startColumnR() const
Start of columns for R.
CoinIntArrayWithLength indexRowL_
Row indices of L.
CoinSimplexInt maximumMaximumPivots_
Maximum maximum pivots.
double * denseVector(CoinIndexedVector &vector) const
void updatePartialUpdate(CoinIndexedVector &partialUpdate)
Update partial Ftran by R update.
CoinSimplexInt numberGoodL_
Number factorized in L.
virtual void getAreas(CoinSimplexInt numberRows, CoinSimplexInt numberColumns, CoinBigIndex maximumL, CoinBigIndex maximumU)
Gets space for a factorization, called by constructors.
CoinSimplexInt * indexColumnL() const
Index of column in row for L.
void setDenseThreshold(CoinSimplexInt value)
Sets dense threshold.
CoinFactorizationDoubleArrayWithLength pivotRegion_
Inverses of pivot values.
virtual int checkReplacePart2(int pivotRow, CoinSimplexDouble btranAlpha, double ftranAlpha, double ftAlpha, double acceptablePivot=1.0e-8)
Checks if can replace one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room, 5 max pivots.
CoinSimplexInt maximumRowsExtra_
Maximum number of Rows after iterating.
CoinBigIndex numberElementsL() const
Returns number in L area.
CoinSimplexInt numberRowsExtra_
Number of Rows after iterating.
CoinSimplexInt denseThreshold_
Dense threshold (here to use double alignment)
CoinAbcTypeFactorization()
Default constructor.
void updateColumnTransposeL(CoinIndexedVector *region, CoinAbcStatistics &statistics) const
Updates part of column transpose (BTRANL)
virtual void checkMarkArrays() const
#define ABC_PARALLEL
CoinIntArrayWithLength firstCount_
First Row/Column with count of k, can tell which by offset - Rows then Columns.
CoinBigIndex sizeSparseArray_
Size in bytes of a sparseArray.
virtual CoinAbcAnyFactorization * clone() const
Clone.
CoinIntArrayWithLength markRow_
Marks rows to be updated.
void fromLongArray(CoinIndexedVector *vector) const
From a work array and dis-associate vector.
CoinIntArrayWithLength lastColumn_
Previous Column in memory order.
void deleteLink(CoinSimplexInt index)
Deletes a link in chain of equal counts.
CoinSimplexInt numberTrials_
Number of trials before rejection.
CoinSimplexInt replaceColumnPFI(CoinIndexedVector *regionSparse, CoinSimplexInt pivotRow, CoinSimplexDouble alpha)
Replaces one Column to basis for PFI returns 0=OK, 1=Probably OK, 2=singular, 3=no room...
void setNumberElementsU(CoinBigIndex value)
Setss number in U area.
CoinBigIndex lengthL_
Length of L.
CoinFactorizationDoubleArrayWithLength elementRowU_
Elements of U by row.
CoinIntArrayWithLength indexColumnU_
Base address for U (may change)
CoinSimplexInt * lastCount() const
Previous Row/Column with count.
CoinFactorizationDouble * elementUAddress_
void updateTwoColumnsUDensish(CoinSimplexInt &numberNonZero1, CoinFactorizationDouble *COIN_RESTRICT region1, CoinSimplexInt *COIN_RESTRICT index1, CoinSimplexInt &numberNonZero2, CoinFactorizationDouble *COIN_RESTRICT region2, CoinSimplexInt *COIN_RESTRICT index2) const
Updates part of 2 columns (FTRANU) real work.
CoinFactorizationDouble * elementU() const
Elements of U.
CoinBigIndex firstZeroed_
First place in funny copy zeroed out.
Abstract base class which also has some scalars so can be used from Dense or Simp.
#define ABC_FAC_GOT_SPARSE
bool getRowSpaceIterate(CoinSimplexInt iRow, CoinSimplexInt extraNeeded)
Gets space for one Row with given length while iterating, may have to do compression (returns True i...
void addLink(CoinSimplexInt index, CoinSimplexInt count)
Adds a link in chain of equal counts.
friend void CoinAbcFactorizationUnitTest(const std::string &mpsDir)
void updateColumnUDensish(CoinIndexedVector *regionSparse) const
Updates part of column (FTRANU)
double preProcess3()
Return largest element.
CoinSimplexInt * lastCountAddress_
Previous Row/Column with count.
CoinBigIndex lengthAreaR_
length of area reserved for R
virtual CoinSimplexInt factor(AbcSimplex *model)
Does most of factorization.
CoinIntArrayWithLength numberInRow_
Number in each Row.
void checkConsistency()
Checks that row and column copies look OK.
CoinBigIndex baseL() const
Base of L.
CoinSimplexInt * pivotLinkedForwards() const
virtual CoinSimplexInt * numberInRow() const
Number of entries in each row.
const double * denseVector(const CoinIndexedVector &vector) const
void separateLinks()
Separate out links with same row/column count.
void updateColumnTransposeR(CoinIndexedVector *region, CoinAbcStatistics &statistics) const
Updates part of column transpose (BTRANR)
CoinBigIndexArrayWithLength startColumnU_
Start of each column in U.
#define checkLinks(x)
double * denseVector() const
Get the vector as a dense vector.
CoinBigIndex * startColumnL() const
Start of each column in L.
int numberRows() const
Number of Rows after factorization.
bool pivotRowSingleton(CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn)
Does one pivot on Row Singleton in factorization.
void updateColumnTransposeLDensish(CoinIndexedVector *region) const
Updates part of column transpose (BTRANL) when densish by column.
virtual void updateColumnTransposeCpu(CoinIndexedVector &regionSparse, int whichCpu) const
Updates one column (BTRAN)
CoinSimplexInt factorDense()
Does dense phase of factorization return code is &lt;0 error, 0= finished.
virtual void updateColumnFTPart2(CoinIndexedVector &regionSparse)
CoinBigIndex lengthR_
Length of R stuff.
virtual void updateWeights(CoinIndexedVector &regionSparse) const
Updates one column for dual steepest edge weights (FTRAN)
void checkSparse()
See if worth going sparse.
void doAddresses()
Set up addresses from arrays.
bool spaceForForrestTomlin() const
True if FT update and space.
void pivotColumnSingleton(CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn)
Does one pivot on Column Singleton in factorization (can&#39;t return false)
CoinIntArrayWithLength numberInColumnPlus_
Number in each Column including pivoted.
CoinBigIndex * startColumnU() const
Start of each column in U.
CoinSimplexInt messageLevel() const
Level of detail of messages.
CoinBigIndex * startRowL() const
Start of each row in L.
void afterPivot(CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn)
After pivoting.
CoinSimplexInt numberForrestTomlin() const
Length of FT vector.
CoinSimplexInt numberU_
Number in U.
CoinSimplexInt leadingDimension_
Leading dimension for dense.
virtual void preProcess()
PreProcesses column ordered copy of basis.
CoinSimplexInt numberRowsSmall_
Size of small inverse.
bool reorderU()
Reorders U so contiguous and in order (if there is space) Returns true if it could.
CoinSimplexInt * pivotLinkedBackwards() const
Forward and backward linked lists (numberRows_+2)
virtual int * pivotRow() const
Returns pivot row.
#define COIN_RESTRICT
CoinFactorizationDoubleArrayWithLength elementL_
Elements of L.
CoinFactorizationDouble * pivotRegionAddress_
CoinBigIndex lengthAreaL() const
Returns length of L area.
void clearArrays()
Get rid of all memory.
void(* scatterUpdate)(int, CoinFactorizationDouble, const CoinFactorizationDouble *, double *) SCATTER_ATTRIBUTE
virtual CoinSimplexInt updateColumn(CoinIndexedVector &regionSparse) const
This version has same effect as above with FTUpdate==false so number returned is always &gt;=0...
virtual CoinSimplexInt * numberInColumn() const
Number of entries in each column.
double CoinSimplexDouble
void unpack(CoinIndexedVector *regionFrom, CoinIndexedVector *regionTo) const
CoinBigIndex lastEntryByColumnU_
Last entry by column for U.
void updateColumnTransposeLByRow(CoinIndexedVector *region) const
Updates part of column transpose (BTRANL) when densish by row.
CoinBigIndex lastEntryByRowU_
Last entry by row for U.
void updateColumnUDense(CoinIndexedVector *regionSparse) const
Updates part of column (FTRANU) when dense (i.e. do as inner products)
virtual CoinSimplexInt updateColumnTranspose(CoinIndexedVector &regionSparse) const
Updates one column (BTRAN) from regionSparse2 regionSparse starts as zero and is zero at end Note - i...
int replaceColumnU(CoinIndexedVector *regionSparse, CoinBigIndex *deletedPosition, CoinSimplexInt *deletedColumns, CoinSimplexInt pivotRow)
Combines BtranU and store which elements are to be deleted returns number to be deleted.
CoinSimplexInt maximumRows_
Maximum rows (ever) (here to use double alignment)
#define ABC_FAC_GOT_UCOPY
CoinFactorizationDouble * array() const
Get Array.
CoinIntArrayWithLength nextColumn_
Next Column in memory order.
CoinSimplexInt * nextCount() const
Next Row/Column with count.
#define ABC_SMALL
double CoinFactorizationDouble
Definition: CoinTypes.hpp:57
void updateColumnTransposeUDensish(CoinIndexedVector *region, CoinSimplexInt smallestIndex) const
Updates part of column transpose (BTRANU) when densish, assumes index is sorted i.e.
CoinBigIndex numberL() const
Number in L.
void fromLongArray(int which) const
From a work array and dis-associate vector.
CoinSimplexInt * indexRowL() const
Row indices of L.
CoinSimplexUnsignedInt * workArea2Address_
double ftranCountInput_
To decide how to solve.
virtual int updateColumnFTPart1(CoinIndexedVector &regionSparse)
CoinIntArrayWithLength pivotColumn_
Pivot order for each Column.
virtual CoinSimplexInt * pivotColumn() const
Returns address of pivotColumn region (also used for permuting)
CoinFactorizationDouble * elementByRowLAddress_
virtual CoinSimplexInt updateColumnFT(CoinIndexedVector &regionSparse)
Later take out return codes (apart from +- 1 on FT)
CoinBigIndexArrayWithLength convertColumnToRowU_
Converts columns to rows in U.
CoinBigIndex * version.
CoinIntArrayWithLength numberInColumn_
Number in each Column.
Indexed Vector.
void gutsOfCopy(const CoinAbcTypeFactorization &other)
virtual CoinFactorizationDouble * elements() const
Returns array to put basis elements in.
int scan()
Scan dense region and set up indices (returns number found)
void updateColumnTransposeLSparse(CoinIndexedVector *region) const
Updates part of column transpose (BTRANL) when sparse (by Row)
CoinFactorizationDoubleArrayWithLength workArea_
First work area.
CoinBigIndex maximumU_
Maximum space used in U.
CoinIntArrayWithLength indexRowU_
Row indices of U.
CoinSimplexInt * nextCountAddress_
Next Row/Column with count.
CoinBigIndex lengthU_
Length of U.
CoinSimplexInt * indexRowRAddress_
Row indices for R.
void updateColumnL(CoinIndexedVector *region, CoinAbcStatistics &statistics) const
Updates part of column (FTRANL)
void updateColumnTransposeRSparse(CoinIndexedVector *region) const
Updates part of column transpose (BTRANR) when sparse.
CoinBigIndexArrayWithLength startRowU_
Start of each Row as pointer.
CoinSimplexInt initialNumberRows_
Rows first time nonzero.
virtual void updateFullColumnTranspose(CoinIndexedVector &regionSparse) const
Updates one full column (BTRAN)
void updateColumnLDense(CoinIndexedVector *region) const
Updates part of column (FTRANL) when dense (i.e. do as inner products)
CoinFactorizationDouble * elementRAddress_
Elements of R.
void updateColumnR(CoinIndexedVector *region, CoinAbcStatistics &statistics) const
Updates part of column (FTRANR) without FT update.
CoinFactorizationDouble * elementRowUAddress_
CoinSimplexDouble adjustedAreaFactor() const
Returns areaFactor but adjusted for dense.
CoinSimplexInt * permute() const
Returns address of permute region.
CoinBigIndex totalElements_
Number of elements in U (to go) or while iterating total overall.
CoinIntArrayWithLength nextRow_
Next Row in memory order.
CoinSimplexInt checkPivot(CoinSimplexDouble saveFromU, CoinSimplexDouble oldPivot) const
Returns accuracy status of replaceColumn returns 0=OK, 1=Probably OK, 2=singular. ...
unsigned char CoinCheckZero
CoinFactorizationDouble * workAreaAddress_
CoinUnsignedIntArrayWithLength workArea2_
Second work area.
CoinBigIndexArrayWithLength startColumnL_
Start of each column in L.
int pivot(CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn, CoinBigIndex pivotRowPosition, CoinBigIndex pivotColumnPosition, CoinFactorizationDouble *COIN_RESTRICT work, CoinSimplexUnsignedInt *COIN_RESTRICT workArea2, CoinSimplexInt increment2, int *COIN_RESTRICT markRow)
0 fine, -99 singular, 2 dense
void toLongArray(CoinIndexedVector *vector, int which) const
To a work array and associate vector.
void resetStatistics()
Reset all sparsity etc statistics.
void updateColumnLSparse(CoinIndexedVector *region) const
Updates part of column (FTRANL) when sparse.
virtual CoinFactorizationDouble * pivotRegion() const
Returns address of pivot region.
CoinSimplexInt numberRowsLeft_
Number Rows left (numberRows-numberGood)
CoinAbcTypeFactorization & operator=(const CoinAbcTypeFactorization &other)
= copy
CoinSimplexDouble conditionNumber() const
Condition number - product of pivots after factorization.
CoinIntArrayWithLength sparse_
Sparse regions.
virtual ~CoinAbcTypeFactorization()
Destructor.
CoinSimplexInt state_
State of saved version and what can be done 0 - nothing saved 1 - saved and can go back to previous s...
virtual void checkReplacePart1a(CoinIndexedVector *, int)
void updateColumnU(CoinIndexedVector *region, CoinAbcStatistics &statistics) const
Updates part of column (FTRANU)
virtual void postProcess(const CoinSimplexInt *sequence, CoinSimplexInt *pivotVariable)
Does post processing on valid factorization - putting variables on correct rows.
CoinFactorizationDouble * elementLAddress_
CoinBigIndex numberElementsU() const
Returns number in U area.
void sort() const
Debug - sort so can compare.
CoinFactorizationDouble * denseAreaAddress_
CoinSimplexInt * pivotLOrder() const
void pack(CoinIndexedVector *regionFrom, CoinIndexedVector *regionTo) const
void printRegion(const CoinIndexedVector &vector, const char *where) const
virtual void updateColumnCpu(CoinIndexedVector &regionSparse, int whichCpu) const
Updates one column (FTRAN)
CoinFactorizationDouble * version.
bool storeFT(const CoinIndexedVector *regionFT)
Store update after doing L and R - retuns false if no room.
CoinFactorizationDouble * elementByRowL() const
Elements in L (row copy)
int CoinBigIndex
CoinSimplexInt numberRowsExtra() const
Number of Rows after iterating.
void scan(CoinIndexedVector *vector) const
Scans region to find nonzeros.
void updateColumnTransposeUByColumn(CoinIndexedVector *region, CoinSimplexInt smallestIndex) const
Updates part of column transpose (BTRANU) by column assumes index is sorted i.e.
virtual double checkReplacePart1(CoinIndexedVector *regionSparse, int pivotRow)
Checks if can replace one Column to basis, returns update alpha Fills in region for use later partial...
CoinFactorizationDoubleArrayWithLength elementU_
Elements of U.
virtual CoinBigIndex numberElements() const
Total number of elements in factorization.
CoinFactorizationDoubleArrayWithLength denseArea_
Dense area.
#define ABC_FAC_GOT_RCOPY
bool pivotOneOtherRow(CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn)
Pivots when just one other row so faster?
void cleanup()
Cleans up at end of factorization.
CoinFactorizationLongDouble * version.
void updateColumnTransposePFI(CoinIndexedVector *region) const
Updates part of column transpose PFI (BTRAN) (before rest)
#define FACTOR_CPU
This deals with Factorization and Updates.
virtual void replaceColumnPart3(const AbcSimplex *model, CoinIndexedVector *regionSparse, CoinIndexedVector *tableauColumn, int pivotRow, double alpha)
Replaces one Column to basis, partial update already in U.
This deals with Factorization and Updates.
CoinSimplexInt messageLevel_
Detail in messages.
CoinBigIndex lengthAreaU() const
Returns length of U area.
virtual void updateFullColumn(CoinIndexedVector &regionSparse) const
Updates one full column (FTRAN)
CoinBigIndex lengthAreaL_
Length of area reserved for L.
virtual double checkReplacePart1b(CoinIndexedVector *, int)
int * array() const
Get Array.
void modifyLink(CoinSimplexInt index, CoinSimplexInt count)
Modifies links in chain of equal counts.
virtual bool wantsTableauColumn() const
Returns true if wants tableauColumn in replaceColumn.
CoinIntArrayWithLength saveColumn_
Columns left to do in a single pivot.
void updateColumnTransposeU(CoinIndexedVector *region, CoinSimplexInt smallestIndex, CoinAbcStatistics &statistics) const
Updates part of column transpose (BTRANU), assumes index is sorted i.e.
void updateColumnLDensish(CoinIndexedVector *region) const
Updates part of column (FTRANL) when densish.
double btranFullCountInput_
To decide how to solve.
virtual CoinSimplexInt updateTwoColumnsFT(CoinIndexedVector &regionFT, CoinIndexedVector &regionOther)
Updates one column (FTRAN) from region2 Tries to do FT update number returned is negative if no room...
CoinSimplexInt sparseThreshold_
Below this use sparse technology - if 0 then no L row copy.
CoinSimplexInt numberR_
Number in R.
void gutsOfDestructor(CoinSimplexInt type=1)
The real work of constructors etc 0 just scalars, 1 bit normal.
CoinFactorizationDoubleArrayWithLength elementByRowL_
Elements in L (row copy)
void updateColumnUSparse(CoinIndexedVector *regionSparse) const
Updates part of column (FTRANU) when sparse.
int CoinSimplexInt
CoinBigIndex getColumnSpaceIterate(CoinSimplexInt iColumn, CoinFactorizationDouble value, CoinSimplexInt iRow)
getColumnSpaceIterate.
bool getColumnSpaceIterateR(CoinSimplexInt iColumn, CoinFactorizationDouble value, CoinSimplexInt iRow)
getColumnSpaceIterateR.
int wantToGoDense()
After pivoting - returns true if need to go dense.
CoinBigIndex lengthAreaU_
Length of area reserved for U.
CoinSimplexInt * firstCount() const
For equal counts in factorization.
CoinIntArrayWithLength permute_
Permutation vector for pivot row order.
#define ABC_FAC_GOT_LCOPY
virtual void makeNonSingular(CoinSimplexInt *sequence)
Makes a non-singular basis by replacing variables.
CoinSimplexInt factorSparse()
Does sparse phase of factorization return code is &lt;0 error, 0= finished.
void show_self() const
Debug show object (shows one representation)
bool getColumnSpace(CoinSimplexInt iColumn, CoinSimplexInt extraNeeded)
Gets space for one Column with given length, may have to do compression (returns True if successful)...
void goSparse()
makes a row copy of L for speed and to allow very sparse problems
double * denseVector(CoinIndexedVector *vector) const
Returns double * associated with vector.
CoinSimplexInt maximumRowsExtra() const
Maximum of Rows after iterating.
CoinSimplexInt denseThreshold() const
Gets dense threshold.
CoinBigIndex numberElementsR() const
Returns number in R area.
CoinBigIndex numberCompressions() const
Number of compressions done.
CoinSimplexDouble maximumCoefficient() const
Returns maximum absolute value in factorization.
CoinSimplexInt sparseThreshold() const
get sparse threshold
CoinSimplexInt * indexRowU() const
Row indices of U.
double ftranFullCountInput_
To decide how to solve.
virtual CoinSimplexInt * indices() const
Returns array to put basis indices in.
int maximumPivots() const
Maximum number of pivots between factorizations.
double zeroTolerance_
Zero tolerance.
CoinIntArrayWithLength indexColumnL_
Index of column in row for L.
virtual CoinBigIndex * starts() const
Returns pivot row.
void almostDestructor()
Delete all stuff (leaves as after CoinAbcFactorization())
CoinBigIndexArrayWithLength convertRowToColumnU_
Converts rows to columns in U.
void updateColumnPFI(CoinIndexedVector *regionSparse) const
Updates part of column PFI (FTRAN) (after rest)
CoinBigIndex numberCompressions_
Number of compressions done.
bool getRowSpace(CoinSimplexInt iRow, CoinSimplexInt extraNeeded)
Gets space for one Row with given length, may have to do compression (returns True if successful)...
unsigned int CoinSimplexUnsignedInt
const double * denseVector(const CoinIndexedVector *vector) const
Returns double * associated with vector.