This file is indexed.

/usr/include/coin/OsiDylpSolverInterface.hpp is in coinor-libosi-dev 0.103.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
#ifndef OsiDylpSolverInterface_H
#define OsiDylpSolverInterface_H

/*! \legal
  Copyright (C) 2002, 2003, 2004.
  Lou Hafer, Stephen Tse, International Business Machines Corporation and
  others. All Rights Reserved.
  Copyright (C) 2005 -- 2007 Lou Hafer
*/

/*! \file OsiDylpSolverInterface.hpp
    \brief Declaration of COIN OSI layer for dylp.

  This file contains the declaration of the class OsiDylpSolverInterface
  (ODSI), an implementation of the COIN OSI layer for the dylp LP solver.
*/

/*
  sccs: @(#)OsiDylpSolverInterface.hpp	1.12	09/16/04
  cvs: $Id: OsiDylpSolverInterface.hpp 1312 2008-10-10 00:26:32Z lou $
*/

#include "OsiConfig.h"
#include <CoinPackedMatrix.hpp>
#include <OsiSolverInterface.hpp>
#include <CoinWarmStart.hpp>
#include <CoinMessageHandler.hpp>
#include <CoinMpsIO.hpp>
#include <CoinPresolveMatrix.hpp>

#define DYLP_INTERNAL
extern "C" {
#include "dylp.h"
}

/*! \brief Enum to specify cold/warm/hot start */

typedef enum { startInvalid = 0,
	       startCold = 1, startWarm, startHot } ODSI_start_enum ;


/*! \class OsiDylpSolverInterface
    \brief COIN OSI layer for dylp

  The class OsiDylpSolverInterface (ODSI) implements the public functions
  defined for a COIN OsiSolverInterface (OSI) object.

  <h3>OsiDylpSolverInterface Principles for Users</h3>

  In addition to the principles outlined for the OsiSolverInterface class,
  ODSI maintains the following:

  <strong>Construction of a Constraint System</strong>:
  A constraint system can be batch loaded from a file (MPS format) or from
  a data structure, or it can be built incrementally. When building a
  constraint system incrementally, keep in mind that you must create a row
  or column (addRow or addCol, respectively) before you can adjust other
  properties (row or column bounds, objective, variable values, <i>etc</i>.)

  <strong>Existence of a Solution</strong>:
  For proper operation, OSI requires that a SI maintain a basic primal solution
  at all times after a problem has been loaded.

  <p>
  When a problem is loaded, ODSI generates a basic primal solution (primal
  variable values and a matching basis).
  The solution is not necessarily primal or dual feasible.
  In terms of the objective function, this solution is pessimistic, but
  not necessarily worst-case.
  ODSI does not generate matching values for the dual variables (row prices).

  <p>
  Any successful call to dylp (<i>i.e.</i>, a call that results in an optimal,
  infeasible, or unbounded result, or that terminates on iteration limit) will
  replace the existing solution with the result of the call to dylp.

  <p>
  It is possible to specify initial values for the primal and dual variables
  using setColSolution() and setRowPrice(). To specify an initial basis,
  see the documentation for the CoinWarmStartBasis and OsiDylpWarmStartBasis
  classes. When these functions are used, it is the responsibility of the
  client to ensure validity and consistency.

  <strong>Maintenance of an LP Basis</strong>
  Skirting the edges of the principle that changing the problem invalidates
  the solution, OsiDylp will maintain a valid basis across two common
  operations used in branch-and-cut: deletion of a loose constraint and
  deletion of a nonbasic variable. Arguably the set of allowable
  modifications could be increased.

  <strong>Assignment</strong>
  Assignment (#operator=()) works pretty much as you'd expect, with one
  exception. Only one ODSI object can control the dylp solver at a time,
  so hot start information is not copied on assignment.

  Detailed documentation is contained in OsiDylpSolverInterface.cpp, which
  is not normally scanned when generating COIN OSI layer documentation.
*/

class OsiDylpSolverInterface: virtual public OsiSolverInterface

{ friend int OsiDylpSolverInterfaceUnitTest(const std::string &mpsDir,
					     const std::string &netLibDir) ;

/*
  Consult the COIN OSI documentation or relevant source code for details
  not covered here. Supported functions are listed first, followed by
  unsupported functions.
*/

public:

/*! \name Constructors and Destructors */
//@{

  /*! \brief Default constructor */

  OsiDylpSolverInterface() ;

  /*! \brief Copy constructor */

  OsiDylpSolverInterface(const OsiDylpSolverInterface &src) ;

  /*! \brief Clone the solver object */

  OsiSolverInterface* clone(bool copyData = true) const ;

  /*! \brief Assignment */

  OsiDylpSolverInterface &operator=(const OsiDylpSolverInterface &rhs) ;

  /*! \brief Destructor */

  ~OsiDylpSolverInterface() ;

  /*! \brief Reset the solver object to the state produced by the default
	     constructor.
  */

  void reset() ;

//@}

/*! \name Methods to load a problem */
//@{

  /*! \brief Read a problem description in MPS format from a file.  */

  int readMps(const char *filename, const char *extension = "mps") ;

  /*! \brief Read a problem description in MPS format from a file, including
	     SOS information.
  */

  int readMps(const char *filename, const char *extension,
	      int &numberSets, CoinSet **&sets) ;

  /*! \brief Write the problem into the specified file in MPS format.
  
    \p objsense == 1 forces the file to be written as a maximisation problem,
    while -1 forces a minimisation problem. The default of 0 writes the file
    as maximisation or minimisation using the solver's current setting.
  */

  void writeMps(const char *basename,
		const char *extension = "mps",
		double objsense = 0.0) const ;

  /*! \brief Load a problem description (OSI packed matrix, row sense,
	  parameters unaffected).
  */
  void loadProblem(const CoinPackedMatrix &matrix,
		   const double *collb, const double *colub, const double *obj,
		   const char *rowsen, const double *rowrhs,
		   const double *rowrng) ;

  /*! \brief Load a problem description (OSI packed matrix, row bounds,
	  parameters unaffected).
  */
  void loadProblem(const CoinPackedMatrix &matrix,
		   const double *collb, const double *colub, const double *obj,
		   const double *rowlb, const double *rowub) ;
  
  /*! \brief Load a problem description (standard column-major packed
	  matrix, row sense, parameters unaffected)
  */
  void loadProblem(const int colcnt, const int rowcnt,
	       const int *start, const int *index, const double *value,
	       const double *collb, const double *colub, const double *obj,
	       const char *sense, const double *rhsin, const double *range) ;

  /*! \brief Load a problem description (standard column-major packed
	   matrix, row bounds, parameters unaffected)
  */
  void loadProblem(const int colcnt, const int rowcnt,
		   const int *start, const int *index, const double *value,
		   const double *collb, const double *colub, const double *obj,
		   const double *row_lower, const double *row_upper) ;

  /*! \brief Load a problem description (OSI packed matrix, row sense,
	  parameters destroyed).
  */
  void assignProblem(CoinPackedMatrix *&matrix,
		     double *&collb, double *&colub, double *&obj, 
		     char *&rowsen, double *&rowrhs, double *&rowrng) ;

  /*! \brief Load a problem description (OSI packed matrix, row bounds,
	  parameters destroyed).
  */
  void assignProblem(CoinPackedMatrix *&matrix,
		     double *&collb, double *&colub, double *&obj,
		     double *&rowlb, double *&rowub) ;

//@}

/*! \name Methods to obtain problem information */

//@{

  /*! \brief Get the number of columns (variables) */

  int getNumCols() const ;

  /*! \brief Get the number of rows (constraints) */

  int getNumRows() const ;

  /*! \brief Get the number of non-zero coefficients */

  int getNumElements() const ;

  /*! \brief Get the number of integer variables

    Counts both binary and general integer variables.
  */

  int getNumIntegers() const ;

  /*! \brief Get the column (variable) lower bound vector */

  const double* getColLower() const ;

  /*! \brief Get the column (variable) upper bound vector */

  const double* getColUpper() const ;

  /*! \brief Return true if the variable is continuous */

  bool isContinuous(int colIndex) const ;

  /*! \brief Return true if the variable is binary */

  bool isBinary(int colIndex) const ;

  /*! \brief Return true if the variable is general integer */

  bool isIntegerNonBinary (int colIndex) const ;

  /*! \brief Return true if the variable is integer (general or binary) */

  bool isInteger (int colIndex) const ;

  /*! \brief Get the row sense (constraint type) vector */

  const char* getRowSense() const ;

  /*! \brief Get the row (constraint) right-hand-side vector */

  const double* getRightHandSide() const ;

  /*! \brief Get the row (constraint) range vector */

  const double* getRowRange() const ;

  /*! \brief Get the row (constraint) lower bound vector */

  const double* getRowLower() const ;

  /*! \brief Get the row (constraint) upper bound vector */

  const double* getRowUpper() const ;

  /*! \brief Get the objective function coefficient vector */

  const double* getObjCoefficients() const ;

  /*! \brief Get the objective function sense (min/max)
  
    A value of 1 indicates minimisation; -1 indicates maximisation.
  */

  double getObjSense() const ;

  /*! \brief Get a pointer to a row-major copy of the constraint matrix */

  const CoinPackedMatrix *getMatrixByRow() const ;

  /*! \brief Get a pointer to a column-major copy of the constraint matrix */

  const CoinPackedMatrix *getMatrixByCol() const ;
//@}

/*! \name Methods to modify the problem */
//@{

  /*! \brief Set a single variable to be continuous. */

  void setContinuous(int index) ;

  /*! \brief Set a list of variables to be continuous. */

  void setContinuous(const int *indices, int len) ;

  /*! \brief Set a single variable to be integer. */

  void setInteger(int index) ;

  /*! \brief Set a list of variables to be integer. */

  void setInteger(const int *indices, int len) ;

  /*! \brief Set the lower bound on a column (variable) */

  void setColLower(int index, double value) ;
  using OsiSolverInterface::setColLower ;

  /*! \brief Set the upper bound on a column (variable) */

  void setColUpper(int index, double value) ;
  using OsiSolverInterface::setColUpper ;

  /*! \brief Set the lower bound on a row (constraint) */

  void setRowLower(int index, double value) ;

  /*! \brief Set the upper bound on a row (constraint) */

  void setRowUpper(int index, double value) ;

  /*! \brief Set the type of a row (constraint) */

  void setRowType(int index, char rowsen, double rowrhs, double rowrng) ;

  /*! \brief Set an objective function coefficient */

  void setObjCoeff (int index, double value) ;

  /*! \brief Set the sense (min/max) of the objective
  
    Use 1 for minimisation, -1 for maximisation. (The default is minimisation;
    the objective is multiplied by -1 to maximise.)
  */

  void setObjSense(double sense) ;

  /*! \brief Set the value of the primal variables in the problem solution */

  void setColSolution(const double *colsol) ;

  /*! \brief Set the value of the dual variables in the problem solution */

  void setRowPrice(const double*) ;

  /* For overload resolution with OSI::addCol functions. */

  using OsiSolverInterface::addCol ;

  /*! \brief Add a column (variable) to the problem */

  void addCol(const CoinPackedVectorBase &vec,
	      const double collb, const double colub, const double obj) ;

  /*! \brief Remove column(s) (variable(s)) from the problem */

  void deleteCols(const int num, const int *colIndices) ;

  /* For overload resolution with OSI::addRow functions. */

  using OsiSolverInterface::addRow ;

  /*! \brief Add a row (constraint) to the problem */

  void addRow(const CoinPackedVectorBase &row,
	      const double rowlb, const double rowub) ;

  /*! \brief Add a row (constraint) to the problem */

  void addRow(const CoinPackedVectorBase &row,
	      const char rowsen, const double rowrhs, const double rowrng) ;

  /*! \brief Delete row(s) (constraint(s)) from the problem */

  void deleteRows(const int num, const int *rowIndices) ;

  /*! \brief Apply a row (constraint) cut (add one constraint) */

  void applyRowCut(const OsiRowCut &cut) ;

  /*! \brief Apply a column (variable) cut (adjust one or more bounds) */

  void applyColCut(const OsiColCut &cut) ;
//@}

/*! \name Solve methods */
//@{

  /*! \brief Solve an lp from scratch */

  void initialSolve() ;

  /*! \brief Get an empty OsiDylpWarmStartBasis object */

  CoinWarmStart *getEmptyWarmStart () const ;

  /*! \brief Build a warm start object for the current lp solution. */

  CoinWarmStart *getWarmStart() const ;

  /*! \brief Apply a warm start object.
  
    By definition, a null parameter is a request to synch the warm start basis
    with the solver. ODSI interprets a 0x0 basis as a request to remove warm
    start information.
  */

  bool setWarmStart(const CoinWarmStart *warmStart) ;

  /*! \brief Call dylp to reoptimize (warm start). */

  void resolve() ;

  /*! \brief Create a hot start snapshot. */

  void markHotStart() ;

  /*! \brief Call dylp to reoptimize (hot start). */

  void solveFromHotStart() ;

  /*! \brief Delete the hot start snapshot. */

  void unmarkHotStart() ;

//@}

/*! \name Methods returning solver termination status */
//@{

  /*! \brief True if dylp abandoned the problem */

  bool isAbandoned() const ;

  /*! \brief True if dylp reported an optimal solution */

  bool isProvenOptimal() const ;

  /*! \brief True if dylp reported the problem to be primal infeasible */

  bool isProvenPrimalInfeasible() const ;

  /*! \brief True if dylp reported the problem to be dual infeasible (primal
	     unbounded)
  */
  bool isProvenDualInfeasible() const ;

  /*! \brief True if dylp reached the iteration limit */

  bool isIterationLimitReached() const ;

  /*! \brief Get the number of iterations for the last lp */

  int getIterationCount() const ;

  /*! \brief Is the primal objective limit reached?
  
    Put in different terms, quit when the objective value becomes better
    than the given limit for an acceptable value.
  */
  bool isPrimalObjectiveLimitReached() const ;

  /*! \brief Is the dual objective limit reached?
  
    Put in different terms, quit when the objective value becomes worse
    than the given limit for an acceptable value.
  */
  bool isDualObjectiveLimitReached() const ;
//@}


/*! \name Methods to set/get solver parameters */
//@{

  /*! \brief Get dylp's value for infinity */

  double getInfinity() const ;

  /*! \brief Set an OSI integer parameter */

  bool setIntParam(OsiIntParam key, int value) ;

  /*! \brief Set an OSI double parameter */

  bool setDblParam(OsiDblParam key, double value) ;

  /*! \brief Set an OSI string parameter */

  bool setStrParam(OsiStrParam key, const std::string& value) ;

  /*! \brief Set an OSI hint */

  bool setHintParam(OsiHintParam key, bool sense = true,
		    OsiHintStrength strength = OsiHintTry, void *info = 0) ;

  /*! \brief Get an OSI integer parameter */

  bool getIntParam(OsiIntParam key, int &value) const ;

  /*! \brief Get an OSI double parameter */

  bool getDblParam(OsiDblParam key, double &value) const ;

  /*! \brief Get an OSI string parameter */

  bool getStrParam(OsiStrParam key, std::string &value) const ;

  /* For overload resolution with OSI::getHintParam functions. */

  using OsiSolverInterface::getHintParam ;

  /*! \brief Get an OSI hint */

  bool getHintParam(OsiHintParam key, bool &sense,
		    OsiHintStrength &strength, void *&info) const ;

  /*! \brief Change the language for OsiDylp messages */

  inline void newLanguage(CoinMessages::Language language)
  { setOsiDylpMessages(language) ; }

  /*! \brief An alias for OsiDylpSolverInterface::newLanguage. */

  inline void setLanguage(CoinMessages::Language language)
  { setOsiDylpMessages(language) ; }

//@}

/*! \name Methods to obtain solution information */
//@{

  /*! \brief Return the vector of primal variables for the solution */

  const double* getColSolution() const ; 

  /*! \brief Return the vector of dual variables for the solution */

  const double* getRowPrice() const ;

  /*! \brief Return the vector of reduced costs for the solution */

  const double* getReducedCost() const ;

  /*! \brief Return the vector of row activity for the solution */

  const double* getRowActivity() const ;

  /*! \brief Get the objective function value for the solution */

  double getObjValue() const ;

//@}

/*! \name Methods for row and column names.

  Only the set methods need to be overridden to ensure consistent names
  between OsiDylp and the OSI base class.
*/
//@{

  /*! \brief Set the objective function name */

  void setObjName (std::string name) ;

  /*! \brief Set a row name

    Quietly does nothing if the name discipline (#OsiNameDiscipline) is
    auto. Quietly fails if the row index is invalid.
  */
  void setRowName(int ndx, std::string name) ;

  /*! \brief Set a column name

    Quietly does nothing if the name discipline (#OsiNameDiscipline) is
    auto. Quietly fails if the column index is invalid.
  */
  void setColName(int ndx, std::string name) ;

//@}

/*! \name Debugging Methods */
//@{

  /*! \brief Activate the row cut debugger
  
    Activate the debugger for a model known to the debugger. The debugger
    will consult an internal database for an optimal solution vector.
  */

  void activateRowCutDebugger (const char * modelName) ;

  /*! \brief Activate the row cut debugger
  
    Activate the debugger for a model not included in the debugger's internal
    database. \p solution must be a full solution vector, but only the
    integer values need to be correct.
  */

  void activateRowCutDebugger (const double *solution) ;

# if ODSI_PARANOIA >= 1
  /*! \brief Check that a row or column index is in range

    Check that a row or column index is in range for the current constraint
    system. This routine will throw an error if there is no constraint system
    or if the index is out of range.

    NOTE that ODSI_PARANOIA must be 1 or greater in order for OsiCbc(dylp)
    to pass the OsiCbc unit test.
  */
  void indexCheck (int k, bool isCol, std::string rtnnme) ;
# endif

//@}

/*! \name Dylp-specific methods */
//@{

  /*! \brief Process an options (.spc) file */

  void dylp_controlfile(const char* name, const bool silent,
			const bool mustexist = true) ;

  /*! \brief Establish a log file */

  void dylp_logfile(const char* name, bool echo = false) ;

  /*! \brief Establish an output (solution and/or statistics) file */

  void dylp_outfile(const char* name) ;

  /*! \brief Print the solution and/or statistics to the output file. */

  void dylp_printsoln(bool wantSoln, bool wantStats) ;

  /*! \brief Set the language for messages */

  void setOsiDylpMessages(CoinMessages::Language local_language) ;

//@}

/*! \name Unsupported functions */
//@{


  /*! \brief Invoke the solver's built-in branch-and-bound algorithm. */

  void branchAndBound() ;

  /*! \brief Get as many dual rays as the solver can provide */

  std::vector<double *> getDualRays(int) const ;

  /*! \brief Get as many primal rays as the solver can provide */

  std::vector<double *> getPrimalRays(int) const ;
//@}

/*! \name Dylp data structures

  These structures contain dylp control options and tolerances.
*/
/*
  Leave them visible to the public for the nonce, until a better programmatic
  interface is available. Initialized by the constructor.
*/
//@{

  lpopts_struct *initialSolveOptions,*resolveOptions ;
  lptols_struct *tolerances ;

//@}

private:

/*
  Private implementation state and helper functions. If you're contemplating
  using any of these, you should have a look at the code.
  See OsiDylpSolverInterface.cpp for descriptions.
*/ 
/*! \name Dylp data structures

  These fields hold pointers to the data structures which are used to pass an
  lp problem to dylp.
*/
//@{

  consys_struct *consys ;
  lpprob_struct *lpprob ;
  lpstats_struct *statistics ;

//@}

/*! \name Dylp residual control variables */
//@{

  static int reference_count ;
  static bool basis_ready ;
  static OsiDylpSolverInterface *dylp_owner ;

//@}


/*! \name Solver instance control variables

  These variables maintain state for individual ODSI instances.
*/
//@{

  /*! \brief Output file for this ODSI instance
  
    Holds the name of the file that will be used to write out the solution and
    statistics.
  */

  ioid local_outchn ;

  /*! \brief Log file for this ODSI instance

    Holds the name of the file that will be used for dylp log information.
  */

  ioid local_logchn ;

  /*! \brief Controls output of log information to stdout
	     during initialSolve()
  */

  bool initial_gtxecho ;

  /*! \brief Controls output of log information to stdout
	     during resolve() and solveFromHotStart()
  */

  bool resolve_gtxecho ;

  /*! \brief Result of last call to solver for this ODSI instance
  
    The default value is lpINV (<i>i.e.</i>, the code is not valid). A call
    to dylp will set lp_retval to the dylp return code. Errors in the
    interface's interaction with other dylp routines will set this value to
    the return code given by the routine, or lpFATAL if the routine does not
    return anything more specific.
  */

  lpret_enum lp_retval ;

  /*! \brief Objective function sense for this ODSI instance

    Coded 1.0 to minimize (default), -1.0 to maximize.
  */

  double obj_sense ;

  /*! \brief The value of infinity */

  double odsiInfinity ;

  /*! \brief Solver name (dylp).  */

  const std::string solvername ;

  /*! \brief Array for info blocks associated with hints. */

  mutable void *info_[OsiLastHintParam] ;

  /*! \brief Allow messages from CoinMpsIO package. */

  bool mps_debug ;

  /*! \brief Warm start object used as a fallback for hot start
  
    If some other ODSI object uses the underlying solver between calls
    to #solveFromHotStart(), the solver must be reloaded. This basis is kept
    for just such a situation.
  */

  CoinWarmStart *hotstart_fallback ;

  /*! \brief Codes for basis condition

    - basisNone: no basis exists
    - basisFresh: the basis is in sync with the solver
    - basisModified: `good' constraint system modifications have occurred
    - basisDamaged: `bad' constraint system modifications have occurred

    `Good' modifications are deletion of a loose constraint (specifically, a
    constraint with a basic logical) or a variable at bound (specifically, a
    nonbasic variable). `Bad' modifications are deletion of a tight constraint
    (specifically, a constraint with a nonbasic logical) or deletion of a
    variable not at bound (specifically, a basic variable). Bad modifications
    will in general cause the basis to be primal and/or dual infeasible after
    it's patched up.

    A subtle point: basisModified will also be used in situations where ODSI
    has constructed a basis but not set it into a lpprob structure. This is the
    case when a solution is invented for a newly loaded problem.
  */

  enum basisCondition
  { basisNone = 0, basisFresh, basisModified, basisDamaged } ;

  /*! \brief Active basis

    The active basis is set with each successful return from the solver
    (where successful means a result of optimal, infeasible, unbounded, or
    iterlim), or by an explicit call to #setWarmStart() with a valid basis.
    By definition, calling #setWarmStart() with a null parameter is a request
    to synch the active basis with the solver (a noop for ODSI). Calling
    #setWarmStart() with an empty (0x0) basis is taken as a request to delete
    activeBasis.

    Condition will take a value from the #basisCondition enum (which see).

    Balance records whether we have an excess or shortage of basic variables.
    Deletion of tight constraints will result in an excess. Deletion of basic
    variables will result in a shortage.
  */

  struct
  { CoinWarmStart *basis ;
    basisCondition condition ;
    int balance ; } activeBasis ;

  /*! \brief The most recent solution from dylp is valid.

    True if the solution held in #lpprob is valid. False if changes to the
    constraint system have rendered the solution invalid.
  */
  bool solnIsFresh ;

//@}



/*! \name Cached problem information

  Problem information is cached for efficiency, to avoid repeated
  reconstruction of OSI structures from dylp structures.
*/
//@{

  mutable double _objval ;
  mutable double* _col_obj ;
  mutable double* _col_x ;
  mutable double* _col_cbar ;

  mutable double* _row_rhs ;
  mutable double* _row_lower ;
  mutable double* _row_upper ;
  mutable char* _row_sense ;
  mutable double* _row_range ;
  mutable double* _row_lhs ;
  mutable double* _row_price ;

  mutable CoinPackedMatrix* _matrix_by_col ;
  mutable CoinPackedMatrix* _matrix_by_row ;

//@}

/*! \name Data for presolve

  Data related to the use of the CoinPresolve capabilities (which see for
  further information).
*/
//@{

/*! \brief The presolve object

  In more detail, #preObj_ is loaded with the original system. Presolve
  transformations are applied to convert it to a presolved system.
*/
  CoinPresolveMatrix *preObj_ ;

/*! \brief List of postsolve actions

  The list of postsolve (reverse) transformations required to convert the
  presolved system back to the original system. Built as presolve
  transformations are applied.
*/
  const CoinPresolveAction *postActions_ ;

/*! \brief The postsolve object

  In more detail, #postObj_ is loaded with the presolved system and its
  optimal basis. The postsolve transformations held by #postActions_ are
  applied to convert back to the original system. For ODSI, our only interest
  is the basis.
*/
  CoinPostsolveMatrix *postObj_ ;

  /// Limit for iterations of the major presolve loop
  int passLimit_ ;

  /// true if presolve should consider integrality
  bool keepIntegers_ ;

  /// Saved copy of original problem
  consys_struct *savedConsys_ ;

  /// Saved pointers to cached structural vectors
  mutable double* saved_col_obj ;
  mutable double* saved_row_rhs ;
  mutable double* saved_row_lower ;
  mutable double* saved_row_upper ;
  mutable char* saved_row_sense ;
  mutable double* saved_row_range ;
  mutable CoinPackedMatrix* saved_matrix_by_col ;
  mutable CoinPackedMatrix* saved_matrix_by_row ;

//@}

/*! \name Helper functions for presolve

  Functions used to access the CoinPresolve capabilities. There are no public
  functions associated with presolve --- the only control is the
  OsiDoPresolveInInitial and OsiDoPresolveInResolve hints. The functions
  declared here do the work. See OsiDylpPresolve.cpp for additional
  explanation.
*/
//@{
  /// Create and load a presolve object.
  CoinPresolveMatrix *initialisePresolve(bool keepIntegers) ;

  /// Perform presolve transformations
  void doPresolve() ;

  /// Decide whether presolve was effective enough to use
  bool evalPresolve() ;

  /// Save the original problem
  void saveOriginalSys() ;

  /// Load the presolved problem into the ODSI object
  void installPresolve() ;

  /// Create and load a postsolve object
  CoinPostsolveMatrix *initialisePostsolve(CoinPresolveMatrix *&preObj) ;

  /// Apply the postsolve transforms from #postActions_
  void doPostsolve() ;

  /// Reload the original constraint system with the postsolved basis
  void installPostsolve() ;

  /// Delete presolve information
  void destruct_presolve() ;

//@}

/*! \name Helper functions for problem construction */

//@{
  void construct_lpprob() ;
  void construct_options() ;
  void construct_consys(int cols, int rows) ;
  void dylp_ioinit() ;
  void gen_rowparms(int rowcnt,
		    double *rhs, double *rhslow, contyp_enum *ctyp,
		    const double *rowlb, const double *rowub) ;
  void gen_rowparms(int rowcnt,
	       double *rhs, double *rhslow, contyp_enum *ctyp,
	       const char *sense, const double *rhsin, const double *range) ;
  void load_problem(const CoinMpsIO &mps) ;
  void load_problem(const CoinPackedMatrix &matrix,
	 const double* col_lower, const double* col_upper, const double* obj,
	 const contyp_enum *ctyp, const double* rhs, const double* rhslow) ;
  void load_problem (const int colcnt, const int rowcnt,
	 const int *start, const int *lens,
	 const int *index, const double *value,
	 const double* col_lower, const double* col_upper, const double* obj,
	 const contyp_enum *ctyp, const double* rhs, const double* rhslow) ;
//@}

/*! \name Helper functions for invoking dylp */
//@{
  /*! \brief Common core method to invoke dylp */
  lpret_enum do_lp (ODSI_start_enum start) ;
//@}

/*! \name Destructor helpers */
//@{
  void destruct_col_cache(bool structure) ;
  void destruct_row_cache(bool structure) ;
  void destruct_cache(bool rowStructure, bool colStructure) ;
  void destruct_problem(bool preserve_interface) ;
  void detach_dylp() ;
//@}


/*! \name Helper functions for problem modification */
/*
  There are separate groups for member and static methods so that doxygen
  won't promote the group to the top level.
*/
//@{
  
  void add_col(const CoinPackedVectorBase& coin_coli,
	       vartyp_enum vtypi, double vlbi,
	       double vubi, double obji, const std::string *nme) ;
  void add_row(const CoinPackedVectorBase& coin_rowi, 
	       char clazzi, contyp_enum ctypi,
	       double rhsi, double rhslowi, const std::string *nme) ;
  void calc_objval() ;
  contyp_enum bound_to_type(double lower, double upper) ;
  void gen_rowiparms(contyp_enum* ctypi, double* rhsi, double* rhslowi, 
			    char sensei, double rhsini, double rangei) ;
  void gen_rowiparms(contyp_enum* ctypi, double* rhsi, double* rhslowi, 
			    double rowlbi, double rowubi) ;
  void unimp_hint(bool dylpSense, bool hintSense,
		 OsiHintStrength hintStrength, const char *msgString) ;
  void pessimal_primal() ;
  void reduceActiveBasis() ;

//@}

/*! \name Helper functions for problem modification */
//@{
  static contyp_enum sense_to_type(char type) ;
  static char type_to_sense(contyp_enum type) ;
//@}

/*! \name Copy helpers

  Copy function templates for simple vectors and fixed-size objects, and
  specializations for various complex structures.
*/
//@{
  template<class T> static void copy(const T* src, T* dst, int n) ;
  template<class T> static T* copy(const T* src, int n) ;
  template<class T> static T* copy(const T* src) ;
/*
  Specializations for more complicated structures.
*/
  static basis_struct* copy_basis(const basis_struct* src, int dstsze) ;
  static void copy_basis(const basis_struct* src, basis_struct* dst) ;
  static lpprob_struct* copy_lpprob(const lpprob_struct* src) ;
//@}

#ifndef _MSC_VER
/*! \name Copy verification functions

  Copy verification functions, to check that two structures are identical.
*/
//@{
  template<class T> static void assert_same(const T& t1, const T& t2,
					    bool exact) ;
  template<class T> static void assert_same(const T* t1, const T* t2,
					    int n, bool exact) ;

  static void assert_same(double d1, double d2, bool exact) ;

  static void assert_same(const basis_struct& b1, 
  			  const basis_struct& b2, bool exact) ;
  static void assert_same(const consys_struct& c1, const 
			  consys_struct& c2, bool exact) ;
  static void assert_same(const conbnd_struct& c1, const 
			  conbnd_struct& c2, bool exact) ;
  static void assert_same(const lpprob_struct& l1, 
			  const lpprob_struct& l2, bool exact) ;
  static void assert_same(const OsiDylpSolverInterface& o1, 
			  const OsiDylpSolverInterface& o2, bool exact) ;
//@}
#endif	/* ! _MSC_VER */

/*! \name Vector helper functions */
//@{
  template<class T> static T* idx_vec(T* data) ;
  static int idx(int i) ;
  template<class T> static T* inv_vec(T* data) ;
  static int inv(int i) ;

  static pkvec_struct* packed_vector(
    const CoinShallowPackedVector vector, int dimension) ;
  static void packed_vector(
    const CoinShallowPackedVector vector, int dimension, pkvec_struct *dst) ;
//@}

/*! \name File i/o helper routines */
//@{
  static std::string make_filename(const char *filename, 
				   const char *ext1, const char *ext2) ;
//@}

} ;


/*
  OsiDylpSolverInterfaceTest.cpp
*/

/*! \relates OsiDylpSolverInterface
    \brief Unit test for OsiDylpSolverInterface.

    Performs various tests to see if ODSI is functioning correctly. Not
    an exhaustive test, but it'll (usually) catch gross problems.
*/

int OsiDylpSolverInterfaceUnitTest(const std::string & mpsDir,
				    const std::string &netLibDir) ;

#endif // OsiDylpSolverInterface_H