Skip to content

warning and error when using HIGHS solver (ortools 9.10) #4590

Closed

Description

@bzk226

I did not enable the log, but it shows:

WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1741846407.558447  359140 highs_interface.cc:165] status: MPSOLVER_OPTIMAL
objective_value: 3
variable_value: 0
variable_value: 1
variable_value: 0
variable_value: 0
variable_value: -0
variable_value: 1
variable_value: 1
variable_value: -0
variable_value: 0
best_objective_bound: 3
solve_info {
  solve_wall_time_seconds: 0.001253
  solve_user_time_seconds: 0.001254
}

Activity

  1. self-assigned this
    on Mar 13, 2025
  2. added
    Help NeededModeling/Usage problem
    Lang: C++Native implementation issue
    Solver: Linear SolverRelated to all Linear Solver (GLOP, BOP, CBC etc...)
    on Mar 13, 2025
  3. added this to the v9.13 milestone on Mar 13, 2025
  4. Mizux commented on Mar 13, 2025

    @Mizux
    Collaborator

    Which binary and command did you run ?

    WARNING: All log messages before absl::InitializeLog() is called are written to STDERR

    This is a know issue, our examples miss an init log call, on my way to fix this...

    #include "absl/base/log_severity.h"
    #include "absl/log/globals.h"
    #include "absl/log/initialize.h"
    ...
    
    int main(int argc, char** argv) {
      absl::InitializeLog();
      absl::ParseCommandLine(argc, argv);
      absl::EnableLogPrefix(false);
      absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo);
      ....

    or

    #include "absl/base/log_severity.h"
    #include "absl/log/globals.h"
    #include "ortools/base/init_google.h"
    
    int main(int argc, char** argv) {
    InitGoogle(argv[0], &argc, &argv, true); // InitializeLog, SetUsage, ParseCommandLine
    absl::EnableLogPrefix(false);
    absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo);
  5. bzk226 commented on Mar 13, 2025

    @bzk226
    Author

    Thanks. I called HIGHS using pywraplp and tried to solve a mip problem. Could you help me to init log call with python lang? And should I use pywraplp or mathopt to call HIGHS or other solvers?

    This is a know issue, our examples miss an init log call, on my way to fix this...

    #include "absl/base/log_severity.h"
    #include "absl/log/globals.h"
    #include "absl/log/initialize.h"
    ...

    int main(int argc, char** argv) {
    absl::InitializeLog();
    absl::EnableLogPrefix(false);
    absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo);
    absl::ParseCommandLine(argc, argv);
    ....
    or

    #include "absl/base/log_severity.h"
    #include "absl/log/globals.h"
    #include "ortools/base/init_google.h"

    int main(int argc, char** argv) {
    absl::EnableLogPrefix(false);
    absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo);
    InitGoogle(argv[0], &argc, &argv, true);

  6. lperron commented on Mar 13, 2025

    @lperron
    Collaborator

    can you first try with 9.12 ?

  7. bzk226 commented on Mar 14, 2025

    @bzk226
    Author

    can you first try with 9.12 ?

    After I upgraded the version to 9.12, the following error occurred in the program. Why did this happen?

    Process finished with exit code 139 (interrupted by signal 11:SIGSEGV)

  8. lperron commented on Mar 14, 2025

    @lperron
    Collaborator

    without a way to reproduce the model, we cannot do anything

  9. Mizux commented on May 16, 2025

    @Mizux
    Collaborator

    For python you should use something like this:

    from ortools.init.python import init
    
     init.CppBridge.init_logging("your_program.py")

    ref: https://github.com/google/or-tools/blob/main/ortools/init/python/init_test.py

  10. added a commit that references this issue on May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Help NeededModeling/Usage problemLang: C++Native implementation issueSolver: Linear SolverRelated to all Linear Solver (GLOP, BOP, CBC etc...)

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions