37 for (
int i =
dim() - 1; i >= 0; --i)
41 MSG_DEBUG( std::cout <<
"DSHIFT08 theUBbound[" << i <<
"] violated by " << (*
theFvec)[i] -
theUBbound[i] - allow << std::endl );
53 MSG_DEBUG( std::cout <<
"DSHIFT08 theLBbound[" << i <<
"] violated by " <<
theLBbound[i] - (*
theFvec)[i] - allow << std::endl );
67 MSG_DEBUG( std::cout <<
"DSHIFT01 shiftFvec: OK" << std::endl; )
92 for (i =
dim() - 1; i >= 0; --i)
102 (*theCoLbound)[i] = (*theCoUbound)[i];
112 (*theCoUbound)[i] = (*theCoLbound)[i];
117 for (i =
coDim() - 1; i >= 0; --i)
127 (*theLbound)[i] = (*theUbound)[i];
137 (*theUbound)[i] = (*theLbound)[i];
144 MSG_DEBUG( std::cout <<
"DSHIFT02 shiftPvec: OK" << std::endl; )
157 assert(uvec.
dim() == p_low.
dim());
158 assert(uvec.
dim() == p_up.
dim());
163 Random mult(10.0 * p_delta, 100.0 * p_delta);
170 for (i = uvec.
dim() - start - 1; i >= 0; i -= incr)
175 if (p_up[i] <= vec[i] + eps)
177 p_up[i] = vec[i] +
Real(mult);
180 if (p_low[i] >= vec[i] - eps)
182 p_low[i] = vec[i] -
Real(mult);
188 for (j = uvec.
delta().
size() - start - 1; j >= 0; j -= incr)
203 if (u != l && vec[i] >= u - eps)
205 p_up[i] = vec[i] +
Real(mult);
211 if (u != l && vec[i] <= l + eps)
213 p_low[i] = vec[i] -
Real(mult);
218 #endif // !FULL_SHIFT 230 assert(uvec.
dim() == p_low.
dim());
231 assert(uvec.
dim() == p_up.
dim());
236 Random mult(10.0 * p_delta, 100.0 * p_delta);
242 for (i = uvec.
dim() - start - 1; i >= 0; i -= incr)
246 if (p_up[i] <= vec[i] + eps)
248 p_up[i] = vec[i] +
Real(mult);
251 if (p_low[i] >= vec[i] - eps)
253 p_low[i] = vec[i] -
Real(mult);
259 for (j = uvec.
delta().
size() - start - 1; j >= 0; j -= incr)
274 if (u != l && vec[i] >= u - eps)
276 p_up[i] = vec[i] +
Real(mult);
282 if (u != l && vec[i] <= l + eps)
284 p_low[i] = vec[i] -
Real(mult);
289 #endif // !FULL_SHIFT 320 assert(uvec.
dim() == p_low.
dim());
321 assert(uvec.
dim() == p_up.
dim());
326 Random mult(10*p_delta, 100*p_delta);
333 for (i = uvec.
dim() - start - 1; i >= 0; i -= incr)
337 if (p_up[i] <= vec[i] + eps &&
rep()*stat[i] < 0)
339 p_up[i] = vec[i] +
Real(mult);
340 l_theShift += p_up[i] - u;
342 if (p_low[i] >= vec[i] - eps &&
rep()*stat[i] < 0)
344 p_low[i] = vec[i] -
Real(mult);
345 l_theShift -= p_low[i] - l;
350 for (j = uvec.
delta().
size() - start - 1; j >= 0; j -= incr)
358 if (u != l && vec[i] >= u - eps &&
rep()*stat[i] < 0)
360 p_up[i] = vec[i] +
Real(mult);
361 l_theShift += p_up[i] - u;
366 if (u != l && vec[i] <= l + eps &&
rep()*stat[i] < 0)
368 p_low[i] = vec[i] -
Real(mult);
369 l_theShift -= p_low[i] - l;
373 #endif // !FULL_SHIFT 387 assert(uvec.
dim() == p_low.
dim());
388 assert(uvec.
dim() == p_up.
dim());
393 Random mult(10*p_delta, 100*p_delta);
400 for (i = uvec.
dim() - start - 1; i >= 0; i -= incr)
404 if (p_up[i] <= vec[i] + eps &&
rep()*stat[i] < 0)
406 p_up[i] = vec[i] +
Real(mult);
407 l_theShift += p_up[i] - u;
409 if (p_low[i] >= vec[i] - eps &&
rep()*stat[i] < 0)
411 p_low[i] = vec[i] -
Real(mult);
412 l_theShift -= p_low[i] - l;
417 for (j = uvec.
delta().
size() - start - 1; j >= 0; j -= incr)
425 if (u != l && vec[i] >= u - eps &&
rep()*stat[i] < 0)
427 p_up[i] = vec[i] +
Real(mult);
428 l_theShift += p_up[i] - u;
433 if (u != l && vec[i] <= l + eps &&
rep()*stat[i] < 0)
435 p_low[i] = vec[i] -
Real(mult);
436 l_theShift -= p_low[i] - l;
440 #endif // !FULL_SHIFT 453 desc().coStatus(), 0, 1);
466 desc().coStatus(), 0, 1);
488 for (i =
dim(); i-- > 0;)
501 t_low =
lower(l_num);
505 if ((*
theFvec)[i] < t_up + eps)
509 if ((*
theFvec)[i] > t_low - eps)
511 else if ((*
theFvec)[i] < t_low)
522 for (i =
nRows(); i-- > 0;)
534 for (i =
nCols(); i-- > 0;)
550 for (i =
dim(); i-- > 0;)
574 if ((*
theFvec)[i] < t_up - eps)
579 if ((*
theFvec)[i] > t_low + eps)
581 else if ((*
theFvec)[i] < t_low)
585 for (i =
nRows(); i-- > 0;)
597 for (i =
nCols(); i-- > 0;)
619 for (i =
nRows(); i-- > 0;)
647 for (i =
nCols(); i-- > 0;)
649 t_up = t_low = -
maxObj(i);
653 if ((*
thePvec)[i] < -t_up + eps)
661 if ((*
thePvec)[i] > -t_low - eps)
679 for (i =
nRows(); i-- > 0;)
693 if ((*
thePvec)[i] < t_up + eps)
697 if ((*
thePvec)[i] > t_low - eps)
707 for (i =
nCols(); i-- > 0;)
virtual void unShift(void)
remove shift as much as possible.
int dim() const
dimension of basis matrix.
int coDim() const
codimension.
const R * values() const
Returns array values.
Representation rep() const
return the current basis representation.
const VectorBase< Real > & maxObj() const
Returns objective vector for maximization problem.
Desc::Status dualStatus(const SPxColId &id) const
dual Status for the column variable with ID id of the loaded LP.
SPxOut * spxout
message handler
DVector * theUbound
Upper bound for vars.
int iteration() const
returns number of basis changes since last load().
DVector * theCoUbound
Upper bound for covars.
const Vector & lbBound() const
lower bound for fVec.
Random numbers.Class Random provides random Real variables, i.e. a value variable that gives another ...
Status & rowStatus(int i)
int number(const SPxRowId &id) const
Returns the row number of the row with identifier id.
virtual void perturbMaxLeave(void)
perturb nonbasic bounds.
const R * get_const_ptr() const
Conversion to C-style pointer.
UpdateVector & fVec() const
feasibility vector.
const VectorBase< Real > & lower() const
Returns lower bound vector.
virtual void perturbMinEnter(void)
void shiftLBbound(int i, Real to)
shift i 'th lbBound to to.
UpdateVector & pVec() const
pricing vector.
const Vector & ubBound() const
upper bound for fVec.
virtual void perturbMaxEnter(void)
perturb basis bounds.
SPxId coId(int i) const
id of i 'th covector.
virtual Real shift() const
total current shift amount.
const VectorBase< Real > & upper() const
Returns upper bound vector.
Type type() const
returns the type of the id.
Wrapper for different output streams and verbosity levels.
int index(int n) const
access n 'th index.
Generic Ids for LP rows or columns.Both SPxColIds and SPxRowIds may be treated uniformly as SPxIds: ...
void clearDualBounds(SPxBasis::Desc::Status, Real &, Real &) const
UpdateVector & coPvec() const
copricing vector.
void shiftLPbound(int i, Real to)
shift i 'th lpBound to to.
DVector * theLbound
Lower bound for vars.
int nCols() const
Returns number of columns in LP.
DVector theLBbound
Lower Basic Feasibility bound.
void shiftPvec()
Perform initial shifting to optain an feasible or pricable basis.
Dense vector with semi-sparse vector for updatesIn many algorithms vectors are updated in every itera...
void shiftUCbound(int i, Real to)
shift i 'th ucBound to to.
DVector theURbound
Upper Row Feasibility bound.
int dim() const
Dimension of vector.
const Vector & lcBound() const
Type type() const
return current Type.
Real entertol() const
feasibility tolerance maintained by ratio test during ENTER algorithm.
void shiftUBbound(int i, Real to)
shift i 'th ubBound to to.
Status & colStatus(int i)
DVector theUBbound
Upper Basic Feasibility bound.
const Vector & upBound() const
DVector * theCoLbound
Lower bound for covars.
Debugging, floating point type and parameter definitions.
int nRows() const
Returns number of rows in LP.
DVector theLRbound
Lower Row Feasibility bound.
void perturbMin(const UpdateVector &vec, Vector &low, Vector &up, Real eps, Real delta, int start=0, int incr=1)
DVector theUCbound
Upper Column Feasibility bound.
const VectorBase< Real > & lhs() const
Returns left hand side vector.
Everything should be within this namespace.
void shiftUPbound(int i, Real to)
shift i 'th upBound to to.
void shiftLCbound(int i, Real to)
shift i 'th lcBound to to.
const IdxSet & indices() const
Returns indices.
void setup()
Initializes nonzero indices for elements with absolute values above epsilon and sets all other elemen...
DVector theLCbound
Lower Column Feasibility bound.
virtual void perturbMinLeave(void)
const Vector & lpBound() const
Status status() const
Status of solution process.
Real epsilon() const
values are considered to be 0.
void shiftFvec()
Perform initial shifting to optain an feasible or pricable basis.
Real theShift
sum of all shifts applied to any bound.
const VectorBase< Real > & rhs() const
Returns right hand side vector.
bool isInitialized() const
has the internal data been initialized?
bool isBasic(SPxBasis::Desc::Status stat) const
does stat describe a basic index ?
dual variable has two bounds
void perturbMax(const UpdateVector &vec, Vector &low, Vector &up, Real eps, Real delta, int start=0, int incr=1)
const Desc & desc() const
SSVector & delta()
update vector , writeable
#define MSG_INFO3(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO3.
const Vector & ucBound() const
Status
Status of a variable.
Real leavetol() const
feasibility tolerance maintained by ratio test during LEAVE algorithm.
Set of indices.Class IdxSet provides a set of indices. At construction it must be given an array of i...
columnwise representation.
const VectorBase< Real > & maxRowObj() const
int size() const
Returns the number of nonzeros.