File: testCopyconsAssignmentfunc.cpp

package info (click to toggle)
soplex 7.1.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,560 kB
  • sloc: cpp: 77,063; sh: 1,125; python: 672; makefile: 667; awk: 243; ansic: 93; php: 15
file content (641 lines) | stat: -rw-r--r-- 23,369 bytes parent folder | download | duplicates (2)
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*                                                                           */
/*                  This file is part of the class library                   */
/*       SoPlex --- the Sequential object-oriented simPlex.                  */
/*                                                                           */
/*  Copyright (c) 1996-2025 Zuse Institute Berlin (ZIB)                      */
/*                                                                           */
/*  Licensed under the Apache License, Version 2.0 (the "License");          */
/*  you may not use this file except in compliance with the License.         */
/*  You may obtain a copy of the License at                                  */
/*                                                                           */
/*      http://www.apache.org/licenses/LICENSE-2.0                           */
/*                                                                           */
/*  Unless required by applicable law or agreed to in writing, software      */
/*  distributed under the License is distributed on an "AS IS" BASIS,        */
/*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/*  See the License for the specific language governing permissions and      */
/*  limitations under the License.                                           */
/*                                                                           */
/*  You should have received a copy of the Apache-2.0 license                */
/*  along with SoPlex; see the file LICENSE. If not email to soplex@zib.de.  */
/*                                                                           */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */


#include <sstream>

#include <math.h>
#include <string.h>
#include <iostream>
#include <iomanip>
#include <fstream>

#include "spxdefines.h"
#include "soplex.h"
#include "spxsolver.h"
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>

#include "timer.h"
#include "spxpricer.h"
#include "spxdantzigpr.h"
#include "spxparmultpr.h"
#include "spxdevexpr.h"
#include "spxhybridpr.h"
#include "spxsteeppr.h"
#include "spxweightpr.h"
#include "spxratiotester.h"
#include "spxharrisrt.h"
#include "spxdefaultrt.h"
#include "spxfastrt.h"
#include "spxsimplifier.h"
#include "spxmainsm.h"
#include "spxscaler.h"
#include "spxequilisc.h"
#include "spxgeometsc.h"
#include "spxsumst.h"
#include "spxweightst.h"
#include "spxvectorst.h"
#include "slufactor.h"
#include "spxout.h"

using namespace soplex;

///see "soplex -help", s means Simplifier, g means Scaler, c means Starter, p for Pricer and t for Ratiotester
void set_s_g_c_p_t    (SoPlex& work,
		       const int simplifying,            // 0 for none and 1 for Main, please see "soplex -help"
		       const int scaling,                // see above
		       const int starting,
		       const int pricing,
		       const int ratiotest);
void set_simplifier   (SoPlex& work, const int simplifying);  // 0 for none and 1 for Main, please see "soplex -help"
void set_scalers      (SoPlex& work, const int scaling    );  // see above
void set_starter      (SoPlex& work, const int starting   );  // see above
void set_pricer       (SoPlex& work, const int pricing    );  // see above
void set_ratio_tester (SoPlex& work, const int ratiotest  );  // see above
double abs(double a, double b);

/** Unit test for copy constructors and assignment operators with random combinations of pricer,
 *  ratiotester, simplifier, scaler, and starter.
 *
 *  NOTE: Fails from singular bases usually come from using "bad" pricers or ratiotesters etc.,
 *  not from incorrect copying.   */

int main(int argc, const char* const argv[])
{
  if(argc < 2)
  {
    std::cerr << "You must input a test file name, e.g. quick.test." << std::endl;
    exit(0);
  }

  std::ifstream in;
  in.open(argv[argc-1]);

  if(!in)
  {
     std::cerr << "No such file "<< argv[argc-1] << " can be found," << std::endl;
    exit(0);
  }

  int times = 0;
  int succ_times = 0;
  const int num_rows_output = 6;
  const int num_type = 2;
  const int num_timepoint = 3;
  const int num_copies = 3;
  int cnt[num_rows_output];
  int pass[num_rows_output];
  int fail[num_rows_output];
  int singularBasis[num_rows_output];
  int bigErr[num_rows_output];
  std::string type[] = {"assign", "copy"};
  std::string timepoint[] = {"before_load", "after_load", "after_solve"};

  for(int num = 0; num < num_rows_output; ++num)
  {
     cnt[num]           = 0;
     pass[num]          = 0;
     fail[num]          = 0;
     singularBasis[num] = 0;
     bigErr[num]        = 0;
  }

  while(!in.eof())
  {
     std::string ffname;
     std::getline(in, ffname);
     if(ffname.length() > 1)
     {
	if(ffname[0] == '/' && ffname[0] == '/')
        {
           std::cout << ffname << "skipped\n";
           continue;
	}
	else
           times++;
	std::cout << "\n\n\nReading file " << ffname << "..." <<std::endl;
	std::string fname = "../check/LP/" + ffname;



        SoPlex lp_ori(SPxSolver::LEAVE, SPxSolver::COLUMN);
        lp_ori.tolerances()->setVerbose(0);
        set_s_g_c_p_t(lp_ori, 1, 1, 0, 4, 2);


        SoPlex lp[num_timepoint][num_type][num_copies] ;
        lp[0][1][0] = SoPlex(lp_ori);
        lp[0][1][1] = SoPlex(lp_ori);
        lp[0][1][2] = SoPlex(lp_ori);
        set_s_g_c_p_t(lp[0][1][0], 1, 1, 0, 0, 0);

        lp[0][0][0] = SoPlex(SPxSolver::LEAVE, SPxSolver::ROW);
        lp[0][0][1] = SoPlex(SPxSolver::ENTER, SPxSolver::COLUMN);
        lp[0][0][2] = SoPlex(SPxSolver::ENTER, SPxSolver::ROW);
        lp[0][0][0] = lp_ori;
        lp[0][0][1] = lp_ori;
        lp[0][0][2] = lp_ori;
        set_s_g_c_p_t(lp[0][0][0], 0, 4, 3, 3, 0);
        set_s_g_c_p_t(lp[0][0][2], 0, 0, 2, 4/*5*/, 2);

        lp[0][1][1].setType(SPxSolver::ENTER);
        lp[0][0][0].setRep(SPxSolver::ROW);

        if(!lp_ori.readFile(fname.c_str(), 0, 0, 0))
        {
           std::cout << "error while reading file '"  << fname.c_str() << "' -- terminating." << std::endl;
           exit(1);
        }

        // get the optimal objValue of the lp
        double optObjValue = 0.0;
        SoPlex* lp_cp_pr = new SoPlex(lp_ori);
        try{

           lp_cp_pr->optimize();
           if(lp_cp_pr->status() == SPxSolver::OPTIMAL)
           {
              std::cout << "Lp has been solved to optimality with default settings, objValue is " << lp_cp_pr->objValue() << std::endl;
           }
           else
           {
              std::cout << "Lp '"  << fname.c_str()
                        << "' has not been solved optimally with default settings -- terminating. (Choose a simpler test set!)"
                        << std::endl;
              exit(1);
           }
           optObjValue = lp_cp_pr->objValue();

           delete lp_cp_pr;

        }catch(SPxException& x) {
           std::cout << "exception caught : " << x.what() << std::endl;
        }

        lp[0][1][0].readFile(fname.c_str(), 0, 0, 0);
        lp[0][1][1].readFile(fname.c_str(), 0, 0, 0);
        lp[0][1][2].readFile(fname.c_str(), 0, 0, 0);
        set_s_g_c_p_t(lp[0][1][1], 0, 2, 2, 1, 1);
        set_s_g_c_p_t(lp[0][1][2], 1, 3, 1, 2, 2);

        lp[0][0][0].readFile(fname.c_str(), 0, 0, 0);
        lp[0][0][1].readFile(fname.c_str(), 0, 0, 0);
        lp[0][0][2].readFile(fname.c_str(), 0, 0, 0);
        set_s_g_c_p_t(lp[0][0][2], 0, 0, 2, 4/*5*/, 2);
        set_s_g_c_p_t(lp[0][0][1], 0, 0, 2, 4/*5*/, 2);
        //set_s_g_c_p_t(lp[0][0][1], 1, 2, 0, 4, 1);

        lp[0][1][2].setType(SPxSolver::ENTER);
        lp[0][0][1].setRep(SPxSolver::ROW);
        lp[0][0][1].setType(SPxSolver::LEAVE);

        /** test copy constructor and assignment function before soplex reads a lp    */


        int current_timepoint = 0;
        for(int n_type = 0; n_type < num_type; ++n_type)
        {
           int stat_idx = 2*current_timepoint + n_type;
           for(int n_time = 0; n_time < num_copies; ++n_time)
           {
              try{
                 (cnt[stat_idx])++;
                 lp[current_timepoint][n_type][n_time].optimize();
                 if(lp[current_timepoint][n_type][n_time].status() == SPxSolver::OPTIMAL)
                 {
                    double absError = abs(lp[current_timepoint][n_type][n_time].objValue(), optObjValue);
                    if(absError < lp[current_timepoint][n_type][n_time].delta() )
                    {
                       (pass[stat_idx])++;
                       std::cout << "lp_" << type[n_type] << "_" << timepoint[current_timepoint]
                                 << "_" << n_time <<  " solved, num of iterations is "
                                 << lp[current_timepoint][n_type][n_time].iteration() << std::endl;
                    }
                    else
                    {
                       if( absError / optObjValue <  lp[current_timepoint][n_type][n_time].delta() )
                       {
                          (pass[stat_idx])++;
                       }
                       else
                       {
                          (fail[stat_idx])++;
                          (bigErr[stat_idx])++;
                          std::cout << "lp_" << type[n_type] << "_" << timepoint[current_timepoint] << "_" << n_time <<  " solved "
                                    << "but does not have the same objValue with original, num of iterations is "
                                    << lp[current_timepoint][n_type][n_time].iteration() <<  ", the difference is "
                                    << abs(lp[current_timepoint][n_type][n_time].objValue(), optObjValue)  << std::endl;
                       }
                    }
                 }
              }catch(SPxException& x) {
                 (fail[stat_idx])++;
                 std::cout << "exception caught by" << " lp_" << type[n_type] << "_" << timepoint[current_timepoint] << "_" << n_time << " :"  << x.what() << std::endl;
                 std::string exceptionContent(x.what());
                 if(exceptionContent.find("XSOLVE21") != std::string::npos || exceptionContent.find("singular") != std::string::npos)
                 {
                    (singularBasis[stat_idx])++;
                 }
                 std::cout << "\n\n\n";
              }

           }
        }

        /** test copy constructor and assignment function after soplex reads a lp    */

        lp[1][1][0] = SoPlex(lp_ori);
        lp[1][1][1] = SoPlex(lp_ori);
        lp[1][1][2] = SoPlex(lp_ori);
        set_s_g_c_p_t(lp[1][1][0], 0, 2, 2, 1, 1);
        set_s_g_c_p_t(lp[1][1][1], 0, 4, 3, 3, 0);
        set_s_g_c_p_t(lp[1][1][2], 0, 0, 2, 4/*5*/, 2);

        lp[1][0][0] = SoPlex(SPxSolver::LEAVE, SPxSolver::ROW);
        lp[1][0][1] = SoPlex(SPxSolver::ENTER, SPxSolver::COLUMN);
        lp[1][0][2] = SoPlex(SPxSolver::ENTER, SPxSolver::ROW);
        set_s_g_c_p_t(lp[1][0][0], 1, 1, 0, 0, 0);
        lp[1][0][0] = lp_ori;
        lp[1][0][1] = lp_ori;
        lp[1][0][2] = lp_ori;
        set_s_g_c_p_t(lp[1][0][1], 1, 3, 1, 2, 2);
        set_s_g_c_p_t(lp[1][0][2], 1, 2, 0, 4, 1);


        lp[1][0][2].setType(SPxSolver::ENTER); // see above
        lp[1][1][2].setType(SPxSolver::ENTER);
        lp[1][0][0].setRep(SPxSolver::ROW);
        lp[1][0][1].setRep(SPxSolver::ROW);


        current_timepoint = 1;
        for(int n_type = 0; n_type < num_type; ++n_type)
        {
           int stat_idx = 2*current_timepoint + n_type;
           for(int n_time = 0; n_time < num_copies; ++n_time)
           {
              try{
                 (cnt[stat_idx])++;
                 lp[current_timepoint][n_type][n_time].optimize();
                 if(lp[current_timepoint][n_type][n_time].status() == SPxSolver::OPTIMAL)
                 {
                    double absError = abs(lp[current_timepoint][n_type][n_time].objValue(), optObjValue);
                    if(absError < lp[current_timepoint][n_type][n_time].delta() )
                    {
                       (pass[stat_idx])++;
                       std::cout << "lp_" << type[n_type] << "_"
                                 << timepoint[current_timepoint] << "_" << n_time
                                 <<  " solved, num of iterations is "
                                 << lp[current_timepoint][n_type][n_time].iteration() << std::endl;
                    }
                    else
                    {
                       if( absError / optObjValue <  lp[current_timepoint][n_type][n_time].delta() )
                       {
                          (pass[stat_idx])++;
                       }
                       else
                       {
                          (fail[stat_idx])++;
                          (bigErr[stat_idx])++;
                          std::cout << "lp_" << type[n_type] << "_" << timepoint[current_timepoint] << "_" << n_time <<  " solved "
                                    << "but does not have the same objValue with original, num of iterations is "
                                    << lp[current_timepoint][n_type][n_time].iteration() <<  ", the difference is "
                                    << abs(lp[current_timepoint][n_type][n_time].objValue(), optObjValue)  << std::endl;
                       }
                    }
                 }
              }catch(SPxException& x) {
                 (fail[stat_idx])++;
                 std::cout << "exception caught by" << " lp_" << type[n_type] << "_" << timepoint[current_timepoint] << "_" << n_time << " :"  << x.what() << std::endl;
                 std::string exceptionContent(x.what());
                 if(exceptionContent.find("XSOLVE21") != std::string::npos || exceptionContent.find("singular") != std::string::npos)
                 {
                    (singularBasis[stat_idx])++;
                 }
                 std::cout << "\n\n\n";
              }

           }
        }

        // solve the original problem

        try{

           lp_ori.optimize();
           if(lp_ori.status() == SPxSolver::OPTIMAL)
           {
              std::cout << "The original lp has been solved to optimality with default settings, num of iterations is "
                        << lp_ori.iteration() << std::endl;
           }
           else
           {
              std::cout << "The original lp '"  << fname.c_str()
                        << "' has not been solved optimally with default settings -- terminating. (Choose a simpler test set!)"
                        << std::endl;
              exit(1);
           }

        }catch(SPxException& x) {
           std::cout << "exception caught : " << x.what() << std::endl;
           std::cout << "\n\n\n";
        }


        /** test copy constructor and assignment function before soplex solved an lp    */


        lp[2][1][0] = SoPlex(lp_ori);
        lp[2][1][1] = SoPlex(lp_ori);
        lp[2][1][2] = SoPlex(lp_ori);
        set_s_g_c_p_t(lp[2][1][0], 1, 3, 1, 2, 2);
        set_s_g_c_p_t(lp[2][1][1], 0, 4, 3, 3, 0);
        set_s_g_c_p_t(lp[2][1][2], 1, 2, 0, 4, 1);


        lp[2][0][0] = SoPlex(SPxSolver::LEAVE, SPxSolver::ROW);
        lp[2][0][1] = SoPlex(SPxSolver::ENTER, SPxSolver::COLUMN);
        lp[2][0][2] = SoPlex(SPxSolver::ENTER, SPxSolver::ROW);
        set_s_g_c_p_t(lp[2][0][0], 1, 1, 0, 0, 0);

        lp[2][0][0] = lp_ori;
        lp[2][0][1] = lp_ori;
        lp[2][0][2] = lp_ori;
        set_s_g_c_p_t(lp[2][0][1], 0, 2, 2, 1, 1);
        set_s_g_c_p_t(lp[2][0][2], 0, 0, 2, 4/*5*/, 2);

        lp[2][1][0].setType(SPxSolver::ENTER);
        lp[2][0][2].setRep(SPxSolver::ROW);
        lp[2][0][1].setRep(SPxSolver::ROW);


        current_timepoint = 2;
        for(int n_type = 0; n_type < num_type; ++n_type)
        {
           int stat_idx = 2*current_timepoint + n_type;
           for(int n_time = 0; n_time < num_copies; ++n_time)
           {
              try{
                 (cnt[stat_idx])++;
                 lp[current_timepoint][n_type][n_time].optimize();
                 if(lp[current_timepoint][n_type][n_time].status() == SPxSolver::OPTIMAL)
                 {
                    double absError = abs(lp[current_timepoint][n_type][n_time].objValue(), optObjValue);
                    if(absError < lp[current_timepoint][n_type][n_time].delta() )
                    {
                       (pass[stat_idx])++;
                       std::cout << "lp_" << type[n_type] << "_" << timepoint[current_timepoint]
                                 << "_" << n_time <<  " solved, num of iterations is "
                                 << lp[current_timepoint][n_type][n_time].iteration() << std::endl;
                    }
                    else
                    {
                       if( absError / optObjValue <  lp[current_timepoint][n_type][n_time].delta() )
                       {
                          (pass[stat_idx])++;
                       }
                       else
                       {
                          (fail[stat_idx])++;
                          (bigErr[stat_idx])++;
                          std::cout << "lp_" << type[n_type] << "_" << timepoint[current_timepoint] << "_" << n_time <<  " solved "
                                    << "but does not have the same objValue with original, num of iterations is "
                                    << lp[current_timepoint][n_type][n_time].iteration() <<  ", the difference is "
                                    << abs(lp[current_timepoint][n_type][n_time].objValue(), optObjValue)  << std::endl;
                       }
                    }
                 }
              }catch(SPxException& x) {
                 (fail[stat_idx])++;
                 std::cout << "exception caught by" << " lp_"
                           << type[n_type] << "_" << timepoint[current_timepoint] << "_"
                           << n_time << " :"  << x.what() << std::endl;
                 std::string exceptionContent(x.what());
                 if(exceptionContent.find("XSOLVE21") != std::string::npos || exceptionContent.find("singular") != std::string::npos)
                 {
                    (singularBasis[stat_idx])++;
                 }
                 std::cout << "\n\n\n";
              }

           }
        }

     }
  }
  // test end

  // output the result
  std::cout << "\n\n";
  std::cout << "---------------------------------------------------------------------------------------\n";
  std::cout << "Type                                Cnt      Pass     Fail      SingularBasis    BigErr\n";
  std::cout << "---------------------------------------------------------------------------------------\n";

  for(int n_type = 0; n_type < num_type; ++n_type)
  {
     for(int n_timepoint = 0; n_timepoint < num_timepoint; ++n_timepoint)
     {
        int idx = 2*n_timepoint + n_type;
        std::cout << std::setw(14) << std::left <<  type[n_type]
                  << std::setw(14) << std::right <<  timepoint[n_timepoint]
                  << std::setw(11) << std::right <<  cnt[idx]
                  << std::setw(10) << std::right <<  pass[idx]
                  << std::setw(9) << std::right <<  fail[idx]
                  << std::setw(19) << std::right <<  singularBasis[idx]
                  << std::setw(10) << std::right <<  bigErr[idx]
                  << std::endl;
     }
  }

  int sum_cnt = 0;
  int sum_pass = 0;
  int sum_fail = 0;
  int sum_singularBasis = 0;
  int sum_bigErr = 0;

  for(int num = 0; num < num_rows_output; ++num)
  {
     sum_cnt += cnt[num];
     sum_pass += pass[num];
     sum_fail += fail[num];
     sum_singularBasis += singularBasis[num];
     sum_bigErr += bigErr[num];
  }

  std::cout << "---------------------------------------------------------------------------------------\n";
  std::cout << std::setw(14) << std::left <<  "Sum"
            << std::setw(14) << std::right <<  ""
            << std::setw(11) << std::right <<  sum_cnt
            << std::setw(10) << std::right <<  sum_pass
            << std::setw(9) << std::right <<  sum_fail
            << std::setw(19) << std::right <<  sum_singularBasis
            << std::setw(10) << std::right <<  sum_bigErr
            << std::endl;
  std::cout << "---------------------------------------------------------------------------------------\n";

}

void set_simplifier(SoPlex& work, const int simplifying)
{
   switch(simplifying)
   {
   case 1 :
     work.setSimplifier(new SPxMainSM(), true);
     break;
   case 0  :
     /*FALLTHROUGH*/
   default :
     break;
   }

}

void set_scalers(SoPlex& work, const int scaling)
{
   switch(scaling)
   {
   case 4:
     work.setPreScaler(new SPxEquiliSC(true), true);
     work.setPostScaler(new SPxGeometSC(8), true);
      break;
   case 3:
     work.setPreScaler(new SPxEquiliSC(true), true);
     work.setPostScaler(new SPxGeometSC(1), true);
      break;
   case 2 :
     work.setPreScaler(new SPxEquiliSC(true), true);
     work.setPostScaler(0, false);
      break;
   case 1 :
     work.setPreScaler(new SPxEquiliSC(false), true);
     work.setPostScaler(0, false);
      break;
   case 0 :
      /*FALLTHROUGH*/
   default :
     work.setPreScaler(0, false);
     work.setPostScaler(0, false);
      break;
   }
}

void set_starter(SoPlex& work, const int starting)
{
   switch(starting)
   {
   case 3 :
     work.setStarter(new SPxVectorST, true);
     break;
   case 2 :
     work.setStarter(new SPxSumST, true);
     break;
   case 1 :
     work.setStarter(new SPxWeightST, true);
     break;
   case 0 :
      /*FALLTHROUGH*/
   default :
     work.setStarter(0, false);
     break;
   }
}

void set_pricer(SoPlex& work, const int pricing)
{
   switch(pricing)
   {
   case 5 :
     work.setPricer(new SPxWeightPR, true);
     break;
   case 4 :
     work.setPricer(new SPxSteepPR, true);
     break;
   case 3 :
     work.setPricer(new SPxHybridPR, true);
      break;
   case 2 :
     work.setPricer(new SPxDevexPR, true);
     break;
   case 1 :
     work.setPricer(new SPxParMultPR, true);
     break;
   case 0 :
      /*FALLTHROUGH*/
   default :
     work.setPricer(new SPxDantzigPR, true);
     break;
   }
}

void set_ratio_tester(SoPlex& work, const int ratiotest)
{
   switch(ratiotest)
   {
   case 2 :
     work.setTester(new SPxFastRT, true);
     break;
   case 1 :
     work.setTester(new SPxHarrisRT, true);
     break;
   case 0 :
     /*FALLTHROUGH*/
   default:
     work.setTester(new SPxDefaultRT, true);
     break;
   }
}

void set_s_g_c_p_t    (SoPlex& work,
		       const int simplifying,
		       const int scaling,
		       const int starting,
		       const int pricing,
		       const int ratiotest)
{
  set_simplifier   (work,  simplifying);
  set_scalers      (work,  scaling    );
  set_starter      (work,  starting   );
  set_pricer       (work,  pricing    );
  set_ratio_tester (work,  ratiotest  );
}

double abs(double a, double b)
{
  if(a >= b)
    return a-b;
  else
    return b-a;
}

//-----------------------------------------------------------------------------
//Emacs Local Variables:
//Emacs mode:c++
//Emacs c-basic-offset:3
//Emacs tab-width:8
//Emacs indent-tabs-mode:nil
//Emacs End:
//-----------------------------------------------------------------------------