ClpDualRowPivot.hpp 3.54 KB
Newer Older
Valentin Platzgummer's avatar
Valentin Platzgummer committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
/* $Id$ */
// Copyright (C) 2002, International Business Machines
// Corporation and others.  All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).

#ifndef ClpDualRowPivot_H
#define ClpDualRowPivot_H

class ClpSimplex;
class CoinIndexedVector;

//#############################################################################

/** Dual Row Pivot Abstract Base Class

Abstract Base Class for describing an interface to an algorithm
to choose row pivot in dual simplex algorithm.  For some algorithms
e.g. Dantzig choice then some functions may be null.

*/

class ClpDualRowPivot {

public:
  ///@name Algorithmic methods
  //@{

  /// Returns pivot row, -1 if none
  virtual int pivotRow() = 0;

  /** Updates weights and returns pivot alpha.
         Also does FT update */
  virtual double updateWeights(CoinIndexedVector *input,
    CoinIndexedVector *spare,
    CoinIndexedVector *spare2,
    CoinIndexedVector *updatedColumn)
    = 0;

  /** Updates primal solution (and maybe list of candidates)
         Uses input vector which it deletes
         Computes change in objective function
         Would be faster if we kept basic regions, but on other hand it
         means everything is always in sync
     */
  /* FIXME: this was pure virtul (=0). Why? */
  virtual void updatePrimalSolution(CoinIndexedVector *input,
    double theta,
    double &changeInObjective)
    = 0;
  /** Saves any weights round factorization as pivot rows may change
         Will be empty unless steepest edge (will save model)
         May also recompute infeasibility stuff
         1) before factorization
         2) after good factorization (if weights empty may initialize)
         3) after something happened but no factorization
            (e.g. check for infeasible)
         4) as 2 but restore weights from previous snapshot
         5) for strong branching - initialize to 1 , infeasibilities
	 6) scale back
         7) for strong branching - initialize full weights , infeasibilities
     */
  virtual void saveWeights(ClpSimplex *model, int mode);
  /// checks accuracy and may re-initialize (may be empty)
  virtual void checkAccuracy();
  /// Gets rid of last update (may be empty)
  virtual void unrollWeights();
  /// Gets rid of all arrays (may be empty)
  virtual void clearArrays();
  /// Returns true if would not find any row
  virtual bool looksOptimal() const
  {
    return false;
  }
  /// Called when maximum pivots changes
  virtual void maximumPivotsChanged() {}
  //@}

  ///@name Constructors and destructors
  //@{
  /// Default Constructor
  ClpDualRowPivot();

  /// Copy constructor
  ClpDualRowPivot(const ClpDualRowPivot &);

  /// Assignment operator
  ClpDualRowPivot &operator=(const ClpDualRowPivot &rhs);

  /// Destructor
  virtual ~ClpDualRowPivot();

  /// Clone
  virtual ClpDualRowPivot *clone(bool copyData = true) const = 0;

  //@}

  ///@name Other
  //@{
  /// Returns model
  inline ClpSimplex *model()
  {
    return model_;
  }

  /// Sets model (normally to NULL)
  inline void setModel(ClpSimplex *newmodel)
  {
    model_ = newmodel;
  }

  /// Returns type (above 63 is extra information)
  inline int type()
  {
    return type_;
  }

  //@}

  //---------------------------------------------------------------------------

protected:
  ///@name Protected member data
  //@{
  /// Pointer to model
  ClpSimplex *model_;
  /// Type of row pivot algorithm
  int type_;
  //@}
};
#ifndef CLP_DUAL_COLUMN_MULTIPLIER
//#define CLP_DUAL_COLUMN_MULTIPLIER 0.99999
#endif
#endif

/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
*/