Sync math_opt code
This commit is contained in:
@@ -285,6 +285,7 @@ SolveStatsProto SolveStats::ToProto() const {
|
||||
*proto.mutable_problem_status() = problem_status.ToProto();
|
||||
proto.set_simplex_iterations(simplex_iterations);
|
||||
proto.set_barrier_iterations(barrier_iterations);
|
||||
proto.set_first_order_iterations(first_order_iterations);
|
||||
proto.set_node_count(node_count);
|
||||
return proto;
|
||||
}
|
||||
@@ -299,6 +300,7 @@ SolveStats SolveStats::FromProto(const SolveStatsProto& solve_stats_proto) {
|
||||
ProblemStatus::FromProto(solve_stats_proto.problem_status());
|
||||
result.simplex_iterations = solve_stats_proto.simplex_iterations();
|
||||
result.barrier_iterations = solve_stats_proto.barrier_iterations();
|
||||
result.first_order_iterations = solve_stats_proto.first_order_iterations();
|
||||
result.node_count = solve_stats_proto.node_count();
|
||||
return result;
|
||||
}
|
||||
@@ -310,6 +312,7 @@ std::ostream& operator<<(std::ostream& ostr, const SolveStats& solve_stats) {
|
||||
ostr << ", problem_status: " << solve_stats.problem_status;
|
||||
ostr << ", simplex_iterations: " << solve_stats.simplex_iterations;
|
||||
ostr << ", barrier_iterations: " << solve_stats.barrier_iterations;
|
||||
ostr << ", first_order_iterations: " << solve_stats.first_order_iterations;
|
||||
ostr << ", node_count: " << solve_stats.node_count;
|
||||
ostr << "}";
|
||||
return ostr;
|
||||
|
||||
@@ -133,6 +133,8 @@ struct SolveStats {
|
||||
|
||||
int barrier_iterations = 0;
|
||||
|
||||
int first_order_iterations = 0;
|
||||
|
||||
int node_count = 0;
|
||||
|
||||
// Will CHECK fail on invalid input, if problem_status is invalid.
|
||||
|
||||
@@ -113,7 +113,11 @@ message SolveStatsProto {
|
||||
|
||||
int64 barrier_iterations = 6;
|
||||
|
||||
int64 first_order_iterations = 8;
|
||||
|
||||
int64 node_count = 7;
|
||||
|
||||
// Next id: 9
|
||||
}
|
||||
|
||||
// The reason a call to Solve() terminates.
|
||||
|
||||
@@ -214,6 +214,8 @@ absl::StatusOr<SolveResultProto> PdlpSolver::MakeSolveResult(
|
||||
ASSIGN_OR_RETURN(*result.mutable_solve_stats()->mutable_solve_time(),
|
||||
util_time::EncodeGoogleApiProto(
|
||||
absl::Seconds(pdlp_result.solve_log.solve_time_sec())));
|
||||
result.mutable_solve_stats()->set_first_order_iterations(
|
||||
pdlp_result.solve_log.iteration_count());
|
||||
const std::optional<pdlp::ConvergenceInformation> convergence_information =
|
||||
pdlp::GetConvergenceInformation(pdlp_result.solve_log.solution_stats(),
|
||||
pdlp_result.solve_log.solution_type());
|
||||
|
||||
@@ -152,7 +152,7 @@ absl::Status ValidateSolveStatsConsistency(const SolveStatsProto& solve_stats) {
|
||||
return absl::InvalidArgumentError(
|
||||
absl::StrCat("best_primal_bound is finite, but primal_status is not "
|
||||
"feasible (primal_status = ",
|
||||
solve_stats.problem_status().primal_status()));
|
||||
solve_stats.problem_status().primal_status(), ")"));
|
||||
}
|
||||
if (solve_stats.problem_status().dual_status() !=
|
||||
FEASIBILITY_STATUS_FEASIBLE &&
|
||||
@@ -160,7 +160,7 @@ absl::Status ValidateSolveStatsConsistency(const SolveStatsProto& solve_stats) {
|
||||
return absl::InvalidArgumentError(
|
||||
absl::StrCat("best_dual_bound is finite, but dual_status is not "
|
||||
"feasible (dual_status = ",
|
||||
solve_stats.problem_status().dual_status()));
|
||||
solve_stats.problem_status().dual_status(), ")"));
|
||||
}
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user