@@ -77,12 +77,12 @@ function Base.copy(m::GLPKMathProgModelMIP)
77
77
78
78
m2. param = deepcopy (m. param)
79
79
m2. smplxparam = deepcopy (m. smplxparam)
80
-
80
+
81
81
m. lazycb == nothing || Base. warn_once (" Callbacks can't be copied, lazy callback ignored" )
82
82
m. cutcb == nothing || Base. warn_once (" Callbacks can't be copied, cut callback ignored" )
83
83
m. heuristiccb == nothing || Base. warn_once (" Callbacks can't be copied, heuristic callback ignored" )
84
84
m. infocb == nothing || Base. warn_once (" Callbacks can't be copied, info callback ignored" )
85
-
85
+
86
86
m2. objbound = m. objbound
87
87
88
88
m. cbdata == nothing || Base. warn_once (" Callbacks can't be copied, callbackdata ignored" )
@@ -539,7 +539,15 @@ function status(lpm::GLPKMathProgModelMIP)
539
539
end
540
540
end
541
541
542
- getobjval (lpm:: GLPKMathProgModelMIP ) = GLPK. mip_obj_val (lpm. inner)
542
+ function getobjval (lpm:: GLPKMathProgModelMIP )
543
+ status = GLPK. mip_status (lpm. inner)
544
+ if status == GLPK. UNDEF || status == GLPK. NOFEAS
545
+ # no feasible solution so objective is NaN
546
+ return NaN
547
+ end
548
+
549
+ return GLPK. mip_obj_val (lpm. inner)
550
+ end
543
551
544
552
function getobjbound (lpm:: GLPKMathProgModelMIP )
545
553
# This is a hack. We observed some cases where mip_status == OPT
556
564
function getsolution (lpm:: GLPKMathProgModelMIP )
557
565
lp = lpm. inner
558
566
n = GLPK. get_num_cols (lp)
567
+ status = GLPK. mip_status (lpm. inner)
568
+ if status == GLPK. UNDEF || status == GLPK. NOFEAS
569
+ # no feasible solution to return
570
+ return fill (NaN , n)
571
+ end
559
572
560
573
x = Array {Float64} (n)
561
574
for c = 1 : n
0 commit comments