Skip to content

Commit 654b38e

Browse files
committed
Change %.10g to %.15g in MPS reader
1 parent 6002a3c commit 654b38e

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

highs/io/HMPSIO.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ HighsStatus writeMps(
798798
num_no_cost_zero_columns++;
799799
if (write_no_cost_zero_columns) {
800800
// Give the column a presence by writing out a zero cost
801-
fprintf(file, " %-8s %-8s %.10g\n", col_names[c_n].c_str(),
801+
fprintf(file, " %-8s %-8s %.15g\n", col_names[c_n].c_str(),
802802
objective_name.c_str(), 0.0);
803803
}
804804
continue;
@@ -822,13 +822,13 @@ HighsStatus writeMps(
822822
}
823823
if (col_cost[c_n] != 0) {
824824
double v = use_sense * col_cost[c_n];
825-
fprintf(file, " %-8s %-8s %.10g\n", col_names[c_n].c_str(),
825+
fprintf(file, " %-8s %-8s %.15g\n", col_names[c_n].c_str(),
826826
objective_name.c_str(), v);
827827
}
828828
for (HighsInt el_n = a_start[c_n]; el_n < a_start[c_n + 1]; el_n++) {
829829
double v = a_value[el_n];
830830
HighsInt r_n = a_index[el_n];
831-
fprintf(file, " %-8s %-8s %.10g\n", col_names[c_n].c_str(),
831+
fprintf(file, " %-8s %-8s %.15g\n", col_names[c_n].c_str(),
832832
row_names[r_n].c_str(), v);
833833
}
834834
}
@@ -844,12 +844,12 @@ HighsStatus writeMps(
844844
if (offset) {
845845
// Handle the objective offset as a RHS entry for the cost row
846846
double v = -use_sense * offset;
847-
fprintf(file, " RHS_V %-8s %.10g\n", objective_name.c_str(), v);
847+
fprintf(file, " RHS_V %-8s %.15g\n", objective_name.c_str(), v);
848848
}
849849
for (HighsInt r_n = 0; r_n < num_row; r_n++) {
850850
double v = rhs[r_n];
851851
if (v) {
852-
fprintf(file, " RHS_V %-8s %.10g\n", row_names[r_n].c_str(), v);
852+
fprintf(file, " RHS_V %-8s %.15g\n", row_names[r_n].c_str(), v);
853853
}
854854
}
855855
}
@@ -858,7 +858,7 @@ HighsStatus writeMps(
858858
for (HighsInt r_n = 0; r_n < num_row; r_n++) {
859859
double v = ranges[r_n];
860860
if (v) {
861-
fprintf(file, " RANGE %-8s %.10g\n", row_names[r_n].c_str(), v);
861+
fprintf(file, " RANGE %-8s %.15g\n", row_names[r_n].c_str(), v);
862862
}
863863
}
864864
}
@@ -884,7 +884,7 @@ HighsStatus writeMps(
884884
}
885885
if (lb == ub) {
886886
// Equal lower and upper bounds: Fixed
887-
fprintf(file, " FX BOUND %-8s %.10g\n", col_names[c_n].c_str(),
887+
fprintf(file, " FX BOUND %-8s %.15g\n", col_names[c_n].c_str(),
888888
lb);
889889
} else if (highs_isInfinity(-lb) && highs_isInfinity(ub)) {
890890
// Infinite lower and upper bounds: Free
@@ -923,15 +923,15 @@ HighsStatus writeMps(
923923
// Finite lower bound. No need to state this if LB is
924924
// zero unless UB is infinite
925925
if (lb || highs_isInfinity(ub))
926-
fprintf(file, " LI BOUND %-8s %.10g\n",
926+
fprintf(file, " LI BOUND %-8s %.15g\n",
927927
col_names[c_n].c_str(), lb);
928928
} else {
929929
// Infinite lower bound
930930
fprintf(file, " MI BOUND %-8s\n", col_names[c_n].c_str());
931931
}
932932
if (!highs_isInfinity(ub)) {
933933
// Finite upper bound
934-
fprintf(file, " UI BOUND %-8s %.10g\n",
934+
fprintf(file, " UI BOUND %-8s %.15g\n",
935935
col_names[c_n].c_str(), ub);
936936
}
937937
}
@@ -959,22 +959,22 @@ HighsStatus writeMps(
959959
log_options, HighsLogType::kWarning,
960960
"Upper bound for semi-variable \"%s\" is %g but writing %g\n",
961961
col_names[c_n].c_str(), ub, use_ub);
962-
fprintf(file, " LO BOUND %-8s %.10g\n", col_names[c_n].c_str(),
962+
fprintf(file, " LO BOUND %-8s %.15g\n", col_names[c_n].c_str(),
963963
use_lb);
964964
if (integrality[c_n] == HighsVarType::kSemiInteger) {
965-
fprintf(file, " SI BOUND %-8s %.10g\n",
965+
fprintf(file, " SI BOUND %-8s %.15g\n",
966966
col_names[c_n].c_str(), use_ub);
967967
} else {
968968
// Semi-continuous
969-
fprintf(file, " SC BOUND %-8s %.10g\n",
969+
fprintf(file, " SC BOUND %-8s %.15g\n",
970970
col_names[c_n].c_str(), use_ub);
971971
}
972972
}
973973
} else {
974974
if (!highs_isInfinity(-lb)) {
975975
// Lower bounded variable - default is 0
976976
if (lb) {
977-
fprintf(file, " LO BOUND %-8s %.10g\n",
977+
fprintf(file, " LO BOUND %-8s %.15g\n",
978978
col_names[c_n].c_str(), lb);
979979
}
980980
} else {
@@ -983,7 +983,7 @@ HighsStatus writeMps(
983983
}
984984
if (!highs_isInfinity(ub)) {
985985
// Upper bounded variable
986-
fprintf(file, " UP BOUND %-8s %.10g\n", col_names[c_n].c_str(),
986+
fprintf(file, " UP BOUND %-8s %.15g\n", col_names[c_n].c_str(),
987987
ub);
988988
}
989989
}
@@ -1004,7 +1004,7 @@ HighsStatus writeMps(
10041004
assert(row >= col);
10051005
// May have explicit zeroes on the diagonal
10061006
if (q_value[el])
1007-
fprintf(file, " %-8s %-8s %.10g\n", col_names[col].c_str(),
1007+
fprintf(file, " %-8s %-8s %.15g\n", col_names[col].c_str(),
10081008
col_names[row].c_str(), use_sense * q_value[el]);
10091009
}
10101010
}

0 commit comments

Comments
 (0)