Scippy

SoPlex

Sequential object-oriented simPlex

spxshift.cpp
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the class library */
4 /* SoPlex --- the Sequential object-oriented simPlex. */
5 /* */
6 /* Copyright (C) 1996-2016 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SoPlex is distributed under the terms of the ZIB Academic Licence. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SoPlex; see the file COPYING. If not email to soplex@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 #include <assert.h>
17 #include <iostream>
18 
19 #include "spxdefines.h"
20 #include "spxsolver.h"
21 #include "spxout.h"
22 
23 namespace soplex
24 {
26 {
27 
28  /* the allowed tolerance is (rep() == COLUMN) ? feastol() : opttol() because theFvec is the primal vector in COLUMN
29  * and the dual vector in ROW representation; this is equivalent to entertol()
30  */
31  Random mult(10.0 * entertol(), 100.0 * entertol());
32  Real allow = entertol() - epsilon();
33 
34  assert(type() == ENTER);
35  assert(allow > 0);
36 
37  for (int i = dim() - 1; i >= 0; --i)
38  {
39  if (theUBbound[i] + allow < (*theFvec)[i])
40  {
41  MSG_DEBUG( std::cout << "DSHIFT08 theUBbound[" << i << "] violated by " << (*theFvec)[i] - theUBbound[i] - allow << std::endl );
42 
43  if (theUBbound[i] != theLBbound[i])
44  shiftUBbound(i, (*theFvec)[i] + Real(mult));
45  else
46  {
47  shiftUBbound(i, (*theFvec)[i]);
48  theLBbound[i] = theUBbound[i];
49  }
50  }
51  else if ((*theFvec)[i] < theLBbound[i] - allow)
52  {
53  MSG_DEBUG( std::cout << "DSHIFT08 theLBbound[" << i << "] violated by " << theLBbound[i] - (*theFvec)[i] - allow << std::endl );
54 
55  if (theUBbound[i] != theLBbound[i])
56  shiftLBbound(i, (*theFvec)[i] - Real(mult));
57  else
58  {
59  shiftLBbound(i, (*theFvec)[i]);
60  theUBbound[i] = theLBbound[i];
61  }
62  }
63  }
64 
65 #ifndef NDEBUG
66  testBounds();
67  MSG_DEBUG( std::cout << "DSHIFT01 shiftFvec: OK" << std::endl; )
68 #endif
69 }
70 
71 // -----------------------------------------------------------------
72 
73 /*
74  This methods assumes correctly setup vectors |pVec| and |coPvec| and bound
75  vectors for leaving simplex. Then it checks all values of |pVec| and
76  |coPvec| to obey these bounds and enlarges them if neccessary.
77  */
79 {
80 
81  /* the allowed tolerance is (rep() == ROW) ? feastol() : opttol() because thePvec is the primal vector in ROW and the
82  * dual vector in COLUMN representation; this is equivalent to leavetol()
83  */
84  Random mult(10.0 * leavetol(), 100.0 * leavetol());
85  Real allow = leavetol() - epsilon();
86  bool tmp;
87  int i;
88 
89  assert(type() == LEAVE);
90  assert(allow > 0.0);
91 
92  for (i = dim() - 1; i >= 0; --i)
93  {
94  tmp = !isBasic(coId(i));
95  if ((*theCoUbound)[i] + allow <= (*theCoPvec)[i] && tmp)
96  {
97  if ((*theCoUbound)[i] != (*theCoLbound)[i])
98  shiftUCbound(i, (*theCoPvec)[i] + Real(mult));
99  else
100  {
101  shiftUCbound(i, (*theCoPvec)[i]);
102  (*theCoLbound)[i] = (*theCoUbound)[i];
103  }
104  }
105  else if ((*theCoLbound)[i] - allow >= (*theCoPvec)[i] && tmp)
106  {
107  if ((*theCoUbound)[i] != (*theCoLbound)[i])
108  shiftLCbound(i, (*theCoPvec)[i] - Real(mult));
109  else
110  {
111  shiftLCbound(i, (*theCoPvec)[i]);
112  (*theCoUbound)[i] = (*theCoLbound)[i];
113  }
114  }
115  }
116 
117  for (i = coDim() - 1; i >= 0; --i)
118  {
119  tmp = !isBasic(id(i));
120  if ((*theUbound)[i] + allow <= (*thePvec)[i] && tmp)
121  {
122  if ((*theUbound)[i] != (*theLbound)[i])
123  shiftUPbound(i, (*thePvec)[i] + Real(mult));
124  else
125  {
126  shiftUPbound(i, (*thePvec)[i]);
127  (*theLbound)[i] = (*theUbound)[i];
128  }
129  }
130  else if ((*theLbound)[i] - allow >= (*thePvec)[i] && tmp)
131  {
132  if ((*theUbound)[i] != (*theLbound)[i])
133  shiftLPbound(i, (*thePvec)[i] - Real(mult));
134  else
135  {
136  shiftLPbound(i, (*thePvec)[i]);
137  (*theUbound)[i] = (*theLbound)[i];
138  }
139  }
140  }
141 
142 #ifndef NDEBUG
143  testBounds();
144  MSG_DEBUG( std::cout << "DSHIFT02 shiftPvec: OK" << std::endl; )
145 #endif
146 }
147 // -----------------------------------------------------------------
149  const UpdateVector& uvec,
150  Vector& p_low,
151  Vector& p_up,
152  Real eps,
153  Real p_delta,
154  int start,
155  int incr)
156 {
157  assert(uvec.dim() == p_low.dim());
158  assert(uvec.dim() == p_up.dim());
159 
160  const Real* vec = uvec.get_const_ptr();
161  const Real* upd = uvec.delta().values();
162  const IdxSet& idx = uvec.delta().indices();
163  Random mult(10.0 * p_delta, 100.0 * p_delta);
164  Real x, l, u;
165  int i, j;
166 
167 #ifdef FULL_SHIFT
168  eps = p_delta;
169 
170  for (i = uvec.dim() - start - 1; i >= 0; i -= incr)
171  {
172  u = p_up[i];
173  l = p_low[i];
174 
175  if (p_up[i] <= vec[i] + eps)
176  {
177  p_up[i] = vec[i] + Real(mult);
178  theShift += p_up[i] - u;
179  }
180  if (p_low[i] >= vec[i] - eps)
181  {
182  p_low[i] = vec[i] - Real(mult);
183  theShift -= p_low[i] - l;
184  }
185  }
186 
187 #else // !FULL_SHIFT
188  for (j = uvec.delta().size() - start - 1; j >= 0; j -= incr)
189  {
190  i = idx.index(j);
191  x = upd[i];
192  u = p_up[i];
193  l = p_low[i];
194 
195  // do not permute these bounds! c.f. with computeFrhs2() in spxvecs.cpp
197  {
198  continue;
199  }
200 
201  if (x < -eps)
202  {
203  if (u != l && vec[i] >= u - eps)
204  {
205  p_up[i] = vec[i] + Real(mult);
206  theShift += p_up[i] - u;
207  }
208  }
209  else if (x > eps)
210  {
211  if (u != l && vec[i] <= l + eps)
212  {
213  p_low[i] = vec[i] - Real(mult);
214  theShift -= p_low[i] - l;
215  }
216  }
217  }
218 #endif // !FULL_SHIFT
219 }
220 // -----------------------------------------------------------------
222  const UpdateVector& uvec,
223  Vector& p_low,
224  Vector& p_up,
225  Real eps,
226  Real p_delta,
227  int start,
228  int incr)
229 {
230  assert(uvec.dim() == p_low.dim());
231  assert(uvec.dim() == p_up.dim());
232 
233  const Real* vec = uvec.get_const_ptr();
234  const Real* upd = uvec.delta().values();
235  const IdxSet& idx = uvec.delta().indices();
236  Random mult(10.0 * p_delta, 100.0 * p_delta);
237  Real x, l, u;
238  int i, j;
239 
240 #ifdef FULL_SHIFT
241  eps = p_delta;
242  for (i = uvec.dim() - start - 1; i >= 0; i -= incr)
243  {
244  u = p_up[i];
245  l = p_low[i];
246  if (p_up[i] <= vec[i] + eps)
247  {
248  p_up[i] = vec[i] + Real(mult);
249  theShift += p_up[i] - u;
250  }
251  if (p_low[i] >= vec[i] - eps)
252  {
253  p_low[i] = vec[i] - Real(mult);
254  theShift -= p_low[i] - l;
255  }
256  }
257 
258 #else // !FULL_SHIFT
259  for (j = uvec.delta().size() - start - 1; j >= 0; j -= incr)
260  {
261  i = idx.index(j);
262  x = upd[i];
263  u = p_up[i];
264  l = p_low[i];
265 
266  // do not permute these bounds! c.f. computeFrhs2() in spxvecs.cpp
268  {
269  continue;
270  }
271 
272  if (x > eps)
273  {
274  if (u != l && vec[i] >= u - eps)
275  {
276  p_up[i] = vec[i] + Real(mult);
277  theShift += p_up[i] - u;
278  }
279  }
280  else if (x < -eps)
281  {
282  if (u != l && vec[i] <= l + eps)
283  {
284  p_low[i] = vec[i] - Real(mult);
285  theShift -= p_low[i] - l;
286  }
287  }
288  }
289 #endif // !FULL_SHIFT
290 }
291 
293 {
294  MSG_DEBUG( std::cout << "DSHIFT03 iteration= " << iteration() << ": perturbing " << shift(); )
295  fVec().delta().setup();
297  MSG_DEBUG( std::cout << "\t->" << shift() << std::endl; )
298 }
299 
300 
302 {
303  MSG_DEBUG( std::cout << "DSHIFT04 iteration= " << iteration() << ": perturbing " << shift(); )
304  fVec().delta().setup();
306  MSG_DEBUG( std::cout << "\t->" << shift() << std::endl; )
307 }
308 
309 
311  const UpdateVector& uvec,
312  Vector& p_low,
313  Vector& p_up,
314  Real eps,
315  Real p_delta,
316  const SPxBasis::Desc::Status* stat,
317  int start,
318  int incr) const
319 {
320  assert(uvec.dim() == p_low.dim());
321  assert(uvec.dim() == p_up.dim());
322 
323  const Real* vec = uvec.get_const_ptr();
324  const Real* upd = uvec.delta().values();
325  const IdxSet& idx = uvec.delta().indices();
326  Random mult(10*p_delta, 100*p_delta);
327  Real x, l, u;
328  int i, j;
329  Real l_theShift = 0;
330 
331 #ifdef FULL_SHIFT
332  eps = p_delta;
333  for (i = uvec.dim() - start - 1; i >= 0; i -= incr)
334  {
335  u = p_up[i];
336  l = p_low[i];
337  if (p_up[i] <= vec[i] + eps && rep()*stat[i] < 0)
338  {
339  p_up[i] = vec[i] + Real(mult);
340  l_theShift += p_up[i] - u;
341  }
342  if (p_low[i] >= vec[i] - eps && rep()*stat[i] < 0)
343  {
344  p_low[i] = vec[i] - Real(mult);
345  l_theShift -= p_low[i] - l;
346  }
347  }
348 
349 #else // !FULL_SHIFT
350  for (j = uvec.delta().size() - start - 1; j >= 0; j -= incr)
351  {
352  i = idx.index(j);
353  x = upd[i];
354  u = p_up[i];
355  l = p_low[i];
356  if (x < -eps)
357  {
358  if (u != l && vec[i] >= u - eps && rep()*stat[i] < 0)
359  {
360  p_up[i] = vec[i] + Real(mult);
361  l_theShift += p_up[i] - u;
362  }
363  }
364  else if (x > eps)
365  {
366  if (u != l && vec[i] <= l + eps && rep()*stat[i] < 0)
367  {
368  p_low[i] = vec[i] - Real(mult);
369  l_theShift -= p_low[i] - l;
370  }
371  }
372  }
373 #endif // !FULL_SHIFT
374  return l_theShift;
375 }
376 
378  const UpdateVector& uvec,
379  Vector& p_low,
380  Vector& p_up,
381  Real eps,
382  Real p_delta,
383  const SPxBasis::Desc::Status* stat,
384  int start,
385  int incr) const
386 {
387  assert(uvec.dim() == p_low.dim());
388  assert(uvec.dim() == p_up.dim());
389 
390  const Real* vec = uvec.get_const_ptr();
391  const Real* upd = uvec.delta().values();
392  const IdxSet& idx = uvec.delta().indices();
393  Random mult(10*p_delta, 100*p_delta);
394  Real x, l, u;
395  int i, j;
396  Real l_theShift = 0;
397 
398 #ifdef FULL_SHIFT
399  eps = p_delta;
400  for (i = uvec.dim() - start - 1; i >= 0; i -= incr)
401  {
402  u = p_up[i];
403  l = p_low[i];
404  if (p_up[i] <= vec[i] + eps && rep()*stat[i] < 0)
405  {
406  p_up[i] = vec[i] + Real(mult);
407  l_theShift += p_up[i] - u;
408  }
409  if (p_low[i] >= vec[i] - eps && rep()*stat[i] < 0)
410  {
411  p_low[i] = vec[i] - Real(mult);
412  l_theShift -= p_low[i] - l;
413  }
414  }
415 
416 #else // !FULL_SHIFT
417  for (j = uvec.delta().size() - start - 1; j >= 0; j -= incr)
418  {
419  i = idx.index(j);
420  x = upd[i];
421  u = p_up[i];
422  l = p_low[i];
423  if (x > eps)
424  {
425  if (u != l && vec[i] >= u - eps && rep()*stat[i] < 0)
426  {
427  p_up[i] = vec[i] + Real(mult);
428  l_theShift += p_up[i] - u;
429  }
430  }
431  else if (x < -eps)
432  {
433  if (u != l && vec[i] <= l + eps && rep()*stat[i] < 0)
434  {
435  p_low[i] = vec[i] - Real(mult);
436  l_theShift -= p_low[i] - l;
437  }
438  }
439  }
440 #endif // !FULL_SHIFT
441  return l_theShift;
442 }
443 
444 
446 {
447  MSG_DEBUG( std::cout << "DSHIFT05 iteration= " << iteration() << ": perturbing " << shift(); )
448  pVec().delta().setup();
449  coPvec().delta().setup();
451  desc().status(), 0, 1);
453  desc().coStatus(), 0, 1);
454  MSG_DEBUG( std::cout << "\t->" << shift() << std::endl; )
455 }
456 
457 
459 {
460  MSG_DEBUG( std::cout << "DSHIFT06 iteration= " << iteration() << ": perturbing " << shift(); )
461  pVec().delta().setup();
462  coPvec().delta().setup();
464  desc().status(), 0, 1);
466  desc().coStatus(), 0, 1);
467  MSG_DEBUG( std::cout << "\t->" << shift() << std::endl; )
468 }
469 
470 
472 {
473  MSG_INFO3( (*spxout), (*spxout) << "DSHIFT07 = " << "unshifting ..." << std::endl; );
474 
475  if (isInitialized())
476  {
477  int i;
478  Real t_up, t_low;
479  const SPxBasis::Desc& ds = desc();
480 
481  theShift = 0;
482  if (type() == ENTER)
483  {
484  Real eps = entertol();
485 
486  if (rep() == COLUMN)
487  {
488  for (i = dim(); i-- > 0;)
489  {
490  SPxId l_id = baseId(i);
491  int l_num = number(l_id);
492  if (l_id.type() == SPxId::ROW_ID)
493  {
494  t_up = -lhs(l_num);
495  t_low = -rhs(l_num);
496  }
497  else
498  {
499  assert(l_id.type() == SPxId::COL_ID);
500  t_up = upper(l_num);
501  t_low = lower(l_num);
502  }
503  if (t_up != t_low)
504  {
505  if ((*theFvec)[i] < t_up + eps) // check allowed violation
506  theUBbound[i] = t_up; // reset shifted bound to original
507  else if ((*theFvec)[i] > t_up) // shifted bound is required for feasibility
508  theShift += theUBbound[i] - t_up;
509  if ((*theFvec)[i] > t_low - eps) // check allowed violation
510  theLBbound[i] = t_low; // reset shifted bound to original
511  else if ((*theFvec)[i] < t_low) // shifted bound is required for feasibility
512  theShift -= theLBbound[i] - t_low;
513  }
514  else
515  {
516  if (theUBbound[i] > t_up)
517  theShift += theUBbound[i] - t_up;
518  else if (theLBbound[i] < t_low)
519  theShift += t_low - theLBbound[i];
520  }
521  }
522  for (i = nRows(); i-- > 0;)
523  {
524  if (!isBasic(ds.rowStatus(i)))
525  {
526  t_up = -lhs(i);
527  t_low = -rhs(i);
528  if (theURbound[i] > t_up) // what about t_up == t_low ?
529  theShift += theURbound[i] - t_up;
530  if (t_low > theLRbound[i]) // what about t_up == t_low ?
531  theShift += t_low - theLRbound[i];
532  }
533  }
534  for (i = nCols(); i-- > 0;)
535  {
536  if (!isBasic(ds.colStatus(i)))
537  {
538  t_up = upper(i);
539  t_low = lower(i);
540  if (theUCbound[i] > t_up) // what about t_up == t_low ?
541  theShift += theUCbound[i] - t_up;
542  if (t_low > theLCbound[i]) // what about t_up == t_low ?
543  theShift += t_low - theLCbound[i];
544  }
545  }
546  }
547  else
548  {
549  assert(rep() == ROW);
550  for (i = dim(); i-- > 0;)
551  {
552  SPxId l_id = baseId(i);
553  int l_num = number(l_id);
554  t_up = t_low = 0;
555  if (l_id.type() == SPxId::ROW_ID)
556  clearDualBounds(ds.rowStatus(l_num), t_up, t_low);
557  else
558  clearDualBounds(ds.colStatus(l_num), t_up, t_low);
559  if (theUBbound[i] != theLBbound[i])
560  {
561  if (theUBbound[i] > t_up)
562  theShift += theUBbound[i] - t_up;
563  else
564  theShift -= theUBbound[i] - t_up;
565  }
566  else
567  {
568  /* if the basic (primal or dual) variable is fixed (e.g., basis status P_FREE in row representation)
569  * then shiftFvec() and shiftPvec() do not relax the bounds, but shift both, hence they may be outside
570  * of [t_low,t_up] */
571  assert(theLBbound[i] == theUBbound[i] || theUBbound[i] >= t_up);
572  assert(theLBbound[i] == theUBbound[i] || theLBbound[i] <= t_low);
573 
574  if ((*theFvec)[i] < t_up - eps)
575  theUBbound[i] = t_up;
576  else if ((*theFvec)[i] > t_up)
577  theShift += theUBbound[i] - t_up;
578 
579  if ((*theFvec)[i] > t_low + eps)
580  theLBbound[i] = t_low;
581  else if ((*theFvec)[i] < t_low)
582  theShift -= theLBbound[i] - t_low;
583  }
584  }
585  for (i = nRows(); i-- > 0;)
586  {
587  if (!isBasic(ds.rowStatus(i)))
588  {
589  t_up = t_low = 0;
590  clearDualBounds(ds.rowStatus(i), t_up, t_low);
591  if (theURbound[i] > t_up) // what about t_up == t_low ?
592  theShift += theURbound[i] - t_up;
593  if (t_low > theLRbound[i]) // what about t_up == t_low ?
594  theShift += t_low - theLRbound[i];
595  }
596  }
597  for (i = nCols(); i-- > 0;)
598  {
599  if (!isBasic(ds.colStatus(i)))
600  {
601  t_up = t_low = 0;
602  clearDualBounds(ds.colStatus(i), t_up, t_low);
603  if (theUCbound[i] > t_up) // what about t_up == t_low ?
604  theShift += theUCbound[i] - t_up;
605  if (t_low > theLCbound[i]) // what about t_up == t_low ?
606  theShift += t_low - theLCbound[i];
607  }
608  }
609  }
610  }
611  else
612  {
613  assert(type() == LEAVE);
614 
615  Real eps = leavetol();
616 
617  if (rep() == COLUMN)
618  {
619  for (i = nRows(); i-- > 0;)
620  {
621  t_up = t_low = maxRowObj(i);
622  clearDualBounds(ds.rowStatus(i), t_up, t_low);
623  if (!isBasic(ds.rowStatus(i)))
624  {
625  if ((*theCoPvec)[i] < t_up + eps)
626  {
627  theURbound[i] = t_up; // reset bound to original value
628  if( t_up == t_low )
629  theLRbound[i] = t_low; // for fixed rows we change both bounds
630  }
631  else
632  theShift += theURbound[i] - t_up;
633  if ((*theCoPvec)[i] > t_low - eps)
634  {
635  theLRbound[i] = t_low; // reset bound to original value
636  if( t_up == t_low )
637  theURbound[i] = t_up; // for fixed rows we change both bounds
638  }
639  else
640  theShift += t_low - theLRbound[i];
641  }
642  else if (theURbound[i] > t_up)
643  theShift += theURbound[i] - t_up;
644  else if (theLRbound[i] < t_low)
645  theShift += t_low - theLRbound[i];
646  }
647  for (i = nCols(); i-- > 0;)
648  {
649  t_up = t_low = -maxObj(i);
650  clearDualBounds(ds.colStatus(i), t_low, t_up);
651  if (!isBasic(ds.colStatus(i)))
652  {
653  if ((*thePvec)[i] < -t_up + eps)
654  {
655  theUCbound[i] = -t_up; // reset bound to original value
656  if( t_up == t_low )
657  theLCbound[i] = -t_low; // for fixed variables we change both bounds
658  }
659  else
660  theShift += theUCbound[i] - (-t_up);
661  if ((*thePvec)[i] > -t_low - eps)
662  {
663  theLCbound[i] = -t_low; // reset bound to original value
664  if( t_up == t_low )
665  theUCbound[i] = -t_up; // for fixed variables we change both bounds
666  }
667  else
668  theShift += (-t_low) - theLCbound[i];
669  }
670  else if (theUCbound[i] > -t_up)
671  theShift += theUCbound[i] - (-t_up);
672  else if (theLCbound[i] < -t_low)
673  theShift += (-t_low) - theLCbound[i];
674  }
675  }
676  else
677  {
678  assert(rep() == ROW);
679  for (i = nRows(); i-- > 0;)
680  {
681  t_up = rhs(i);
682  t_low = lhs(i);
683  if (t_up == t_low)
684  {
685  if (theURbound[i] > t_up)
686  theShift += theURbound[i] - t_up;
687  else
688  theShift += t_low - theLRbound[i];
689  }
690  else
691  if (!isBasic(ds.rowStatus(i)))
692  {
693  if ((*thePvec)[i] < t_up + eps)
694  theURbound[i] = t_up; // reset bound to original value
695  else
696  theShift += theURbound[i] - t_up;
697  if ((*thePvec)[i] > t_low - eps)
698  theLRbound[i] = t_low; // reset bound to original value
699  else
700  theShift += t_low - theLRbound[i];
701  }
702  else if (theURbound[i] > t_up)
703  theShift += theURbound[i] - t_up;
704  else if (theLRbound[i] < t_low)
705  theShift += t_low - theLRbound[i];
706  }
707  for (i = nCols(); i-- > 0;)
708  {
709  t_up = upper(i);
710  t_low = lower(i);
711  if (t_up == t_low)
712  {
713  if (theUCbound[i] > t_up)
714  theShift += theUCbound[i] - t_up;
715  else
716  theShift += t_low - theLCbound[i];
717  }
718  else
719  if (!isBasic(ds.colStatus(i)))
720  {
721  if ((*theCoPvec)[i] < t_up + eps)
722  theUCbound[i] = t_up; // reset bound to original value
723  else
724  theShift += theUCbound[i] - t_up;
725  if ((*theCoPvec)[i] > t_low - eps)
726  theLCbound[i] = t_low; // reset bound to original value
727  else
728  theShift += t_low - theLCbound[i];
729  }
730  else if (theUCbound[i] > t_up)
731  theShift += theUCbound[i] - t_up;
732  else if (theLCbound[i] < t_low)
733  theShift += t_low - theLCbound[i];
734  }
735  }
736  }
737  }
738 }
739 } // namespace soplex
virtual void unShift(void)
remove shift as much as possible.
Definition: spxshift.cpp:471
int dim() const
dimension of basis matrix.
Definition: spxsolver.h:936
int coDim() const
codimension.
Definition: spxsolver.h:941
const R * values() const
Returns array values.
Definition: ssvectorbase.h:288
Representation rep() const
return the current basis representation.
Definition: spxsolver.h:406
const VectorBase< Real > & maxObj() const
Returns objective vector for maximization problem.
Definition: spxlpbase.h:384
Desc::Status dualStatus(const SPxColId &id) const
dual Status for the column variable with ID id of the loaded LP.
Definition: spxbasis.cpp:34
SPxOut * spxout
message handler
Definition: spxsolver.h:384
DVector * theUbound
Upper bound for vars.
Definition: spxsolver.h:321
int iteration() const
returns number of basis changes since last load().
Definition: spxbasis.h:539
DVector * theCoUbound
Upper bound for covars.
Definition: spxsolver.h:323
const Vector & lbBound() const
lower bound for fVec.
Definition: spxsolver.h:1220
Random numbers.Class Random provides random Real variables, i.e. a value variable that gives another ...
Definition: random.h:38
Status & rowStatus(int i)
Definition: spxbasis.h:239
int number(const SPxRowId &id) const
Returns the row number of the row with identifier id.
Definition: spxlpbase.h:450
virtual void perturbMaxLeave(void)
perturb nonbasic bounds.
Definition: spxshift.cpp:458
const R * get_const_ptr() const
Conversion to C-style pointer.
Definition: vectorbase.h:412
UpdateVector & fVec() const
feasibility vector.
Definition: spxsolver.h:1184
const VectorBase< Real > & lower() const
Returns lower bound vector.
Definition: spxlpbase.h:420
virtual void perturbMinEnter(void)
Definition: spxshift.cpp:292
void shiftLBbound(int i, Real to)
shift i &#39;th lbBound to to.
Definition: spxsolver.h:1444
UpdateVector & pVec() const
pricing vector.
Definition: spxsolver.h:1339
const Vector & ubBound() const
upper bound for fVec.
Definition: spxsolver.h:1202
virtual void perturbMaxEnter(void)
perturb basis bounds.
Definition: spxshift.cpp:301
SPxId coId(int i) const
id of i &#39;th covector.
Definition: spxsolver.h:978
virtual Real shift() const
total current shift amount.
Definition: spxsolver.h:1482
const VectorBase< Real > & upper() const
Returns upper bound vector.
Definition: spxlpbase.h:402
rowwise representation.
Definition: spxsolver.h:107
Type type() const
returns the type of the id.
Definition: spxid.h:145
Wrapper for different output streams and verbosity levels.
int index(int n) const
access n &#39;th index.
Definition: idxset.h:118
Entering Simplex.
Definition: spxsolver.h:134
Generic Ids for LP rows or columns.Both SPxColIds and SPxRowIds may be treated uniformly as SPxIds: ...
Definition: spxid.h:85
Leaving Simplex.
Definition: spxsolver.h:143
void clearDualBounds(SPxBasis::Desc::Status, Real &, Real &) const
Definition: spxbounds.cpp:76
UpdateVector & coPvec() const
copricing vector.
Definition: spxsolver.h:1259
double Real
SOPLEX_DEBUG.
Definition: spxdefines.h:200
#define MSG_DEBUG(x)
Definition: spxdefines.h:127
void shiftLPbound(int i, Real to)
shift i &#39;th lpBound to to.
Definition: spxsolver.h:1458
DVector * theLbound
Lower bound for vars.
Definition: spxsolver.h:322
UpdateVector * thePvec
Definition: spxsolver.h:314
void testBounds() const
Definition: spxbounds.cpp:305
int nCols() const
Returns number of columns in LP.
Definition: spxlpbase.h:133
DVector theLBbound
Lower Basic Feasibility bound.
Definition: spxsolver.h:307
main LP solver class
void shiftPvec()
Perform initial shifting to optain an feasible or pricable basis.
Definition: spxshift.cpp:78
Dense vector with semi-sparse vector for updatesIn many algorithms vectors are updated in every itera...
Definition: updatevector.h:53
void shiftUCbound(int i, Real to)
shift i &#39;th ucBound to to.
Definition: spxsolver.h:1465
Basis descriptor.
Definition: spxbasis.h:104
DVector theURbound
Upper Row Feasibility bound.
Definition: spxsolver.h:296
int dim() const
Dimension of vector.
Definition: vectorbase.h:174
row identifier.
Definition: spxid.h:97
const Vector & lcBound() const
Definition: spxsolver.h:1299
Type type() const
return current Type.
Definition: spxsolver.h:412
column identifier.
Definition: spxid.h:99
Real entertol() const
feasibility tolerance maintained by ratio test during ENTER algorithm.
Definition: spxsolver.h:675
void shiftUBbound(int i, Real to)
shift i &#39;th ubBound to to.
Definition: spxsolver.h:1437
Status & colStatus(int i)
Definition: spxbasis.h:254
SPxId & baseId(int i)
Definition: spxbasis.h:497
DVector theUBbound
Upper Basic Feasibility bound.
Definition: spxsolver.h:306
const Vector & upBound() const
Definition: spxsolver.h:1344
DVector * theCoLbound
Lower bound for covars.
Definition: spxsolver.h:324
Debugging, floating point type and parameter definitions.
int nRows() const
Returns number of rows in LP.
Definition: spxlpbase.h:127
DVector theLRbound
Lower Row Feasibility bound.
Definition: spxsolver.h:297
void perturbMin(const UpdateVector &vec, Vector &low, Vector &up, Real eps, Real delta, int start=0, int incr=1)
Definition: spxshift.cpp:148
DVector theUCbound
Upper Column Feasibility bound.
Definition: spxsolver.h:298
const VectorBase< Real > & lhs() const
Returns left hand side vector.
Definition: spxlpbase.h:242
Everything should be within this namespace.
void shiftUPbound(int i, Real to)
shift i &#39;th upBound to to.
Definition: spxsolver.h:1451
void shiftLCbound(int i, Real to)
shift i &#39;th lcBound to to.
Definition: spxsolver.h:1472
UpdateVector * theFvec
Definition: spxsolver.h:310
const IdxSet & indices() const
Returns indices.
Definition: ssvectorbase.h:294
void setup()
Initializes nonzero indices for elements with absolute values above epsilon and sets all other elemen...
Definition: ssvectorbase.h:132
DVector theLCbound
Lower Column Feasibility bound.
Definition: spxsolver.h:299
virtual void perturbMinLeave(void)
Definition: spxshift.cpp:445
const Vector & lpBound() const
Definition: spxsolver.h:1365
Status status() const
Status of solution process.
Definition: spxsolve.cpp:1536
Real epsilon() const
values are considered to be 0.
Definition: spxsolver.h:670
void shiftFvec()
Perform initial shifting to optain an feasible or pricable basis.
Definition: spxshift.cpp:25
Real theShift
sum of all shifts applied to any bound.
Definition: spxsolver.h:242
const VectorBase< Real > & rhs() const
Returns right hand side vector.
Definition: spxlpbase.h:224
bool isInitialized() const
has the internal data been initialized?
Definition: spxsolver.h:1705
bool isBasic(SPxBasis::Desc::Status stat) const
does stat describe a basic index ?
Definition: spxsolver.h:1124
dual variable has two bounds
Definition: spxbasis.h:194
void perturbMax(const UpdateVector &vec, Vector &low, Vector &up, Real eps, Real delta, int start=0, int incr=1)
Definition: spxshift.cpp:221
const Desc & desc() const
Definition: spxbasis.h:457
SSVector & delta()
update vector , writeable
Definition: updatevector.h:122
#define MSG_INFO3(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO3.
Definition: spxdefines.h:117
UpdateVector * theCoPvec
Definition: spxsolver.h:313
const Vector & ucBound() const
Definition: spxsolver.h:1278
Status
Status of a variable.
Definition: spxbasis.h:185
Real leavetol() const
feasibility tolerance maintained by ratio test during LEAVE algorithm.
Definition: spxsolver.h:682
Set of indices.Class IdxSet provides a set of indices. At construction it must be given an array of i...
Definition: idxset.h:56
columnwise representation.
Definition: spxsolver.h:108
const VectorBase< Real > & maxRowObj() const
Definition: spxlpbase.h:286
int size() const
Returns the number of nonzeros.
Definition: ssvectorbase.h:199