1 --- Osi-0.106.10/Osi/src/OsiGlpk/OsiGlpkSolverInterface.cpp.orig 2013-04-06 14:50:19.000000000 +0200
2 +++ Osi-0.106.10/Osi/src/OsiGlpk/OsiGlpkSolverInterface.cpp 2014-12-04 17:58:31.036909826 +0100
4 // In (much) earlier versions of GLPK, if an LPX_MIP problem was
5 // changed back into a LPX_LP problem, then the MIP data was lost,
6 // including which columns are integer. However, LPX_MIP problems
7 -// still had access to LP information (like lpx_get_status).
8 +// still had access to LP information (like glp_get_status).
10 // It appears that this behavior is no longer true in version 4.7.
11 // Therefore it may be worthwhile to adjust the interface to change
12 @@ -166,26 +166,26 @@ void OGSI::initialSolve()
16 - int err = lpx_simplex(model) ;
17 + int err = glp_simplex(model, &simplexParams_) ;
19 // for Glpk, a solve fails if the initial basis is invalid or singular
20 // thus, we construct a (advanced) basis first and try again
22 - if (err == LPX_E_BADB) {
23 - lpx_adv_basis(model);
24 - err = lpx_simplex(model) ;
26 + if (err == GLP_EBADB) {
27 + glp_adv_basis(model, 0);
28 + err = glp_simplex(model, &simplexParams_) ;
31 - if (err == LPX_E_SING || err == LPX_E_FAULT) {
32 - lpx_adv_basis(model);
33 - err = lpx_simplex(model) ;
34 + if (err == GLP_ESING || err == GLP_EFAIL) {
35 + glp_adv_basis(model, 0);
36 + err = glp_simplex(model, &simplexParams_) ;
39 - iter_used_ = lpx_get_int_parm(model, LPX_K_ITCNT) ;
40 + iter_used_ = glp_get_it_cnt(model) ;
42 Sort out the various state indications.
44 - When the presolver is turned on, lpx_simplex() will not be able to tell
45 + When the presolver is turned on, glp_simplex() will not be able to tell
46 whether the objective function has hit it's upper or lower limit, and does
47 not return OBJLL or OBJUL. The code for these cases should be beefed up to
48 check the objective against the limit.
49 @@ -204,39 +204,39 @@ void OGSI::initialSolve()
50 isObjUpperLimitReached_ = false ;
58 { isIterationLimitReached_ = true ;
62 { isObjLowerLimitReached_ = true ;
66 { isObjUpperLimitReached_ = true ;
70 { isTimeLimitReached_ = true ;
71 } // no break here, so we still report abandoned
81 { isAbandoned_ = true ;
85 { isPrimInfeasible_ = true ;
89 { isDualInfeasible_ = true ;
94 - switch (lpx_get_status(model))
97 + switch (glp_get_status(model))
100 { isFeasible_ = true ;
103 @@ -261,23 +261,23 @@ void OGSI::resolve()
104 LPX *model = getMutableModelPtr() ;
105 freeCachedData(OGSI::FREECACHED_RESULTS) ;
107 - // lpx_simplex will use the current basis if possible
108 - int err = lpx_simplex(model) ;
109 + // glp_simplex will use the current basis if possible
110 + int err = glp_simplex(model, &simplexParams_) ;
112 // for Glpk, a solve fails if the initial basis is invalid or singular
113 // thus, we construct a (advanced) basis first and try again
115 - if (err == LPX_E_BADB) {
116 - lpx_adv_basis(model);
117 - err = lpx_simplex(model) ;
119 + if (err == GLP_EBADB) {
120 + glp_adv_basis(model, 0);
121 + err = glp_simplex(model, &simplexParams_) ;
124 - if (err == LPX_E_SING || err == LPX_E_FAULT) {
125 - lpx_adv_basis(model);
126 - err = lpx_simplex(model) ;
127 + if (err == GLP_ESING || err == GLP_EFAIL) {
128 + glp_adv_basis(model, 0);
129 + err = glp_simplex(model, &simplexParams_) ;
132 - iter_used_ = lpx_get_int_parm(model,LPX_K_ITCNT) ;
133 + iter_used_ = glp_get_it_cnt(model) ;
135 isIterationLimitReached_ = false ;
136 isTimeLimitReached_ = false ;
137 @@ -289,39 +289,39 @@ void OGSI::resolve()
138 isFeasible_ = false ;
146 { isIterationLimitReached_ = true ;
150 { isObjLowerLimitReached_ = true ;
154 { isObjUpperLimitReached_ = true ;
158 { isTimeLimitReached_ = true ;
159 } // no break here, so we still report abandoned
169 { isAbandoned_ = true ;
173 { isPrimInfeasible_ = true ;
177 { isDualInfeasible_ = true ;
180 { assert(false) ; } }
182 - switch (lpx_get_status(model))
185 + switch (glp_get_status(model))
188 { isFeasible_ = true ;
191 @@ -337,7 +337,7 @@ void OGSI::resolve()
194 Call glpk's built-in MIP solver. Any halfway recent version (from glpk 4.4,
195 - at least) will have lpx_intopt, a branch-and-cut solver. The presence of cut
196 + at least) will have glp_intopt, a branch-and-cut solver. The presence of cut
197 generators is more recent.
199 void OGSI::branchAndBound ()
200 @@ -351,52 +351,46 @@ void OGSI::branchAndBound ()
201 Assuming we have integer variables in the model, call the best MIP solver
204 - lpx_intopt does not require an optimal LP solution as a starting point, so
205 + glp_intopt does not require an optimal LP solution as a starting point, so
206 we can call it directly.
208 lpx_integer needs an initial optimal solution to the relaxation.
210 - if (lpx_get_num_int(model))
211 - { int err = LPX_E_FAULT ;
212 + if (glp_get_num_int(model))
213 + { int err = GLP_EFAIL ;
215 -# ifdef GLPK_HAS_INTOPT
216 - err = lpx_intopt(model) ;
218 - if (lpx_get_status(model) != LPX_OPT)
219 - { initialSolve() ; }
220 - err = lpx_integer(model) ;
222 + err = glp_intopt(model, &intoptParams_) ;
224 We have a result. What is it? Start with a positive attitude and revise as
225 - needed. The various LPX_E_* and LPX_I_* defines are stable back as far as
227 + needed. The various GLP_E* and GLP_* defines are stable back as far as
230 - When we get LPX_E_OK (MIP terminated normally), we need to look more
231 - closely. LPX_I_OPT indicates a proven optimal integer solution.
232 - LPX_I_NOFEAS indicates that there is no integer feasible solution.
233 - LPX_I_UNDEF says the MIP solution is undefined. LPX_I_FEAS says that in
234 + When we get 0 (MIP terminated normally), we need to look more
235 + closely. GLP_OPT indicates a proven optimal integer solution.
236 + GLP_NOFEAS indicates that there is no integer feasible solution.
237 + GLP_UNDEF says the MIP solution is undefined. GLP_FEAS says that in
238 integer feasible solution was found but not proven optimal (termination of
239 search due to some limit is the common cause). It's not clear what to do
240 - with LPX_I_UNDEF; currently, it is not really reflected in
241 - termination status. LPX_I_FEAS is reflected by the OsiGlpk specific method
242 + with GLP_UNDEF; currently, it is not really reflected in
243 + termination status. GLP_FEAS is reflected by the OsiGlpk specific method
246 - Various other codes are returned by lpx_intopt (lpx_integer returns a
247 - subset of these). LPX_E_NOPFS (LPX_E_NODFS) indicate no primal (dual)
248 + Various other codes are returned by glp_intopt (lpx_integer returns a
249 + subset of these). GLP_ENOPFS (GLP_ENODFS) indicate no primal (dual)
250 feasible solution; detected at the root, either by presolve or when
251 - attempting the root relaxation. LPX_E_ITLIM (LPX_E_TMLIM) indicate
252 + attempting the root relaxation. GLP_EITLIM (GLP_ETMLIM) indicate
253 iteration (time) limit reached. Osi doesn't provide for time limit, so lump
254 it in with iteration limit (an arguable choice, but seems better than the
255 alternatives) and have extra method isTimeLimitReached().
256 - LPX_E_SING (lp solver failed due to singular basis) is
257 - legimately characterised as abandoned. LPX_E_FAULT indicates a structural
258 + GLP_ESING (lp solver failed due to singular basis) is
259 + legimately characterised as abandoned. GLP_EFAIL indicates a structural
260 problem (problem not of class MIP, or an integer variable has a non-integer
261 bound), which really translates into internal confusion in OsiGlpk.
263 Previous comments expressed uncertainty about the iteration count. This
264 should be checked at some point. -- lh, 070709 --
266 - iter_used_ = lpx_get_int_parm(model,LPX_K_ITCNT) ;
267 + iter_used_ = glp_get_it_cnt(model) ;
268 isIterationLimitReached_ = false ;
269 isTimeLimitReached_ = false ;
270 isAbandoned_ = false ;
271 @@ -407,45 +401,45 @@ void OGSI::branchAndBound ()
272 isObjUpperLimitReached_ = false ;
286 { isPrimInfeasible_ = true ;
290 { isDualInfeasible_ = true ;
294 { isTimeLimitReached_ = true ; } // no break
297 { isIterationLimitReached_ = true ;
301 { isAbandoned_ = true ;
311 - //check this also if err!=LPX_E_OPT, so we know about feasibility in case time/resource limit is reached
312 - int mip_status = lpx_mip_status(model) ;
313 + //check this also if err!=GLP_OPT, so we know about feasibility in case time/resource limit is reached
314 + int mip_status = glp_mip_status(model) ;
318 { isFeasible_ = true ;
322 { isPrimInfeasible_ = true ;
329 { isFeasible_ = true ;
332 @@ -458,7 +452,7 @@ void OGSI::branchAndBound ()
334 Not a MIP (no integer variables). Call the LP solver. Since we can call
335 branchAndBound with no initial LP solution, initialSolve is appropriate here.
336 - (But for glpk, it actually makes no difference --- lpx_simplex makes the
337 + (But for glpk, it actually makes no difference --- glp_simplex makes the
338 decision on how to proceed.)
341 @@ -490,7 +484,7 @@ bool OGSI::setIntParam (OsiIntParam key,
342 { case OsiMaxNumIteration:
344 { maxIteration_ = value ;
345 - lpx_set_int_parm(lp_,LPX_K_ITLIM,value) ;
346 + simplexParams_.it_lim = value ;
350 @@ -531,24 +525,24 @@ bool OGSI::setDblParam (OsiDblParam key,
351 // as of 4.7, GLPK only uses this if it does dual simplex
352 { dualObjectiveLimit_ = value ;
353 if (getObjSense() == 1) // minimization
354 - { lpx_set_real_parm(lp_,LPX_K_OBJUL,value) ; }
355 + { simplexParams_.obj_ul = value ; }
357 - { lpx_set_real_parm(lp_,LPX_K_OBJLL,value) ; }
358 + { simplexParams_.obj_ll = value ; }
361 case OsiPrimalObjectiveLimit:
362 // as of 4.7, GLPK only uses this if it does dual simplex
363 { primalObjectiveLimit_ = value ;
364 if (getObjSense() == 1)
365 - { lpx_set_real_parm(lp_,LPX_K_OBJLL,value) ; }
366 + { simplexParams_.obj_ll = value ; }
368 - { lpx_set_real_parm(lp_,LPX_K_OBJUL,value) ; }
369 + { simplexParams_.obj_ul = value ; }
372 case OsiDualTolerance:
373 { if (value >= 0 && value <= .001)
374 { dualTolerance_ = value;
375 - lpx_set_real_parm(lp_,LPX_K_TOLDJ,value) ;
376 + simplexParams_.tol_dj = value ;
380 @@ -556,14 +550,14 @@ bool OGSI::setDblParam (OsiDblParam key,
381 case OsiPrimalTolerance:
382 { if (value >= 0 && value <= .001)
383 { primalTolerance_ = value ;
384 - lpx_set_real_parm(lp_,LPX_K_TOLBND,value) ;
385 + simplexParams_.tol_bnd = value ;
391 { objOffset_ = value ;
392 - lpx_set_obj_coef(lp_,0,value) ;
393 + glp_set_obj_coef(lp_,0,value) ;
396 case OsiLastDblParam:
397 @@ -583,7 +577,7 @@ bool OGSI::setStrParam (OsiStrParam key,
398 { probName_ = value ;
399 if (probName_.length() == 0)
401 - lpx_set_prob_name(lp_,const_cast<char *>(value.c_str())) ;
402 + glp_set_prob_name(lp_,const_cast<char *>(value.c_str())) ;
406 @@ -665,18 +659,18 @@ bool OGSI::setHintParam (OsiHintParam ke
407 case OsiDoPresolveInInitial:
408 case OsiDoPresolveInResolve:
409 { if (sense == false)
410 - { if (strength >= OsiHintTry) lpx_set_int_parm(lp_,LPX_K_PRESOL,0) ; }
411 + { if (strength >= OsiHintTry) simplexParams_.presolve = intoptParams_.presolve = 0 ; }
413 - { lpx_set_int_parm(lp_,LPX_K_PRESOL,1) ; }
414 + { simplexParams_.presolve = intoptParams_.presolve = 1 ; }
417 case OsiDoDualInInitial:
418 case OsiDoDualInResolve:
419 { unimp_hint(msgHdl,false,sense,strength,"exclusive use of dual simplex") ;
421 - { if (strength >= OsiHintDo) lpx_set_int_parm(lp_,LPX_K_DUAL,0) ; }
422 + { if (strength >= OsiHintDo) simplexParams_.meth = GLP_PRIMAL ; }
424 - { lpx_set_int_parm(lp_,LPX_K_DUAL,1) ; }
425 + { simplexParams_.meth = GLP_DUALP ; }
429 @@ -692,9 +686,10 @@ bool OGSI::setHintParam (OsiHintParam ke
432 { if (sense == false)
433 - { if (strength >= OsiHintTry) lpx_set_int_parm(lp_,LPX_K_SCALE,0) ; }
434 + { if (strength >= OsiHintTry) scaleFlags_ = 0 ; }
436 - { lpx_set_int_parm(lp_,LPX_K_SCALE,3) ; }
437 + { scaleFlags_ = GLP_SF_GM | GLP_SF_EQ ; }
438 + glp_scale_prob(lp_, scaleFlags_);
442 @@ -704,15 +699,15 @@ bool OGSI::setHintParam (OsiHintParam ke
443 case OsiDoReducePrint:
445 { if (strength <= OsiHintTry)
446 - { lpx_set_int_parm(lp_,LPX_K_MSGLEV,1) ; }
447 + { simplexParams_.msg_lev = intoptParams_.msg_lev = GLP_MSG_ERR ; }
449 - { lpx_set_int_parm(lp_,LPX_K_MSGLEV,0) ; } }
450 + { simplexParams_.msg_lev = intoptParams_.msg_lev = GLP_MSG_OFF ; } }
452 { if (strength <= OsiHintTry)
453 - { lpx_set_int_parm(lp_,LPX_K_MSGLEV,2) ; }
454 + { simplexParams_.msg_lev = intoptParams_.msg_lev = GLP_MSG_ON ; }
456 - { lpx_set_int_parm(lp_,LPX_K_MSGLEV,3) ; } }
457 - int logLevel = lpx_get_int_parm(lp_,LPX_K_MSGLEV) ;
458 + { simplexParams_.msg_lev = intoptParams_.msg_lev = GLP_MSG_ALL ; } }
459 + int logLevel = simplexParams_.msg_lev ;
460 messageHandler()->setLogLevel(logLevel) ;
463 @@ -787,7 +782,7 @@ OGSI::getDblParam( OsiDblParam key, doub
467 - value = lpx_get_obj_coef(getMutableModelPtr(),0);
468 + value = glp_get_obj_coef(getMutableModelPtr(),0);
472 @@ -805,7 +800,7 @@ OGSI::getStrParam(OsiStrParam key, std::
473 // bool retval = false;
476 - value = lpx_get_prob_name( getMutableModelPtr() );
477 + value = glp_get_prob_name( getMutableModelPtr() );
481 @@ -830,13 +825,13 @@ bool OGSI::isProvenOptimal() const
483 if( bbWasLast_ == 0 )
485 - int stat = lpx_get_status( model );
486 - return stat == LPX_OPT;
487 + int stat = glp_get_status( model );
488 + return stat == GLP_OPT;
492 - int stat = lpx_mip_status( model );
493 - return stat == LPX_I_OPT;
494 + int stat = glp_mip_status( model );
495 + return stat == GLP_OPT;
499 @@ -848,9 +843,9 @@ bool OGSI::isProvenPrimalInfeasible() co
502 if( bbWasLast_ == 0 )
503 - return lpx_get_prim_stat( model ) == LPX_P_NOFEAS;
504 + return glp_get_prim_stat( model ) == GLP_NOFEAS;
506 - return lpx_mip_status( model ) == LPX_I_NOFEAS;
507 + return glp_mip_status( model ) == GLP_NOFEAS;
510 bool OGSI::isProvenDualInfeasible() const
511 @@ -861,7 +856,7 @@ bool OGSI::isProvenDualInfeasible() cons
514 if( bbWasLast_ == 0 )
515 - return lpx_get_dual_stat( model ) == LPX_D_NOFEAS;
516 + return glp_get_dual_stat( model ) == GLP_NOFEAS;
518 // Not sure what to do for MIPs; does it just mean unbounded?
519 // ??? for now, return false
520 @@ -933,7 +928,7 @@ bool OGSI::isFeasible() const
522 Return a warm start object matching the current state of the solver.
524 - Nonbasic fixed variables (LPX_NS) are translated to CWSB::atLowerBound.
525 + Nonbasic fixed variables (GLP_NS) are translated to CWSB::atLowerBound.
527 CoinWarmStart *OGSI::getWarmStart() const
529 @@ -953,19 +948,19 @@ CoinWarmStart *OGSI::getWarmStart() cons
530 and Glpk's at-upper-bound will be mapped to Osi's at-lower-bound.
532 for (int i = 0 ; i < numrows ; i++)
533 - { int stati = lpx_get_row_stat(lp_,i+1) ;
534 + { int stati = glp_get_row_stat(lp_,i+1) ;
538 { ws->setArtifStatus(i,CoinWarmStartBasis::basic) ;
544 { ws->setArtifStatus(i,CoinWarmStartBasis::atUpperBound) ;
548 { ws->setArtifStatus(i,CoinWarmStartBasis::atLowerBound) ;
552 { ws->setArtifStatus(i,CoinWarmStartBasis::isFree) ;
555 @@ -975,19 +970,19 @@ CoinWarmStart *OGSI::getWarmStart() cons
556 And repeat for the columns.
558 for (int j = 0 ; j < numcols ; j++)
559 - { int statj = lpx_get_col_stat(lp_,j+1) ;
560 + { int statj = glp_get_col_stat(lp_,j+1) ;
564 { ws->setStructStatus(j,CoinWarmStartBasis::basic) ;
570 { ws->setStructStatus(j,CoinWarmStartBasis::atLowerBound) ;
574 { ws->setStructStatus(j,CoinWarmStartBasis::atUpperBound) ;
578 { ws->setStructStatus(j,CoinWarmStartBasis::isFree) ;
581 @@ -1040,44 +1035,44 @@ bool OGSI::setWarmStart (const CoinWarmS
583 switch (ws->getArtifStatus(i))
584 { case CoinWarmStartBasis::basic:
588 case CoinWarmStartBasis::atLowerBound:
592 case CoinWarmStartBasis::atUpperBound:
596 case CoinWarmStartBasis::isFree:
604 - lpx_set_row_stat(lp_,i+1,stati) ; }
605 + glp_set_row_stat(lp_,i+1,stati) ; }
607 for (int j = 0 ; j < numcols ; j++)
610 switch (ws->getStructStatus(j))
611 { case CoinWarmStartBasis::basic:
615 case CoinWarmStartBasis::atLowerBound:
619 case CoinWarmStartBasis::atUpperBound:
623 case CoinWarmStartBasis::isFree:
631 - lpx_set_col_stat(lp_,j+1,statj) ; }
632 + glp_set_col_stat(lp_,j+1,statj) ; }
636 @@ -1108,9 +1103,9 @@ void OGSI::markHotStart()
640 - stat=lpx_get_col_stat(model,j);
641 - val=lpx_get_col_prim(model,j);
642 - dualVal=lpx_get_col_dual(model,j);
643 + stat=glp_get_col_stat(model,j);
644 + val=glp_get_col_prim(model,j);
645 + dualVal=glp_get_col_dual(model,j);
646 hotStartCStat_[j] = stat;
647 hotStartCVal_[j] = val;
648 hotStartCDualVal_[j] = dualVal;
649 @@ -1131,9 +1126,9 @@ void OGSI::markHotStart()
653 - stat=lpx_get_row_stat(model,i+1);
654 - val=lpx_get_row_prim(model,i+1);
655 - dualVal=lpx_get_row_dual(model,i+1);
656 + stat=glp_get_row_stat(model,i+1);
657 + val=glp_get_row_prim(model,i+1);
658 + dualVal=glp_get_row_dual(model,i+1);
659 hotStartRStat_[i] = stat;
660 hotStartRVal_[i] = val;
661 hotStartRDualVal_[i] = dualVal;
662 @@ -1160,11 +1155,11 @@ void OGSI::solveFromHotStart()
665 for( j = 0; j < numcols; j++ ) {
666 - lpx_set_col_stat( model, j+1, hotStartCStat_[j]);
667 + glp_set_col_stat( model, j+1, hotStartCStat_[j]);
670 for( i = 0; i < numrows; i++ ) {
671 - lpx_set_row_stat( model, i+1, hotStartRStat_[i]);
672 + glp_set_row_stat( model, i+1, hotStartRStat_[i]);
675 freeCachedData( OGSI::FREECACHED_RESULTS );
676 @@ -1191,17 +1186,17 @@ void OGSI::unmarkHotStart()
677 //-----------------------------------------------------------------------------
678 int OGSI::getNumCols() const
680 - return lpx_get_num_cols( getMutableModelPtr() );
681 + return glp_get_num_cols( getMutableModelPtr() );
684 int OGSI::getNumRows() const
686 - return lpx_get_num_rows( getMutableModelPtr() );
687 + return glp_get_num_rows( getMutableModelPtr() );
690 int OGSI::getNumElements() const
692 - return lpx_get_num_nz( getMutableModelPtr() );
693 + return glp_get_num_nz( getMutableModelPtr() );
696 //-----------------------------------------------------------------------------
697 @@ -1230,26 +1225,26 @@ const double * OGSI::getColLower() const
701 - type=lpx_get_col_type(model,i+1);
702 - lb=lpx_get_col_lb(model,i+1);
703 - ub=lpx_get_col_ub(model,i+1);
704 + type=glp_get_col_type(model,i+1);
705 + lb=glp_get_col_lb(model,i+1);
706 + ub=glp_get_col_ub(model,i+1);
732 @@ -1355,26 +1350,26 @@ const double * OGSI::getRowLower() const
736 - type=lpx_get_row_type(model,i+1);
737 - lb=lpx_get_row_lb(model,i+1);
738 - ub=lpx_get_row_ub(model,i+1);
739 + type=glp_get_row_type(model,i+1);
740 + lb=glp_get_row_lb(model,i+1);
741 + ub=glp_get_row_ub(model,i+1);
767 @@ -1416,7 +1411,7 @@ const double * OGSI::getObjCoefficients(
769 for( i = 0; i < numcols; i++ )
771 - obj_[i] = lpx_get_obj_coef( model, i + 1);
772 + obj_[i] = glp_get_obj_coef( model, i + 1);
776 @@ -1426,10 +1421,10 @@ const double * OGSI::getObjCoefficients(
778 double OGSI::getObjSense() const
780 -{ if (lpx_get_obj_dir(lp_) == LPX_MIN)
781 +{ if (glp_get_obj_dir(lp_) == GLP_MIN)
784 - if (lpx_get_obj_dir(lp_) == LPX_MAX)
785 + if (glp_get_obj_dir(lp_) == GLP_MAX)
787 else // internal confusion
789 @@ -1441,7 +1436,7 @@ double OGSI::getObjSense() const
791 bool OGSI::isContinuous( int colNumber ) const
793 - return lpx_get_col_kind( getMutableModelPtr(), colNumber+1 ) == LPX_CV;
794 + return glp_get_col_kind( getMutableModelPtr(), colNumber+1 ) == GLP_CV;
797 //-----------------------------------------------------------------------------
798 @@ -1464,14 +1459,14 @@ const CoinPackedMatrix * OGSI::getMatrix
800 for( i = 0; i < getNumRows(); i++ )
802 - int colsize = lpx_get_mat_row( model, i+1, colind, colelem);
803 + int colsize = glp_get_mat_row( model, i+1, colind, colelem);
805 for( j = 1; j <= colsize; j++ )
810 - // Note: lpx_get_mat_row apparently may return the
811 + // Note: glp_get_mat_row apparently may return the
812 // elements in decreasing order. This differs from
813 // people's standard expectations but is not an error.
815 @@ -1502,7 +1497,7 @@ const CoinPackedMatrix * OGSI::getMatrix
817 for( j = 0; j < getNumCols(); j++ )
819 - int rowsize = lpx_get_mat_col( model, j+1, rowind, rowelem);
820 + int rowsize = glp_get_mat_col( model, j+1, rowind, rowelem);
822 for( i = 1; i <= rowsize; i++ )
824 @@ -1563,9 +1558,9 @@ const double *OGSI::getColSolution() con
828 - { probStatus = lpx_mip_status(lp_) ; }
829 + { probStatus = glp_mip_status(lp_) ; }
831 - { probStatus = lpx_get_status(lp_) ; }
832 + { probStatus = glp_get_status(lp_) ; }
834 If the problem hasn't been solved, glpk returns zeros, but OSI requires that
835 the solution be within bound. getColLower() will ensure both upper and lower
836 @@ -1573,7 +1568,7 @@ const double *OGSI::getColSolution() con
837 collower[j] < colupper[j]). Solution values will be 0.0 unless that's outside
840 - if (probStatus == LPX_UNDEF || probStatus == LPX_I_UNDEF)
841 + if (probStatus == GLP_UNDEF)
844 for (j = 0 ; j < numcols ; j++)
845 @@ -1591,10 +1586,10 @@ const double *OGSI::getColSolution() con
848 for (j = 0 ; j < numcols ; j++)
849 - { colsol_[j] = lpx_get_col_prim(lp_,j+1) ;
850 + { colsol_[j] = glp_get_col_prim(lp_,j+1) ;
851 if (fabs(colsol_[j]) < GlpkZeroTol)
852 { colsol_[j] = 0.0 ; }
853 - redcost_[j] = lpx_get_col_dual(lp_,j+1) ;
854 + redcost_[j] = glp_get_col_dual(lp_,j+1) ;
855 if (fabs(redcost_[j]) < GlpkZeroTol)
856 { redcost_[j] = 0.0 ; } } }
858 @@ -1604,7 +1599,7 @@ const double *OGSI::getColSolution() con
861 for (j = 0 ; j < numcols ; j++)
862 - { colsol_[j] = lpx_mip_col_val(lp_,j+1) ;
863 + { colsol_[j] = glp_mip_col_val(lp_,j+1) ;
864 if (fabs(colsol_[j]) < GlpkZeroTol)
865 { colsol_[j] = 0.0 ; }
866 redcost_[j] = 0.0 ; } }
867 @@ -1641,7 +1636,7 @@ const double *OGSI::getRowPrice() const
870 for (i = 0 ; i < numrows; i++)
871 - { rowsol_[i] = lpx_get_row_dual(lp_,i+1) ;
872 + { rowsol_[i] = glp_get_row_dual(lp_,i+1) ;
873 if (fabs(rowsol_[i]) < GlpkZeroTol)
874 { rowsol_[i] = 0.0 ; } } }
876 @@ -1658,7 +1653,7 @@ const double *OGSI::getRowPrice() const
877 setRowPrice(), and it'd be nice to return reduced costs that agree with the
880 - To use glpk's routine (lpx_get_col_dual), the interface needs to track the
881 + To use glpk's routine (glp_get_col_dual), the interface needs to track the
882 origin of the dual (row price) values.
884 const double * OGSI::getReducedCost() const
885 @@ -1813,7 +1808,7 @@ void OGSI::setObjCoeff (int j, double cj
887 Push the changed objective down to glpk.
889 - lpx_set_obj_coef(lp_,j+1,cj) ;
890 + glp_set_obj_coef(lp_,j+1,cj) ;
894 @@ -1830,15 +1825,15 @@ void OGSI::setColLower (int j, double lb
895 infinite bound, so we need to check the status and possibly correct.
897 double inf = getInfinity() ;
898 - int type = lpx_get_col_type(lp_,j+1) ;
899 - double ubj = lpx_get_col_ub(lp_,j+1) ;
900 + int type = glp_get_col_type(lp_,j+1) ;
901 + double ubj = glp_get_col_ub(lp_,j+1) ;
917 @@ -1875,15 +1870,15 @@ void OGSI::setColUpper (int j, double ub
918 infinite bound, so we need to check the status and possibly correct.
920 double inf = getInfinity() ;
921 - int type = lpx_get_col_type(lp_,j+1) ;
922 - double lbj = lpx_get_col_lb(lp_,j+1) ;
923 + int type = glp_get_col_type(lp_,j+1) ;
924 + double lbj = glp_get_col_lb(lp_,j+1) ;
940 @@ -1932,25 +1927,25 @@ void OGSI::setColBounds (int j, double l
944 - { type = LPX_FX ; }
945 + { type = GLP_FX ; }
947 if (lower > -inf && upper < inf)
948 - { type = LPX_DB ; }
949 + { type = GLP_DB ; }
952 - { type = LPX_LO ; }
953 + { type = GLP_LO ; }
956 - { type = LPX_UP ; }
957 + { type = GLP_UP ; }
959 - { type = LPX_FR ; }
960 + { type = GLP_FR ; }
962 Push the bound change down into the solver. 1-based addressing.
964 - int statj = lpx_get_col_stat(lp_,j+1) ;
965 - lpx_set_col_bnds(lp_,j+1,type,lower,upper) ;
966 - lpx_set_col_stat(lp_,j+1,statj) ;
967 - statj = lpx_get_col_stat(lp_,j+1) ;
968 + int statj = glp_get_col_stat(lp_,j+1) ;
969 + glp_set_col_bnds(lp_,j+1,type,lower,upper) ;
970 + glp_set_col_stat(lp_,j+1,statj) ;
971 + statj = glp_get_col_stat(lp_,j+1) ;
973 Correct the cached upper and lower bound vectors, if present.
975 @@ -1982,18 +1977,18 @@ OGSI::setRowLower( int elementIndex, dou
979 - type=lpx_get_row_type(getMutableModelPtr(),elementIndex+1);
980 - ub=lpx_get_row_ub(getMutableModelPtr(),elementIndex+1);
981 + type=glp_get_row_type(getMutableModelPtr(),elementIndex+1);
982 + ub=glp_get_row_ub(getMutableModelPtr(),elementIndex+1);
1001 @@ -2014,18 +2009,18 @@ OGSI::setRowUpper( int elementIndex, dou
1005 - type=lpx_get_row_type(getMutableModelPtr(),elementIndex+1);
1006 - lb=lpx_get_row_lb(getMutableModelPtr(),elementIndex+1);
1007 + type=glp_get_row_type(getMutableModelPtr(),elementIndex+1);
1008 + lb=glp_get_row_lb(getMutableModelPtr(),elementIndex+1);
1027 @@ -2056,20 +2051,20 @@ void OGSI::setRowBounds (int i, double l
1031 - { type = LPX_FX ; }
1032 + { type = GLP_FX ; }
1034 if (lower > -inf && upper < inf)
1035 - { type = LPX_DB ; }
1036 + { type = GLP_DB ; }
1039 - { type = LPX_LO ; }
1040 + { type = GLP_LO ; }
1043 - { type = LPX_UP ; }
1044 + { type = GLP_UP ; }
1046 - { type = LPX_FR ; }
1047 + { type = GLP_FR ; }
1049 - lpx_set_row_bnds(lp_,i+1,type,lower,upper) ;
1050 + glp_set_row_bnds(lp_,i+1,type,lower,upper) ;
1052 Update cached vectors, if they exist.
1054 @@ -2123,7 +2118,7 @@ OGSI::setContinuous(int index)
1056 LPX *model = getMutableModelPtr();
1057 freeCachedData( OGSI::FREECACHED_COLUMN );
1058 - lpx_set_col_kind( model, index+1, LPX_CV );
1059 + glp_set_col_kind( model, index+1, GLP_CV );
1062 //-----------------------------------------------------------------------------
1063 @@ -2132,7 +2127,7 @@ void OGSI::setInteger (int index)
1065 { LPX *model = getMutableModelPtr() ;
1066 freeCachedData(OGSI::FREECACHED_COLUMN) ;
1067 - lpx_set_col_kind(model,index+1,LPX_IV) ;
1068 + glp_set_col_kind(model,index+1,GLP_IV) ;
1070 Temporary hack to correct upper bounds on general integer variables.
1071 CoinMpsIO insists on forcing a bound of 1e30 for general integer variables
1072 @@ -2184,9 +2179,9 @@ void OGSI::setObjSense(double s)
1073 { freeCachedData(OGSI::FREECACHED_RESULTS) ;
1076 - { lpx_set_obj_dir(lp_,LPX_MAX) ; }
1077 + { glp_set_obj_dir(lp_,GLP_MAX) ; }
1079 - { lpx_set_obj_dir(lp_,LPX_MIN) ; }
1080 + { glp_set_obj_dir(lp_,GLP_MIN) ; }
1084 @@ -2252,12 +2247,12 @@ void OGSI::addCol (const CoinPackedVecto
1085 const double collb, const double colub, const double obj)
1087 // Note: GLPK expects only non-zero coefficients will be given in
1088 - // lpx_set_mat_col and will abort if there are any zeros. So any
1089 - // zeros must be removed prior to calling lpx_set_mat_col.
1090 + // glp_set_mat_col and will abort if there are any zeros. So any
1091 + // zeros must be removed prior to calling glp_set_mat_col.
1092 LPX *model = getMutableModelPtr();
1093 freeCachedData(OGSI::KEEPCACHED_ROW);
1095 - lpx_add_cols( model, 1 );
1096 + glp_add_cols( model, 1 );
1097 int numcols = getNumCols();
1098 setColBounds( numcols-1, collb, colub );
1099 setObjCoeff( numcols-1, obj );
1100 @@ -2276,7 +2271,7 @@ void OGSI::addCol (const CoinPackedVecto
1101 if (elements[i] != 0.0)
1103 if ( indices[i]+1 > numrows ) {
1104 - lpx_add_rows( model, indices[i]+1 - numrows );
1105 + glp_add_rows( model, indices[i]+1 - numrows );
1106 numrows = indices[i]+1;
1107 // ??? could do this more efficiently with a single call based on the max
1109 @@ -2286,7 +2281,7 @@ void OGSI::addCol (const CoinPackedVecto
1110 elements_adj[count] = elements[i];
1113 - lpx_set_mat_col( model, numcols, count, indices_adj, elements_adj );
1114 + glp_set_mat_col( model, numcols, count, indices_adj, elements_adj );
1115 delete [] indices_adj;
1116 delete [] elements_adj;
1118 @@ -2326,7 +2321,7 @@ OGSI::deleteCols(const int num, const in
1119 columnIndicesPlus1[i+1]=columnIndices[i]+1;
1120 deleteColNames(columnIndices[i],1);
1122 - lpx_del_cols(model,num,columnIndicesPlus1);
1123 + glp_del_cols(model,num,columnIndicesPlus1);
1124 delete [] columnIndicesPlus1;
1126 # if OGSI_TRACK_FRESH > 0
1127 @@ -2344,13 +2339,13 @@ OGSI::addRow (const CoinPackedVectorBase
1128 const double rowlb, const double rowub)
1130 // Note: GLPK expects only non-zero coefficients will be given in
1131 - // lpx_set_mat_row and will abort if there are any zeros. So any
1132 - // zeros must be removed prior to calling lpx_set_mat_row.
1133 + // glp_set_mat_row and will abort if there are any zeros. So any
1134 + // zeros must be removed prior to calling glp_set_mat_row.
1136 LPX *model = getMutableModelPtr();
1137 freeCachedData( OGSI::KEEPCACHED_COLUMN );
1139 - lpx_add_rows( model, 1 );
1140 + glp_add_rows( model, 1 );
1141 int numrows = getNumRows();
1142 setRowBounds( numrows-1, rowlb, rowub );
1144 @@ -2369,7 +2364,7 @@ OGSI::addRow (const CoinPackedVectorBase
1146 if ( indices[i]+1 > numcols ) {
1147 // ??? Could do this more efficiently with a single call
1148 - lpx_add_cols( model, indices[i]+1 - numcols );
1149 + glp_add_cols( model, indices[i]+1 - numcols );
1150 numcols = indices[i]+1;
1153 @@ -2377,7 +2372,7 @@ OGSI::addRow (const CoinPackedVectorBase
1154 indices_adj[count] = indices[i] + 1;
1157 - lpx_set_mat_row( model, numrows, count, indices_adj, elements_adj );
1158 + glp_set_mat_row( model, numrows, count, indices_adj, elements_adj );
1159 delete [] indices_adj;
1160 delete [] elements_adj;
1162 @@ -2461,8 +2456,8 @@ void OGSI::deleteRows (const int num, co
1164 for (ndx = 1 ; ndx <= num ; ndx++)
1165 { i = glpkIndices[ndx] ;
1166 - int stati = lpx_get_row_stat(lp_,i) ;
1167 - if (stati != LPX_BS)
1168 + int stati = glp_get_row_stat(lp_,i) ;
1169 + if (stati != GLP_BS)
1173 @@ -2476,7 +2471,7 @@ void OGSI::deleteRows (const int num, co
1175 Tell glpk to delete the rows.
1177 - lpx_del_rows(lp_,num,glpkIndices) ;
1178 + glp_del_rows(lp_,num,glpkIndices) ;
1180 delete [] glpkIndices ;
1182 @@ -2511,41 +2506,32 @@ void OGSI::loadProblem (const CoinPacked
1184 In any event, get rid of cached data in the OsiGlpk object.
1186 - if (lpx_get_num_cols(lp_) != 0 || lpx_get_num_rows(lp_) != 0)
1187 + if (glp_get_num_cols(lp_) != 0 || glp_get_num_rows(lp_) != 0)
1189 - int presolVal = lpx_get_int_parm(lp_,LPX_K_PRESOL) ;
1190 - int usedualVal = lpx_get_int_parm(lp_,LPX_K_DUAL) ;
1191 - int scaleVal = lpx_get_int_parm(lp_,LPX_K_SCALE) ;
1192 - int logVal = lpx_get_int_parm(lp_,LPX_K_MSGLEV) ;
1193 # if OGSI_TRACK_FRESH > 0
1195 << " emptying LPX(" << std::hex << lp_ << std::dec << "), "
1197 - lpx_delete_prob(lp_) ;
1198 - lp_ = lpx_create_prob() ;
1199 + glp_delete_prob(lp_) ;
1200 + lp_ = glp_create_prob() ;
1202 # if OGSI_TRACK_FRESH > 0
1204 << "loading LPX(" << std::hex << lp_ << std::dec << ")."
1207 - lpx_set_class(lp_,LPX_MIP) ;
1208 - lpx_set_int_parm(lp_,LPX_K_ITLIM,maxIteration_) ;
1210 + simplexParams_.it_lim = maxIteration_ ;
1211 if (getObjSense() == 1) // minimization
1212 - { lpx_set_real_parm(lp_,LPX_K_OBJUL,dualObjectiveLimit_) ;
1213 - lpx_set_real_parm(lp_,LPX_K_OBJLL,primalObjectiveLimit_) ; }
1214 + { simplexParams_.obj_ul = dualObjectiveLimit_ ;
1215 + simplexParams_.obj_ll = primalObjectiveLimit_ ; }
1216 else // maximization
1217 - { lpx_set_real_parm(lp_,LPX_K_OBJLL,dualObjectiveLimit_) ;
1218 - lpx_set_real_parm(lp_,LPX_K_OBJUL,primalObjectiveLimit_) ; }
1219 - lpx_set_real_parm(lp_,LPX_K_TOLDJ,dualTolerance_) ;
1220 - lpx_set_real_parm(lp_,LPX_K_TOLBND,primalTolerance_) ;
1221 - lpx_set_obj_coef(lp_,0,objOffset_) ;
1222 - lpx_set_prob_name(lp_,const_cast<char *>(probName_.c_str())) ;
1223 - lpx_set_int_parm(lp_,LPX_K_PRESOL,presolVal) ;
1224 - lpx_set_int_parm(lp_,LPX_K_DUAL,usedualVal) ;
1225 - lpx_set_int_parm(lp_,LPX_K_SCALE,scaleVal) ;
1226 - lpx_set_int_parm(lp_,LPX_K_MSGLEV,logVal) ;
1227 - messageHandler()->setLogLevel(logVal) ; }
1228 + { simplexParams_.obj_ll = dualObjectiveLimit_ ;
1229 + simplexParams_.obj_ul = primalObjectiveLimit_ ; }
1230 + simplexParams_.tol_dj = dualTolerance_ ;
1231 + simplexParams_.tol_bnd = primalTolerance_ ;
1232 + glp_set_obj_coef(lp_,0,objOffset_) ;
1233 + glp_set_prob_name(lp_,const_cast<char *>(probName_.c_str())) ; }
1235 freeCachedData(OGSI::KEEPCACHED_NONE) ;
1237 @@ -2617,7 +2603,7 @@ void OGSI::loadProblem (const CoinPacked
1238 addCol(reqdBySunCC,collb[j],colub[j],obj[j]) ; }
1239 // Make sure there are enough rows
1240 if (m > getNumRows())
1241 - { lpx_add_rows(lp_,m-getNumRows()) ; }
1242 + { glp_add_rows(lp_,m-getNumRows()) ; }
1243 for (i = 0 ; i < m ; i++)
1244 { setRowBounds(i,rowlb[i],rowub[i]) ; } }
1246 @@ -2626,7 +2612,7 @@ void OGSI::loadProblem (const CoinPacked
1247 addRow(reqdBySunCC,rowlb[i],rowub[i]) ; }
1248 // Make sure there are enough columns
1249 if (n > getNumCols())
1250 - { lpx_add_cols(lp_,n-getNumCols()) ; }
1251 + { glp_add_cols(lp_,n-getNumCols()) ; }
1252 for (j = 0 ; j < n ; j++)
1253 { setColBounds(j,collb[j],colub[j]) ;
1254 setObjCoeff(j,obj[j]) ; } }
1255 @@ -2731,11 +2717,11 @@ OGSI::loadProblem(const int numcols, con
1256 LPX *model = getMutableModelPtr();
1257 double inf = getInfinity();
1259 - // Can't send 0 to lpx_add_xxx
1260 + // Can't send 0 to glp_add_xxx
1262 - lpx_add_cols( model, numcols );
1263 + glp_add_cols( model, numcols );
1265 - lpx_add_rows( model, numrows );
1266 + glp_add_rows( model, numrows );
1268 // How many elements? Column-major, so indices of start are columns
1269 int numelem = start[ numcols ];
1270 @@ -2756,7 +2742,7 @@ OGSI::loadProblem(const int numcols, con
1272 setColBounds( i, collb ? collb[i]:0.0,
1273 colub ? colub[i]:inf );
1274 - lpx_set_mat_col( model, i+1, start[i+1]-start[i], &(index_adj[start[i]]), &(value_adj[start[i]]) );
1275 + glp_set_mat_col( model, i+1, start[i+1]-start[i], &(index_adj[start[i]]), &(value_adj[start[i]]) );
1276 setObjCoeff( i, obj ? obj[i]:0.0 );
1279 @@ -2823,7 +2809,7 @@ void OGSI::writeMps( const char * filena
1280 std::string f( filename );
1281 std::string e( extension );
1282 std::string fullname = f + "." + e;
1283 - lpx_write_mps( getMutableModelPtr(), const_cast<char*>( fullname.c_str() ));
1284 + glp_write_mps( getMutableModelPtr(), GLP_MPS_FILE, NULL, const_cast<char*>( fullname.c_str() ));
1286 // Fall back on native MPS writer.
1287 // These few lines of code haven't been tested. 2004/10/15
1288 @@ -2996,17 +2982,17 @@ void OGSI::applyColCut( const OsiColCut
1289 // update cached version as well
1290 collower_[column] = lower;
1291 if( lower == upper )
1294 else if( lower > -inf && upper < inf )
1297 else if( lower > -inf )
1300 else if( upper < inf)
1307 - lpx_set_col_bnds( getMutableModelPtr(), column+1, type, lower, upper );
1308 + glp_set_col_bnds( getMutableModelPtr(), column+1, type, lower, upper );
1312 @@ -3018,17 +3004,17 @@ void OGSI::applyColCut( const OsiColCut
1313 // update cached version as well
1314 colupper_[column] = upper;
1315 if( lower == upper )
1318 else if( lower > -inf && upper < inf )
1321 else if( lower > -inf )
1324 else if( upper < inf)
1331 - lpx_set_col_bnds( getMutableModelPtr(), column+1, type, lower, upper );
1332 + glp_set_col_bnds( getMutableModelPtr(), column+1, type, lower, upper );
1336 @@ -3095,25 +3081,24 @@ void OGSI::gutsOfCopy (const OsiGlpkSolv
1337 held up on the parent OSI object, so we don't need to worry about copying
1340 - intParam = lpx_get_int_parm(srclpx,LPX_K_PRESOL) ;
1341 - lpx_set_int_parm(lpx,LPX_K_PRESOL,intParam) ;
1342 - intParam = lpx_get_int_parm(srclpx,LPX_K_DUAL) ;
1343 - lpx_set_int_parm(lpx,LPX_K_DUAL,intParam) ;
1344 - intParam = lpx_get_int_parm(srclpx,LPX_K_SCALE) ;
1345 - lpx_set_int_parm(lpx,LPX_K_SCALE,intParam) ;
1346 + intoptParams_.presolve = source.intoptParams_.presolve;
1347 + simplexParams_.presolve = source.simplexParams_.presolve;
1348 + simplexParams_.meth = source.simplexParams_.meth;
1349 + scaleFlags_ = source.scaleFlags_;
1351 Printing is a bit more complicated. Pull the parameter and set the log
1352 level in the message handler and set the print parameter in glpk.
1354 - intParam = lpx_get_int_parm(srclpx,LPX_K_MSGLEV) ;
1355 - lpx_set_int_parm(lpx,LPX_K_MSGLEV,intParam) ;
1356 - messageHandler()->setLogLevel(intParam) ;
1358 -# ifdef LPX_K_USECUTS
1359 - intParam=lpx_get_int_parm(lp_,LPX_K_USECUTS);
1360 - lpx_set_int_parm(lp_,LPX_K_USECUTS,intParam);
1362 + simplexParams_.msg_lev = source.simplexParams_.msg_lev;
1363 + intoptParams_.msg_lev = source.intoptParams_.msg_lev;
1364 + messageHandler()->setLogLevel(simplexParams_.msg_lev) ;
1366 + intoptParams_.mir_cuts = source.intoptParams_.mir_cuts;
1367 + intoptParams_.gmi_cuts = source.intoptParams_.gmi_cuts;
1368 + intoptParams_.cov_cuts = source.intoptParams_.cov_cuts;
1369 + intoptParams_.clq_cuts = source.intoptParams_.clq_cuts;
1371 + glp_scale_prob(lp_, scaleFlags_);
1373 Now --- do we have a problem loaded? If not, we're done.
1375 @@ -3164,22 +3149,22 @@ void OGSI::gutsOfCopy (const OsiGlpkSolv
1376 nonsense, then don't bother. Once we've copied the status into the new lpx
1377 object, do the warm-up.
1379 - if (lpx_get_status(srclpx) != LPX_UNDEF)
1380 + if (glp_get_status(srclpx) != GLP_UNDEF)
1381 { for (j = 1 ; j <= n ; j++)
1382 - { int statj = lpx_get_col_stat(srclpx,j) ;
1383 - lpx_set_col_stat(lpx,j,statj) ; }
1384 + { int statj = glp_get_col_stat(srclpx,j) ;
1385 + glp_set_col_stat(lpx,j,statj) ; }
1386 for (i = 1 ; i <= m ; i++)
1387 - { int stati = lpx_get_row_stat(srclpx,i) ;
1388 - lpx_set_row_stat(lpx,i,stati) ; }
1389 + { int stati = glp_get_row_stat(srclpx,i) ;
1390 + glp_set_row_stat(lpx,i,stati) ; }
1393 - int retval = lpx_warm_up(lpx) ;
1394 + int retval = glp_warm_up(lpx) ;
1396 # if OGSI_TRACK_SOLVERS > 1
1398 - << " lpx_warm_up returns " << retval << "." << std::endl ;
1399 + << " glp_warm_up returns " << retval << "." << std::endl ;
1401 - assert(retval == LPX_E_OK) ; }
1402 + assert(retval == 0) ; }
1406 @@ -3232,26 +3217,28 @@ void OGSI::gutsOfConstructor()
1407 isObjUpperLimitReached_ = false ;
1408 isFeasible_ = false;
1410 - lp_ = lpx_create_prob();
1411 + lp_ = glp_create_prob();
1412 assert( lp_ != NULL );
1413 - // Make all problems MIPs. See note at top of file.
1414 - lpx_set_class( lp_, LPX_MIP );
1416 + glp_init_smcp(&simplexParams_);
1417 + glp_init_iocp(&intoptParams_);
1418 + scaleFlags_ = GLP_SF_EQ;
1419 + glp_scale_prob(lp_, scaleFlags_);
1420 // Push OSI parameters down into LPX object.
1421 - lpx_set_int_parm(lp_,LPX_K_ITLIM,maxIteration_) ;
1422 + simplexParams_.it_lim = maxIteration_;
1424 if (getObjSense() == 1.0) // minimization
1425 - { lpx_set_real_parm(lp_,LPX_K_OBJUL,dualObjectiveLimit_) ;
1426 - lpx_set_real_parm(lp_,LPX_K_OBJLL,primalObjectiveLimit_) ; }
1427 + { simplexParams_.obj_ul = dualObjectiveLimit_ ;
1428 + simplexParams_.obj_ll = primalObjectiveLimit_ ; }
1429 else // maximization
1430 - { lpx_set_real_parm(lp_,LPX_K_OBJLL,dualObjectiveLimit_) ;
1431 - lpx_set_real_parm(lp_,LPX_K_OBJUL,-primalObjectiveLimit_) ; }
1432 - lpx_set_real_parm(lp_,LPX_K_TOLDJ,dualTolerance_) ;
1433 - lpx_set_real_parm(lp_,LPX_K_TOLBND,primalTolerance_) ;
1434 + { simplexParams_.obj_ll = dualObjectiveLimit_ ;
1435 + simplexParams_.obj_ul = -primalObjectiveLimit_ ; }
1436 + simplexParams_.tol_dj = dualTolerance_;
1437 + simplexParams_.tol_bnd = primalTolerance_;
1439 - lpx_set_obj_coef(lp_,0,objOffset_) ;
1440 + glp_set_obj_coef(lp_,0,objOffset_) ;
1442 - lpx_set_prob_name(lp_,const_cast<char *>(probName_.c_str())) ;
1443 + glp_set_prob_name(lp_,const_cast<char *>(probName_.c_str())) ;
1445 /* Stefan: with the new simplex algorithm in Glpk 4.31, some netlib instances (e.g., dfl001)
1446 take very long or get into a cycle.
1447 @@ -3264,22 +3251,16 @@ void OGSI::gutsOfConstructor()
1448 Printing is a bit more complicated. Set the log level in the handler and set
1449 the print parameter in glpk.
1451 - lpx_set_int_parm(lp_,LPX_K_MSGLEV,1) ;
1452 - messageHandler()->setLogLevel(1) ;
1453 + simplexParams_.msg_lev = intoptParams_.msg_lev = GLP_MSG_ERR ;
1454 + messageHandler()->setLogLevel(GLP_MSG_ERR) ;
1457 - Enable cuts if they're available. This is a bit of a pain,
1458 - as the interface has changed since it was first introduced in 4.9.
1459 - LPX_K_USECUTS appears in 4.9; the parameter value
1460 - appears to be unused in this version. LPX_C_ALL appears in 4.10.
1462 -# ifdef LPX_K_USECUTS
1464 - lpx_set_int_parm(lp_,LPX_K_USECUTS,LPX_C_ALL) ;
1466 - lpx_set_int_parm(lp_,LPX_K_USECUTS,0) ;
1469 + Enable cuts if they're available.
1471 + intoptParams_.mir_cuts = GLP_ON;
1472 + intoptParams_.gmi_cuts = GLP_ON;
1473 + intoptParams_.cov_cuts = GLP_ON;
1474 + intoptParams_.clq_cuts = GLP_ON;
1477 //-----------------------------------------------------------------------------
1478 @@ -3288,7 +3269,7 @@ void OGSI::gutsOfDestructor()
1482 - lpx_delete_prob( lp_ );
1483 + glp_delete_prob( lp_ );
1487 @@ -3408,7 +3389,7 @@ void OGSI::freeAllMemory()
1488 void OGSI::setObjName (std::string name)
1490 { OsiSolverInterface::setObjName(name) ;
1491 - lpx_set_obj_name(lp_,const_cast<char *>(name.c_str())) ; }
1492 + glp_set_obj_name(lp_,const_cast<char *>(name.c_str())) ; }
1495 Set a row name. Make sure both glpk and OSI see the same name.
1496 @@ -3431,7 +3412,7 @@ void OGSI::setRowName (int ndx, std::str
1497 Set the name in the OSI base, then in the consys structure.
1499 OsiSolverInterface::setRowName(ndx,name) ;
1500 - lpx_set_row_name(lp_,ndx+1,const_cast<char *>(name.c_str())) ;
1501 + glp_set_row_name(lp_,ndx+1,const_cast<char *>(name.c_str())) ;
1505 @@ -3456,7 +3437,7 @@ void OGSI::setColName (int ndx, std::str
1506 Set the name in the OSI base, then in the consys structure.
1508 OsiSolverInterface::setColName(ndx,name) ;
1509 - lpx_set_col_name(lp_,ndx+1,const_cast<char *>(name.c_str())) ;
1510 + glp_set_col_name(lp_,ndx+1,const_cast<char *>(name.c_str())) ;
1514 --- Osi-0.106.10/Osi/src/OsiGlpk/OsiGlpkSolverInterface.hpp.orig 2013-04-06 14:50:19.000000000 +0200
1515 +++ Osi-0.106.10/Osi/src/OsiGlpk/OsiGlpkSolverInterface.hpp 2014-12-03 20:33:20.066812529 +0100
1516 @@ -768,6 +768,9 @@ private:
1518 /// GPLK model represented by this class instance
1520 + glp_iocp intoptParams_;
1521 + glp_smcp simplexParams_;
1524 /// number of GLPK instances currently in use (counts only those created by OsiGlpk)
1525 static unsigned int numInstances_;