Clp 1.17.6

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OsiTestSolver.hpp
Go to the documentation of this file.
1 // Copyright (C) 2000, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 // This file is licensed under the terms of Eclipse Public License (EPL).
4
5 // this is a copy of VolVolume (stable/1.1 rev. 233)
6
7 #ifndef __OSITESTSOLVER_HPP__
8 #define __OSITESTSOLVER_HPP__
9
10 #include <cfloat>
11 #include <algorithm>
12 #include <cstdio>
13 #include <cmath>
14 #include <cstdlib>
15
16 #include "CoinFinite.hpp"
17
18 #ifndef VOL_DEBUG
19 // When VOL_DEBUG is 1, we check vector indices
20 #define VOL_DEBUG 0
21 #endif
22
23 template <class T> static inline T
24 VolMax(register const T x, register const T y) {
25 return ((x) > (y)) ? (x) : (y);
26 }
27
28 template <class T> static inline T
29 VolAbs(register const T x) {
30 return ((x) > 0) ? (x) : -(x);
31 }
32
33 //############################################################################
34
35 #if defined(VOL_DEBUG) && (VOL_DEBUG != 0)
36 #define VOL_TEST_INDEX(i, size) \
37 { \
38 if ((i) < 0 || (i) >= (size)) { \
39 printf("bad VOL_?vector index\n"); \
40 abort(); \
41 } \
42 }
43 #define VOL_TEST_SIZE(size) \
44 { \
45 if (s <= 0) { \
46 printf("bad VOL_?vector size\n"); \
47 abort(); \
48 } \
49 }
50 #else
51 #define VOL_TEST_INDEX(i, size)
52 #define VOL_TEST_SIZE(size)
53 #endif
54
55 //############################################################################
56
57 class VOL_dvector;
58 class VOL_ivector;
59 class VOL_primal;
60 class VOL_dual;
61 class VOL_swing;
62 class VOL_alpha_factor;
63 class VOL_vh;
64 class VOL_indc;
65 class VOL_user_hooks;
66 class VOL_problem;
67
68 //############################################################################
69
73 struct VOL_parms {
75 double lambdainit;
77 double alphainit;
79 double alphamin;
81 double alphafactor;
82
84 double ubinit;
85
87 double primal_abs_precision;
89 double gap_abs_precision;
91 double gap_rel_precision;
93 double granularity;
94
97 double minimum_rel_ascent;
99 int ascent_first_check;
102 int ascent_check_invl;
103
105 int maxsgriters;
106
117 int printflag;
119 int printinvl;
121 int heurinvl;
122
125 int greentestinvl;
128 int yellowtestinvl;
131 int redtestinvl;
132
134 int alphaint;
135
137 char* temp_dualfile;
138 };
139
140 //############################################################################
141
150 class VOL_dvector {
151 public:
153 double* v;
155 int sz;
156
157 public:
159 VOL_dvector(const int s) {
160 VOL_TEST_SIZE(s);
161 v = new double[sz = s];
162 }
164 VOL_dvector() : v(0), sz(0) {}
166 VOL_dvector(const VOL_dvector& x) : v(0), sz(0) {
167 sz = x.sz;
168 if (sz > 0) {
169 v = new double[sz];
170 std::copy(x.v, x.v + sz, v);
171 }
172 }
174 ~VOL_dvector() { delete[] v; }
175
177 inline int size() const {return sz;}
178
180 inline double& operator[](const int i) {
181 VOL_TEST_INDEX(i, sz);
182 return v[i];
183 }
184
186 inline double operator[](const int i) const {
187 VOL_TEST_INDEX(i, sz);
188 return v[i];
189 }
190
193 inline void clear() {
194 delete[] v;
195 v = 0;
196 sz = 0;
197 }
200 inline void cc(const double gamma, const VOL_dvector& w) {
201 if (sz != w.sz) {
202 printf("bad VOL_dvector sizes\n");
203 abort();
204 }
205 double * p_v = v - 1;
206 const double * p_w = w.v - 1;
207 const double * const p_e = v + sz;
208 const double one_gamma = 1.0 - gamma;
209 while ( ++p_v != p_e ){
210 *p_v = one_gamma * (*p_v) + gamma * (*++p_w);
211 }
212 }
213
216 inline void allocate(const int s) {
217 VOL_TEST_SIZE(s);
218 delete[] v;
219 v = new double[sz = s];
220 }
221
223 inline void swap(VOL_dvector& w) {
224 std::swap(v, w.v);
225 std::swap(sz, w.sz);
226 }
227
229 VOL_dvector& operator=(const VOL_dvector& w);
231 VOL_dvector& operator=(const double w);
232 };
233
234 //-----------------------------------------------------------------------------
244 class VOL_ivector {
245 public:
247 int* v;
249 int sz;
250 public:
252 VOL_ivector(const int s) {
253 VOL_TEST_SIZE(s);
254 v = new int[sz = s];
255 }
257 VOL_ivector() : v(0), sz(0) {}
259 VOL_ivector(const VOL_ivector& x) {
260 sz = x.sz;
261 if (sz > 0) {
262 v = new int[sz];
263 std::copy(x.v, x.v + sz, v);
264 }
265 }
267 ~VOL_ivector(){
268 delete [] v;
269 }
270
272 inline int size() const { return sz; }
274 inline int& operator[](const int i) {
275 VOL_TEST_INDEX(i, sz);
276 return v[i];
277 }
278
280 inline int operator[](const int i) const {
281 VOL_TEST_INDEX(i, sz);
282 return v[i];
283 }
284
287 inline void clear() {
288 delete[] v;
289 v = 0;
290 sz = 0;
291 }
292
295 inline void allocate(const int s) {
296 VOL_TEST_SIZE(s);
297 delete[] v;
298 v = new int[sz = s];
299 }
300
302 inline void swap(VOL_ivector& w) {
303 std::swap(v, w.v);
304 std::swap(sz, w.sz);
305 }
306
308 VOL_ivector& operator=(const VOL_ivector& v);
310 VOL_ivector& operator=(const int w);
311 };
312
313 //############################################################################
314 // A class describing a primal solution. This class is used only internally
315 class VOL_primal {
316 public:
317 // objective value of this primal solution
318 double value;
319 // the largest of the v[i]'s
320 double viol;
321 // primal solution
322 VOL_dvector x;
323 // v=b-Ax, for the relaxed constraints
324 VOL_dvector v;
325
326 VOL_primal(const int psize, const int dsize) : x(psize), v(dsize) {}
327 VOL_primal(const VOL_primal& primal) :
328 value(primal.value), viol(primal.viol), x(primal.x), v(primal.v) {}
329 ~VOL_primal() {}
330 inline VOL_primal& operator=(const VOL_primal& p) {
331 if (this == &p)
332 return *this;
333 value = p.value;
334 viol = p.viol;
335 x = p.x;
336 v = p.v;
337 return *this;
338 }
339
340 // convex combination. data members in this will be overwritten
341 // convex combination between two primal solutions
342 // x <-- alpha x + (1 - alpha) p.x
343 // v <-- alpha v + (1 - alpha) p.v
344 inline void cc(const double alpha, const VOL_primal& p) {
345 value = alpha * p.value + (1.0 - alpha) * value;
346 x.cc(alpha, p.x);
347 v.cc(alpha, p.v);
348 }
349 // find maximum of v[i]
350 void find_max_viol(const VOL_dvector& dual_lb,
351 const VOL_dvector& dual_ub);
352 };
353
354 //-----------------------------------------------------------------------------
355 // A class describing a dual solution. This class is used only internally
356 class VOL_dual {
357 public:
358 // lagrangian value
359 double lcost;
360 // reduced costs * (pstar-primal)
361 double xrc;
362 // this information is only printed
363 // dual vector
364 VOL_dvector u;
365
366 VOL_dual(const int dsize) : u(dsize) { u = 0.0;}
367 VOL_dual(const VOL_dual& dual) :
368 lcost(dual.lcost), xrc(dual.xrc), u(dual.u) {}
369 ~VOL_dual() {}
370 inline VOL_dual& operator=(const VOL_dual& p) {
371 if (this == &p)
372 return *this;
373 lcost = p.lcost;
374 xrc = p.xrc;
375 u = p.u;
376 return *this;
377 }
378 // dual step
379 void step(const double target, const double lambda,
380 const VOL_dvector& dual_lb, const VOL_dvector& dual_ub,
381 const VOL_dvector& v);
382 double ascent(const VOL_dvector& v, const VOL_dvector& last_u) const;
383 void compute_xrc(const VOL_dvector& pstarx, const VOL_dvector& primalx,
384 const VOL_dvector& rc);
385
386 };
387
388
389 //############################################################################
390 /* here we check whether an iteration is green, yellow or red. Also according
391 to this information we decide whether lambda should be changed */
392 class VOL_swing {
393 private:
394 VOL_swing(const VOL_swing&);
395 VOL_swing& operator=(const VOL_swing&);
396 public:
397 enum condition {green, yellow, red} lastswing;
398 int lastgreeniter, lastyellowiter, lastrediter;
399 int ngs, nrs, nys;
400 int rd;
401
402 VOL_swing() {
403 lastgreeniter = lastyellowiter = lastrediter = 0;
404 ngs = nrs = nys = 0;
405 }
406 ~VOL_swing(){}
407
408 inline void cond(const VOL_dual& dual,
409 const double lcost, const double ascent, const int iter) {
410 double eps = 1.e-3;
411
412 if (ascent > 0.0 && lcost > dual.lcost + eps) {
413 lastswing = green;
414 lastgreeniter = iter;
415 ++ngs;
416 rd = 0;
417 } else {
418 if (ascent <= 0 && lcost > dual.lcost) {
419 lastswing = yellow;
420 lastyellowiter = iter;
421 ++nys;
422 rd = 0;
423 } else {
424 lastswing = red;
425 lastrediter = iter;
426 ++nrs;
427 rd = 1;
428 }
429 }
430 }
431
432 inline double
433 lfactor(const VOL_parms& parm, const double lambda, const int iter) {
434 double lambdafactor = 1.0;
435 double eps = 5.e-4;
436 int cons;
437
438 switch (lastswing) {
439 case green:
440 cons = iter - VolMax(lastyellowiter, lastrediter);
441 if (parm.printflag & 4)
442 printf(" G: Consecutive Gs = %3d\n\n", cons);
443 if (cons >= parm.greentestinvl && lambda < 2.0) {
444 lastgreeniter = lastyellowiter = lastrediter = iter;
445 lambdafactor = 2.0;
446 if (parm.printflag & 2)
447 printf("\n ---- increasing lamda to %g ----\n\n",
448 lambda * lambdafactor);
449 }
450 break;
451
452 case yellow:
453 cons = iter - VolMax(lastgreeniter, lastrediter);
454 if (parm.printflag & 4)
455 printf(" Y: Consecutive Ys = %3d\n\n", cons);
456 if (cons >= parm.yellowtestinvl) {
457 lastgreeniter = lastyellowiter = lastrediter = iter;
458 lambdafactor = 1.1;
459 if (parm.printflag & 2)
460 printf("\n **** increasing lamda to %g *****\n\n",
461 lambda * lambdafactor);
462 }
463 break;
464
465 case red:
466 cons = iter - VolMax(lastgreeniter, lastyellowiter);
467 if (parm.printflag & 4)
468 printf(" R: Consecutive Rs = %3d\n\n", cons);
469 if (cons >= parm.redtestinvl && lambda > eps) {
470 lastgreeniter = lastyellowiter = lastrediter = iter;
471 lambdafactor = 0.67;
472 if (parm.printflag & 2)
473 printf("\n **** decreasing lamda to %g *****\n\n",
474 lambda * lambdafactor);
475 }
476 break;
477 }
478 return lambdafactor;
479 }
480
481 inline void
482 print() {
483 printf("**** G= %i, Y= %i, R= %i ****\n", ngs, nys, nrs);
484 ngs = nrs = nys = 0;
485 }
486 };
487
488 //############################################################################
489 /* alpha should be decreased if after some number of iterations the objective
490 has increased less that 1% */
491 class VOL_alpha_factor {
492 private:
493 VOL_alpha_factor(const VOL_alpha_factor&);
494 VOL_alpha_factor& operator=(const VOL_alpha_factor&);
495 public:
496 double lastvalue;
497
498 VOL_alpha_factor() {lastvalue = -COIN_DBL_MAX;}
499 ~VOL_alpha_factor() {}
500
501 inline double factor(const VOL_parms& parm, const double lcost,
502 const double alpha) {
503 if (alpha < parm.alphamin)
504 return 1.0;
505 register const double ll = VolAbs(lcost);
506 const double x = ll > 10 ? (lcost-lastvalue)/ll : (lcost-lastvalue);
507 lastvalue = lcost;
508 return (x <= 0.01) ? parm.alphafactor : 1.0;
509 }
510 };
511
512 //############################################################################
513 /* here we compute the norm of the conjugate direction -hh-, the norm of the
514 subgradient -norm-, the inner product between the subgradient and the
515 last conjugate direction -vh-, and the inner product between the new
516 conjugate direction and the subgradient */
517 class VOL_vh {
518 private:
519 VOL_vh(const VOL_vh&);
520 VOL_vh& operator=(const VOL_vh&);
521 public:
522 double hh;
523 double norm;
524 double vh;
525 double asc;
526
527 VOL_vh(const double alpha,
528 const VOL_dvector& dual_lb, const VOL_dvector& dual_ub,
529 const VOL_dvector& v, const VOL_dvector& vstar,
530 const VOL_dvector& u);
531 ~VOL_vh(){}
532 };
533
534 //############################################################################
535 /* here we compute different parameter to be printed. v2 is the square of
536 the norm of the subgradient. vu is the inner product between the dual
537 variables and the subgradient. vabs is the maximum absolute value of
538 the violations of pstar. asc is the inner product between the conjugate
539 direction and the subgradient */
540 class VOL_indc {
541 private:
542 VOL_indc(const VOL_indc&);
543 VOL_indc& operator=(const VOL_indc&);
544 public:
545 double v2;
546 double vu;
547 double vabs;
548 double asc;
549
550 public:
551 VOL_indc(const VOL_dvector& dual_lb, const VOL_dvector& dual_ub,
552 const VOL_primal& primal, const VOL_primal& pstar,
553 const VOL_dual& dual);
554 ~VOL_indc() {}
555 };
556
557 //#############################################################################
558
565 class VOL_user_hooks {
566 public:
567 virtual ~VOL_user_hooks() {}
568 public:
569 // for all hooks: return value of -1 means that volume should quit
574 virtual int compute_rc(const VOL_dvector& u, VOL_dvector& rc) = 0;
575
584 virtual int solve_subproblem(const VOL_dvector& dual, const VOL_dvector& rc,
585 double& lcost, VOL_dvector& x, VOL_dvector& v,
586 double& pcost) = 0;
593 virtual int heuristics(const VOL_problem& p,
594 const VOL_dvector& x, double& heur_val) = 0;
595 };
596
597 //#############################################################################
598
607 class VOL_problem {
608 private:
609 VOL_problem(const VOL_problem&);
610 VOL_problem& operator=(const VOL_problem&);
611 void set_default_parm();
612 // ############ INPUT fields ########################
613 public:
617 VOL_problem();
620 VOL_problem(const char *filename);
622 ~VOL_problem();
624
630 int solve(VOL_user_hooks& hooks, const bool use_preset_dual = false);
632
633 private:
637 double alpha_;
639 double lambda_;
640 // This union is here for padding (so that data members would be
641 // double-aligned on x86 CPU
642 union {
644 int iter_;
645 double __pad0;
646 };
648
649 public:
650
654 double value;
656 VOL_dvector dsol;
658 VOL_dvector psol;
660 VOL_dvector viol;
662
666 VOL_parms parm;
668 int psize;
670 int dsize;
673 VOL_dvector dual_lb;
676 VOL_dvector dual_ub;
678
679 public:
683 int iter() const { return iter_; }
685 double alpha() const { return alpha_; }
687 double lambda() const { return lambda_; }
689
690 private:
694 void read_params(const char* filename);
695
697 int initialize(const bool use_preset_dual);
698
700 void print_info(const int iter,
701 const VOL_primal& primal, const VOL_primal& pstar,
702 const VOL_dual& dual);
703
706 double readjust_target(const double oldtarget, const double lcost) const;
707
715 double power_heur(const VOL_primal& primal, const VOL_primal& pstar,
716 const VOL_dual& dual) const;
718 };
719
720 #endif
VolAbs
static T VolAbs(register const T x)
Definition: OsiTestSolver.hpp:29
VOL_swing::yellow
Definition: OsiTestSolver.hpp:397
VOL_dual
Definition: OsiTestSolver.hpp:356
VOL_indc::vabs
double vabs
Definition: OsiTestSolver.hpp:547
VOL_alpha_factor::operator=
VOL_alpha_factor & operator=(const VOL_alpha_factor &)
VOL_parms::minimum_rel_ascent
double minimum_rel_ascent
terminate if the relative increase in lcost through ascent_check_invl steps is less than this ...
Definition: OsiTestSolver.hpp:97
VOL_parms::lambdainit
double lambdainit
initial value of lambda
Definition: OsiTestSolver.hpp:75
VOL_vh::norm
double norm
Definition: OsiTestSolver.hpp:523
VOL_indc::vu
double vu
Definition: OsiTestSolver.hpp:546
VOL_problem::lambda
double lambda() const
returns the value of lambda
Definition: OsiTestSolver.hpp:687
VOL_alpha_factor::VOL_alpha_factor
VOL_alpha_factor()
Definition: OsiTestSolver.hpp:498
VOL_user_hooks
The user hooks should be overridden by the user to provide the problem specific routines for the volu...
Definition: OsiTestSolver.hpp:565
VOL_problem::solve
int solve(VOL_user_hooks &hooks, const bool use_preset_dual=false)
Solve the problem using the hooks.
VOL_swing::green
Definition: OsiTestSolver.hpp:397
VOL_swing
Definition: OsiTestSolver.hpp:392
VOL_problem::iter
int iter() const
returns the iteration number
Definition: OsiTestSolver.hpp:683
VOL_swing::nrs
int nrs
Definition: OsiTestSolver.hpp:399
VOL_problem::psol
VOL_dvector psol
final primal solution (OUTPUT)
Definition: OsiTestSolver.hpp:658
VOL_primal::operator=
VOL_primal & operator=(const VOL_primal &p)
Definition: OsiTestSolver.hpp:330
VOL_primal::VOL_primal
VOL_primal(const int psize, const int dsize)
Definition: OsiTestSolver.hpp:326
VOL_dvector::VOL_dvector
VOL_dvector()
Default constructor creates a vector of size 0.
Definition: OsiTestSolver.hpp:164
VOL_problem::dsol
VOL_dvector dsol
final dual solution (INPUT/OUTPUT)
Definition: OsiTestSolver.hpp:656
VOL_TEST_SIZE
#define VOL_TEST_SIZE(size)
Definition: OsiTestSolver.hpp:52
VOL_swing::print
void print()
Definition: OsiTestSolver.hpp:482
VOL_dvector::swap
void swap(VOL_dvector &w)
swaps the vector with w.
Definition: OsiTestSolver.hpp:223
VOL_swing::lastgreeniter
int lastgreeniter
Definition: OsiTestSolver.hpp:398
VOL_swing::~VOL_swing
~VOL_swing()
Definition: OsiTestSolver.hpp:406
VOL_problem::dual_ub
VOL_dvector dual_ub
upper bounds for the duals (if 0 length, then filled with +inf) (INPUT)
Definition: OsiTestSolver.hpp:676
VOL_primal::cc
void cc(const double alpha, const VOL_primal &p)
Definition: OsiTestSolver.hpp:344
VOL_problem
This class holds every data for the Volume Algorithm and its solve method must be invoked to solve th...
Definition: OsiTestSolver.hpp:607
VOL_dual::lcost
double lcost
Definition: OsiTestSolver.hpp:359
VOL_parms::granularity
double granularity
terminate if best_ub - lcost &lt; granularity
Definition: OsiTestSolver.hpp:93
VOL_ivector::operator[]
int & operator[](const int i)
Return a reference to the i-th entry.
Definition: OsiTestSolver.hpp:274
VOL_swing::VOL_swing
VOL_swing()
Definition: OsiTestSolver.hpp:402
VOL_user_hooks::~VOL_user_hooks
virtual ~VOL_user_hooks()
Definition: OsiTestSolver.hpp:567
VOL_parms::ascent_check_invl
int ascent_check_invl
through how many iterations does the relative ascent have to reach a minimum
Definition: OsiTestSolver.hpp:102
VOL_parms::ubinit
double ubinit
initial upper bound of the value of an integer solution
Definition: OsiTestSolver.hpp:84
VOL_ivector::VOL_ivector
VOL_ivector()
Default constructor creates a vector of size 0.
Definition: OsiTestSolver.hpp:257
VOL_problem::read_params
void read_params(const char *filename)
Read in the parameters from the file filename.
VOL_ivector::~VOL_ivector
~VOL_ivector()
The destructor deletes the data array.
Definition: OsiTestSolver.hpp:267
VOL_indc::operator=
VOL_indc & operator=(const VOL_indc &)
VOL_problem::power_heur
double power_heur(const VOL_primal &primal, const VOL_primal &pstar, const VOL_dual &dual) const
Here we decide the value of alpha1 to be used in the convex combination.
VOL_dvector::operator=
VOL_dvector & operator=(const VOL_dvector &w)
Copy w into the vector.
CoinFinite.hpp
VOL_swing::nys
int nys
Definition: OsiTestSolver.hpp:399
VOL_parms::alphafactor
double alphafactor
when little progress is being done, we multiply alpha by alphafactor
Definition: OsiTestSolver.hpp:81
VOL_swing::lastswing
enum VOL_swing::condition lastswing
VOL_parms::maxsgriters
int maxsgriters
maximum number of iterations
Definition: OsiTestSolver.hpp:105
VOL_dvector::operator[]
double & operator[](const int i)
Return a reference to the i-th entry.
Definition: OsiTestSolver.hpp:180
VOL_dual::ascent
double ascent(const VOL_dvector &v, const VOL_dvector &last_u) const
VOL_swing::lastyellowiter
int lastyellowiter
Definition: OsiTestSolver.hpp:398
VOL_ivector::clear
void clear()
Delete the content of the vector and replace it with a vector of length 0.
Definition: OsiTestSolver.hpp:287
VOL_ivector::allocate
void allocate(const int s)
delete the current vector and allocate space for a vector of size s.
Definition: OsiTestSolver.hpp:295
VOL_alpha_factor::factor
double factor(const VOL_parms &parm, const double lcost, const double alpha)
Definition: OsiTestSolver.hpp:501
VOL_vh::asc
double asc
Definition: OsiTestSolver.hpp:525
VOL_problem::value
double value
final lagrangian value (OUTPUT)
Definition: OsiTestSolver.hpp:654
VOL_parms::alphainit
double alphainit
initial value of alpha
Definition: OsiTestSolver.hpp:77
VOL_primal::find_max_viol
void find_max_viol(const VOL_dvector &dual_lb, const VOL_dvector &dual_ub)
VOL_problem::VOL_problem
VOL_problem()
Default constructor.
VOL_problem::alpha_
double alpha_
value of alpha
Definition: OsiTestSolver.hpp:637
VOL_swing::rd
int rd
Definition: OsiTestSolver.hpp:400
VOL_ivector::VOL_ivector
VOL_ivector(const VOL_ivector &x)
Copy constructor makes a replica of x.
Definition: OsiTestSolver.hpp:259
VOL_problem::dsize
int dsize
length of dual solution (INPUT)
Definition: OsiTestSolver.hpp:670
VOL_dvector::operator[]
double operator[](const int i) const
Return the i-th entry.
Definition: OsiTestSolver.hpp:186
VOL_dvector::allocate
void allocate(const int s)
delete the current vector and allocate space for a vector of size s.
Definition: OsiTestSolver.hpp:216
VOL_ivector::sz
int sz
The size of the vector.
Definition: OsiTestSolver.hpp:249
VOL_parms::printflag
int printflag
controls the level of printing.
Definition: OsiTestSolver.hpp:117
VOL_problem::iter_
int iter_
iteration number
Definition: OsiTestSolver.hpp:644
VOL_problem::lambda_
double lambda_
value of lambda
Definition: OsiTestSolver.hpp:639
VOL_swing::operator=
VOL_swing & operator=(const VOL_swing &)
VOL_problem::operator=
VOL_problem & operator=(const VOL_problem &)
VOL_ivector::operator=
VOL_ivector & operator=(const VOL_ivector &v)
Copy w into the vector.
VOL_parms::gap_abs_precision
double gap_abs_precision
accept if abs gap is less than this
Definition: OsiTestSolver.hpp:89
VOL_primal::VOL_primal
VOL_primal(const VOL_primal &primal)
Definition: OsiTestSolver.hpp:327
VOL_parms::alphaint
int alphaint
number of iterations before we check if alpha should be decreased
Definition: OsiTestSolver.hpp:134
VOL_ivector::size
int size() const
Return the size of the vector.
Definition: OsiTestSolver.hpp:272
VOL_dvector::v
double * v
The array holding the vector.
Definition: OsiTestSolver.hpp:153
VOL_swing::red
Definition: OsiTestSolver.hpp:397
VOL_dual::~VOL_dual
~VOL_dual()
Definition: OsiTestSolver.hpp:369
VOL_swing::condition
condition
Definition: OsiTestSolver.hpp:397
VOL_dvector::VOL_dvector
VOL_dvector(const VOL_dvector &x)
Copy constructor makes a replica of x.
Definition: OsiTestSolver.hpp:166
VOL_parms::yellowtestinvl
int yellowtestinvl
how many consecutive yellow iterations are allowed before changing lambda
Definition: OsiTestSolver.hpp:128
VOL_vh::operator=
VOL_vh & operator=(const VOL_vh &)
VOL_indc::VOL_indc
VOL_indc(const VOL_indc &)
VOL_parms
This class contains the parameters controlling the Volume Algorithm.
Definition: OsiTestSolver.hpp:73
VOL_vh::hh
double hh
Definition: OsiTestSolver.hpp:522
VOL_problem::dual_lb
VOL_dvector dual_lb
lower bounds for the duals (if 0 length, then filled with -inf) (INPUT)
Definition: OsiTestSolver.hpp:673
VOL_dual::u
VOL_dvector u
Definition: OsiTestSolver.hpp:364
VOL_dvector::clear
void clear()
Delete the content of the vector and replace it with a vector of length 0.
Definition: OsiTestSolver.hpp:193
VOL_indc
Definition: OsiTestSolver.hpp:540
VOL_swing::ngs
int ngs
Definition: OsiTestSolver.hpp:399
VOL_parms::heurinvl
int heurinvl
controls how often we run the primal heuristic
Definition: OsiTestSolver.hpp:121
VOL_dual::VOL_dual
VOL_dual(const VOL_dual &dual)
Definition: OsiTestSolver.hpp:367
VOL_parms::greentestinvl
int greentestinvl
how many consecutive green iterations are allowed before changing lambda
Definition: OsiTestSolver.hpp:125
VOL_problem::initialize
int initialize(const bool use_preset_dual)
initializes duals, bounds for the duals, alpha, lambda
VOL_parms::gap_rel_precision
double gap_rel_precision
accept if rel gap is less than this
Definition: OsiTestSolver.hpp:91
VOL_alpha_factor
Definition: OsiTestSolver.hpp:491
VOL_problem::set_default_parm
void set_default_parm()
VOL_problem::psize
int psize
length of primal solution (INPUT)
Definition: OsiTestSolver.hpp:668
VOL_vh::vh
double vh
Definition: OsiTestSolver.hpp:524
VOL_primal::~VOL_primal
~VOL_primal()
Definition: OsiTestSolver.hpp:329
VOL_ivector::v
int * v
The array holding the vector.
Definition: OsiTestSolver.hpp:247
VOL_primal::v
VOL_dvector v
Definition: OsiTestSolver.hpp:324
VOL_ivector::swap
void swap(VOL_ivector &w)
swaps the vector with w.
Definition: OsiTestSolver.hpp:302
VOL_parms::printinvl
int printinvl
controls how often do we print
Definition: OsiTestSolver.hpp:119
VOL_indc::~VOL_indc
~VOL_indc()
Definition: OsiTestSolver.hpp:554
VOL_swing::lastrediter
int lastrediter
Definition: OsiTestSolver.hpp:398
VOL_dvector::~VOL_dvector
~VOL_dvector()
The destructor deletes the data array.
Definition: OsiTestSolver.hpp:174
VOL_parms::temp_dualfile
char * temp_dualfile
name of file for saving dual solution
Definition: OsiTestSolver.hpp:137
VOL_alpha_factor::lastvalue
double lastvalue
Definition: OsiTestSolver.hpp:496
VOL_problem::~VOL_problem
~VOL_problem()
Destruct the object.
VOL_problem::alpha
double alpha() const
returns the value of alpha
Definition: OsiTestSolver.hpp:685
VOL_alpha_factor::~VOL_alpha_factor
~VOL_alpha_factor()
Definition: OsiTestSolver.hpp:499
COIN_DBL_MAX
const double COIN_DBL_MAX
Definition: CoinFinite.hpp:18
VOL_parms::alphamin
double alphamin
minimum value for alpha
Definition: OsiTestSolver.hpp:79
VOL_dual::compute_xrc
void compute_xrc(const VOL_dvector &pstarx, const VOL_dvector &primalx, const VOL_dvector &rc)
VOL_indc::v2
double v2
Definition: OsiTestSolver.hpp:545
VOL_primal::x
VOL_dvector x
Definition: OsiTestSolver.hpp:322
VOL_ivector
vector of ints.
Definition: OsiTestSolver.hpp:244
VOL_dvector::cc
void cc(const double gamma, const VOL_dvector &w)
Convex combination.
Definition: OsiTestSolver.hpp:200
VOL_TEST_INDEX
#define VOL_TEST_INDEX(i, size)
Definition: OsiTestSolver.hpp:51
VOL_user_hooks::compute_rc
virtual int compute_rc(const VOL_dvector &u, VOL_dvector &rc)=0
compute reduced costs
VOL_ivector::VOL_ivector
VOL_ivector(const int s)
Construct a vector of size s.
Definition: OsiTestSolver.hpp:252
VOL_parms::ascent_first_check
int ascent_first_check
when to check for sufficient relative ascent the first time
Definition: OsiTestSolver.hpp:99
VOL_dual::xrc
double xrc
Definition: OsiTestSolver.hpp:361
VOL_indc::asc
double asc
Definition: OsiTestSolver.hpp:548
VOL_vh::VOL_vh
VOL_vh(const VOL_vh &)
VOL_problem::parm
VOL_parms parm
The parameters controlling the Volume Algorithm (INPUT)
Definition: OsiTestSolver.hpp:666
VOL_dvector
vector of doubles.
Definition: OsiTestSolver.hpp:150
VOL_parms::redtestinvl
int redtestinvl
how many consecutive red iterations are allowed before changing lambda
Definition: OsiTestSolver.hpp:131
VOL_primal
Definition: OsiTestSolver.hpp:315
VOL_dual::step
void step(const double target, const double lambda, const VOL_dvector &dual_lb, const VOL_dvector &dual_ub, const VOL_dvector &v)
VOL_dvector::size
int size() const
Return the size of the vector.
Definition: OsiTestSolver.hpp:177
VOL_dvector::sz
int sz
The size of the vector.
Definition: OsiTestSolver.hpp:155
VOL_vh
Definition: OsiTestSolver.hpp:517
VOL_swing::lfactor
double lfactor(const VOL_parms &parm, const double lambda, const int iter)
Definition: OsiTestSolver.hpp:433
VOL_problem::__pad0
double __pad0
Definition: OsiTestSolver.hpp:645
VOL_dvector::VOL_dvector
VOL_dvector(const int s)
Construct a vector of size s.
Definition: OsiTestSolver.hpp:159
VOL_user_hooks::solve_subproblem
virtual int solve_subproblem(const VOL_dvector &dual, const VOL_dvector &rc, double &lcost, VOL_dvector &x, VOL_dvector &v, double &pcost)=0
Solve the subproblem for the subgradient step.
VOL_primal::viol
double viol
Definition: OsiTestSolver.hpp:320
VOL_problem::viol
VOL_dvector viol
violations (b-Ax) for the relaxed constraints
Definition: OsiTestSolver.hpp:660
VOL_dual::VOL_dual
VOL_dual(const int dsize)
Definition: OsiTestSolver.hpp:366
VOL_ivector::operator[]
int operator[](const int i) const
Return the i-th entry.
Definition: OsiTestSolver.hpp:280
VOL_user_hooks::heuristics
virtual int heuristics(const VOL_problem &p, const VOL_dvector &x, double &heur_val)=0
Starting from the primal vector x, run a heuristic to produce an integer solution.
VOL_vh::~VOL_vh
~VOL_vh()
Definition: OsiTestSolver.hpp:531
VOL_parms::primal_abs_precision
double primal_abs_precision
accept if max abs viol is less than this
Definition: OsiTestSolver.hpp:87
VOL_swing::cond
void cond(const VOL_dual &dual, const double lcost, const double ascent, const int iter)
Definition: OsiTestSolver.hpp:408
VolMax
static T VolMax(register const T x, register const T y)
Definition: OsiTestSolver.hpp:24
VOL_problem::print_info
void print_info(const int iter, const VOL_primal &primal, const VOL_primal &pstar, const VOL_dual &dual)
print volume info every parm.printinvl iterations
VOL_dual::operator=
VOL_dual & operator=(const VOL_dual &p)
Definition: OsiTestSolver.hpp:370
VOL_primal::value
double value
Definition: OsiTestSolver.hpp:318
VOL_problem::readjust_target
double readjust_target(const double oldtarget, const double lcost) const
Checks if lcost is close to the target, if so it increases the target.