Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/detect_xpress_at_runtime #707

Closed
wants to merge 40 commits into from

Conversation

a-zakir
Copy link
Contributor

@a-zakir a-zakir commented Oct 18, 2023

  • Detect Xpress at Runtime
  • Release one asset for each platform

@JasonMarechal25 JasonMarechal25 linked an issue Oct 19, 2023 that may be closed by this pull request
@JasonMarechal25
Copy link
Contributor

JasonMarechal25 commented Oct 31, 2023

I've tried to use it. When I run a simulation (example/SmallTestFiveCandidates) with solver = xpress but xpress missing from my env I get the following output

[Full Run - Problem Generation][INFO 31-10-2023 14:55:55] rename problems: false
Could not find the Xpress shared library. Looked in: [/lib/libxprs.so', '/opt/xpressmp/lib/libxprs.so', ']. Please check environment variable XPRESSDIR

Warning: false
Warning: false
Warning: false

With the warning repeated a lot of times
then

[Benders][INFO 31-10-2023 14:55:57] starting Benders mpi
                     LOG_LEVEL                                                 0
                MAX_ITERATIONS                                                -1
                  ABSOLUTE_GAP                                                10
                  RELATIVE_GAP                                             1e-06
                   RELAXED_GAP                                             1e-05
              SEPARATION_PARAM                                               0.5
            MASTER_FORMULATION                                           integer
                   AGGREGATION                                                 0
                    OUTPUTROOT                                                 .
                         TRACE                                                 1
                  SLAVE_WEIGHT                                          CONSTANT
            SLAVE_WEIGHT_VALUE                                                 3
                   MASTER_NAME                                            master
                STRUCTURE_FILE                                     structure.txt
                     INPUTROOT                                                 .
                      CSV_NAME                              benders_output_trace
                   BOUND_ALPHA                                                 1
                   SOLVER_NAME                                            XPRESS
                     JSON_FILE/home/marechaljas/CLionProjects/antares-xpansion/examples/SmallTestFiveCandidates/output/20231031-1455eco-Xpansion/expansion/out.json
      LAST_ITERATION_JSON_FILE/home/marechaljas/CLionProjects/antares-xpansion/examples/SmallTestFiveCandidates/output/20231031-1455eco-Xpansion/expansion/last_iteration.json
                    TIME_LIMIT                                             1e+12
               LAST_MASTER_MPS                             master_last_iteration
                        RESUME                                                 0
             LAST_MASTER_BASIS                             master_last_basis.bss
                    BATCH_SIZE                                                 0



Warning: false
[Benders][INFO 31-10-2023 14:55:57] error: This is line 93 of file /home/marechaljas/CLionProjects/antares-xpansion/src/cpp/multisolver_interface/SolverFactory.cpp (function create_solver)
Solver 'XPRESS' not supported

--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode 1.

If I run with default solver it works as intended. However I do get:

Could not find the Xpress shared library. Looked in: [/lib/libxprs.so', '/opt/xpressmp/lib/libxprs.so', ']. Please check environment variable XPRESSDIR

Warning: false

With the last warning repeated several times

I note 3 points:

  • The "Warning false" obscuring the output
  • The warning around xpress when we didn't ask for an xpress simulation
  • The error at benders step when Xpress is not present. This should be caught earlier

@a-zakir a-zakir requested a review from flomnes November 10, 2023 09:12
Comment on lines +184 to +191
xpress_dynamic_library->GetFunction(&XPRSinit, "XPRSinit");
xpress_dynamic_library->GetFunction(&XPRScopyprob, "XPRScopyprob");
xpress_dynamic_library->GetFunction(&XPRSwritebasis, "XPRSwritebasis");
xpress_dynamic_library->GetFunction(&XPRSreadprob, "XPRSreadprob");
xpress_dynamic_library->GetFunction(&XPRSreadbasis, "XPRSreadbasis");
xpress_dynamic_library->GetFunction(&XPRSgetrows, "XPRSgetrows");
xpress_dynamic_library->GetFunction(&XPRSgetindex, "XPRSgetindex");
xpress_dynamic_library->GetFunction(&XPRSgetnames, "XPRSgetnames");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can keep here only the XPRS functions that are actually called. See for example grep XPRS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I commented out the unnecessary functions and added others especially for xpansion. I have to do it also with defines.
this needs to be cleaned

src/cpp/multisolver_interface/environment.cc Outdated Show resolved Hide resolved
src/cpp/multisolver_interface/environment.cc Outdated Show resolved Hide resolved
@@ -68,5 +73,6 @@ if(COIN_OR)
Coin::CoinUtils
Coin::Osi
Coin::Cbc
${CMAKE_DL_LIBS}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend creating a library to load XPRESS, and to link it against -ldl

Also, -ldl doesn't exist in Windows

src/cpp/multisolver_interface/SolverXpress.cpp Outdated Show resolved Hide resolved
src/cpp/multisolver_interface/CMakeLists.txt Show resolved Hide resolved
#ifdef COIN_OR
#include "SolverCbc.h"
#include "SolverClp.h"
#endif
#include "LogUtils.h"
#include "multisolver_interface/SolverFactory.h"
std::vector<std::string> tmp;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give a more meaningful name to this variable please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug D 2 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 116 Code Smells

20.6% 20.6% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@a-zakir a-zakir closed this Nov 24, 2023
@a-zakir a-zakir deleted the feature/detect_xpress_at_runtime branch October 9, 2024 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Load xpress at runtime
3 participants