@@ -672,23 +672,27 @@ end
672
672
673
673
# ==============================================================================
674
674
# BOUNDS
675
- # Variables default to [0, ∞).
676
- # FR free variable -∞ < x < ∞
675
+ #
676
+ # Variables default to [0, ∞), or [0, 1] if the variable appears in INTORG and
677
+ # does not appear in BOUNDS.
678
+ #
677
679
# FX fixed variable x == b
680
+ # FR free variable -∞ < x < ∞
678
681
# MI lower bound -inf -∞ < x
679
- # UP upper bound x <= b
680
- # PL upper bound +inf x < ∞
681
682
# LO lower bound b <= x
683
+ # LI integer variable b <= x
684
+ # PL upper bound +inf x < ∞
685
+ # UP upper bound x <= b
686
+ # UI integer variable x <= b
682
687
# BV binary variable x = 0 or 1
683
688
#
684
689
# Not yet implemented:
685
- # LI integer variable b <= x
686
- # UI integer variable x <= b
690
+ #
687
691
# SC semi-cont variable x = 0 or l <= x <= b
688
692
# l is the lower bound on the variable. If none set then defaults to 1
689
693
# ==============================================================================
690
694
691
- function write_single_bound (io:: IO , var_name:: String , lower, upper)
695
+ function write_single_bound (io:: IO , var_name:: String , lower, upper, vtype )
692
696
if lower == upper
693
697
println (
694
698
io,
@@ -708,7 +712,7 @@ function write_single_bound(io::IO, var_name::String, lower, upper)
708
712
println (
709
713
io,
710
714
Card (
711
- f1 = " LO" ,
715
+ f1 = vtype == VTYPE_CONTINUOUS ? " LO" : " LI " ,
712
716
f2 = " bounds" ,
713
717
f3 = var_name,
714
718
f4 = _to_string (lower),
@@ -721,7 +725,7 @@ function write_single_bound(io::IO, var_name::String, lower, upper)
721
725
println (
722
726
io,
723
727
Card (
724
- f1 = " UP" ,
728
+ f1 = vtype == VTYPE_CONTINUOUS ? " UP" : " UI " ,
725
729
f2 = " bounds" ,
726
730
f3 = var_name,
727
731
f4 = _to_string (upper),
@@ -783,16 +787,18 @@ function write_bounds(io::IO, model::Model, var_to_column)
783
787
if lower <= 0 && upper >= 1
784
788
println (io, Card (f1 = " BV" , f2 = " bounds" , f3 = var_name))
785
789
else
790
+ lower = max (0 , lower)
786
791
if lower > 0
787
792
lower = 1
788
793
end
794
+ upper = min (1 , upper)
789
795
if upper < 1
790
796
upper = 0
791
797
end
792
- write_single_bound (io, var_name, max ( 0 , lower), min ( 1 , upper) )
798
+ write_single_bound (io, var_name, lower, upper, vtype )
793
799
end
794
800
else
795
- write_single_bound (io, var_name, lower, upper)
801
+ write_single_bound (io, var_name, lower, upper, vtype )
796
802
end
797
803
end
798
804
return
0 commit comments