@@ -344,11 +344,16 @@ HighsStatus solveUnconstrainedLp(const HighsOptions& options, const HighsLp& lp,
344344}
345345
346346// Assuming that any user scaling in user_scale_data has been applied,
347- // determine the model coefficient ranges, assess it for excessive
348- // values, and give scaling recommendations, when appropriate
349- void assessExcessiveBoundCost (const HighsLogOptions log_options,
350- const HighsModel& model,
351- const HighsUserScaleData& user_scale_data) {
347+ // determine the model coefficient ranges, assess it for values
348+ // outside the [small, large] range, and give appropriate scaling
349+ // recommendations
350+ void assessCostBoundScaling (const HighsLogOptions log_options,
351+ const HighsModel& model,
352+ const double small_cost,
353+ const double large_cost,
354+ const double small_bound,
355+ const double large_bound,
356+ HighsUserScaleData& user_scale_data) {
352357 const bool user_cost_or_bound_scale = user_scale_data.user_cost_scale || user_scale_data.user_bound_scale ;
353358 std::stringstream message;
354359 if (user_cost_or_bound_scale) {
@@ -469,24 +474,24 @@ void assessExcessiveBoundCost(const HighsLogOptions log_options,
469474
470475 const std::string problem = user_cost_or_bound_scale ? " User-scaled problem" : " Problem" ;
471476
472- if (0 < min_col_cost && min_col_cost < kExcessivelySmallCostValue )
477+ if (0 < min_col_cost && min_col_cost < small_cost )
473478 highsLogUser (log_options, HighsLogType::kWarning ,
474479 " %s has excessively small costs\n " , problem.c_str ());
475- if (max_col_cost > kExcessivelyLargeCostValue )
480+ if (max_col_cost > large_cost )
476481 highsLogUser (log_options, HighsLogType::kWarning ,
477482 " %s has excessively large costs\n " , problem.c_str ());
478483
479- if (0 < min_col_bound && min_col_bound < kExcessivelySmallBoundValue )
484+ if (0 < min_col_bound && min_col_bound < small_bound )
480485 highsLogUser (log_options, HighsLogType::kWarning ,
481486 " %s has excessively small column bounds\n " , problem.c_str ());
482- if (max_col_bound > kExcessivelyLargeBoundValue )
487+ if (max_col_bound > large_bound )
483488 highsLogUser (log_options, HighsLogType::kWarning ,
484489 " %s has excessively large column bounds\n " , problem.c_str ());
485490
486- if (0 < min_row_bound && min_row_bound < kExcessivelySmallBoundValue )
491+ if (0 < min_row_bound && min_row_bound < small_bound )
487492 highsLogUser (log_options, HighsLogType::kWarning ,
488493 " %s has excessively small row bounds\n " , problem.c_str ());
489- if (max_row_bound > kExcessivelyLargeBoundValue )
494+ if (max_row_bound > large_bound )
490495 highsLogUser (log_options, HighsLogType::kWarning ,
491496 " %s has excessively large row bounds\n " , problem.c_str ());
492497
@@ -541,11 +546,11 @@ void assessExcessiveBoundCost(const HighsLogOptions log_options,
541546
542547 double suggested_bound_scaling = suggestScaling (min_scalable_bound,
543548 max_scalable_bound,
544- kExcessivelySmallBoundValue ,
545- kExcessivelyLargeBoundValue );
549+ small_bound ,
550+ large_bound );
546551 // Determine the suggested (new) value for user_bound_scale,
547552 // allowing for the fact that the current value has been applied
548- HighsInt suggested_user_bound_scale =
553+ user_scale_data. suggested_user_bound_scale =
549554 user_scale_data.user_bound_scale +
550555 std::ceil (std::log2 (suggested_bound_scaling));
551556 // Determine the order of magnitude of the suggested bound scaling -
@@ -557,7 +562,7 @@ void assessExcessiveBoundCost(const HighsLogOptions log_options,
557562 //
558563 // Determine the corresponding extreme non-continuous costs and
559564 // update the extreme costs so that cost scalign can be suggested
560- double suggested_user_bound_scale_value = pow (2.0 , suggested_user_bound_scale);
565+ double suggested_user_bound_scale_value = pow (2.0 , user_scale_data. suggested_user_bound_scale );
561566 min_noncontinuous_col_cost *= suggested_user_bound_scale_value;
562567 max_noncontinuous_col_cost *= suggested_user_bound_scale_value;
563568 min_col_cost =
@@ -569,11 +574,11 @@ void assessExcessiveBoundCost(const HighsLogOptions log_options,
569574
570575 double suggested_cost_scaling = suggestScaling (min_col_cost,
571576 max_col_cost,
572- kExcessivelySmallCostValue ,
573- kExcessivelyLargeCostValue );
577+ small_cost ,
578+ large_cost );
574579 // Determine the suggested (new) value for user_cost_scale,
575580 // allowing for the fact that the current value has been applied
576- HighsInt suggested_user_cost_scale =
581+ user_scale_data. suggested_user_cost_scale =
577582 user_scale_data.user_cost_scale +
578583 std::ceil (std::log2 (suggested_cost_scaling));
579584 // Determine the order of magnitude of the suggested cost scaling -
@@ -590,16 +595,16 @@ void assessExcessiveBoundCost(const HighsLogOptions log_options,
590595 if (order_of_magnitude_message)
591596 message << highsFormatToString (" Consider scaling the costs by 1e%+1d" ,
592597 int (suggested_cost_scale_order_of_magnitude));
593- if (suggested_user_cost_scale) {
598+ if (user_scale_data. suggested_user_cost_scale ) {
594599 if (!order_of_magnitude_message) {
595600 message << " Consider" ;
596601 } else {
597602 message << " , or" ;
598603 }
599604 message << highsFormatToString (" setting the user_cost_scale option to %d\n " ,
600- int (suggested_user_cost_scale));
605+ int (user_scale_data. suggested_user_cost_scale ));
601606 }
602- if (order_of_magnitude_message || suggested_user_cost_scale)
607+ if (order_of_magnitude_message || user_scale_data. suggested_user_cost_scale )
603608 highsLogUser (log_options, HighsLogType::kWarning , " %s\n " , message.str ().c_str ());
604609
605610 message.str (std::string ());
@@ -610,16 +615,16 @@ void assessExcessiveBoundCost(const HighsLogOptions log_options,
610615 if (order_of_magnitude_message)
611616 message << highsFormatToString (" Consider scaling the bounds by 1e%+1d" ,
612617 int (suggested_bound_scale_order_of_magnitude));
613- if (suggested_user_bound_scale) {
618+ if (user_scale_data. suggested_user_bound_scale ) {
614619 if (!order_of_magnitude_message) {
615620 message << " Consider" ;
616621 } else {
617622 message << " , or" ;
618623 }
619624 message << highsFormatToString (" setting the user_bound_scale option to %d\n " ,
620- int (suggested_user_bound_scale));
625+ int (user_scale_data. suggested_user_bound_scale ));
621626 }
622- if (order_of_magnitude_message || suggested_user_bound_scale)
627+ if (order_of_magnitude_message || user_scale_data. suggested_user_bound_scale )
623628 highsLogUser (log_options, HighsLogType::kWarning , " %s\n " , message.str ().c_str ());
624629
625630}
0 commit comments