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

Dev/qp #63

Conversation

cheesecakeball
Copy link
Collaborator

Add DspOsiGrb.h

@kibaekkim
Copy link
Collaborator

@cheesecakeball need try and catch to handle GUROBI_CALL.

@kibaekkim
Copy link
Collaborator

kibaekkim commented May 27, 2020

@kibaekkim kibaekkim linked an issue May 27, 2020 that may be closed by this pull request
@cheesecakeball
Copy link
Collaborator Author

ready to review

Copy link
Collaborator

@kibaekkim kibaekkim left a comment

Choose a reason for hiding this comment

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

Sorry. As I said, I am actively working on the code. Some of the modified files in your branch are out-dated. My changes should not be dramatic. Please merge dev/rm-cpx into your branch and resolve any conflict.

FYI: https://stackoverflow.com/questions/6836461/updating-the-current-branch-from-parent-branch

Please also don't forget to test the code.

CMakeLists.txt Outdated Show resolved Hide resolved
UserConfig.cmake Outdated Show resolved Hide resolved
extra/CMakeLists.txt Outdated Show resolved Hide resolved
@cheesecakeball
Copy link
Collaborator Author

This is ready to review, but I have some issues here.

In the param_grb.txt, if I set the parameter DW/MASTER/SOLVER to 0 as in the file, I can pass the test. However, if I am using Gurobi to solve DW master problem, i.e., DW/MASTER/SOLVER 4, I could not pass the test. I got the following result

Creating DSP environment
Reading SMPS files: farmer
Coin0001I At line 2 NAME          FARMER
Coin0001I At line 3 ROWS
Coin0001I At line 9 COLUMNS
Coin0001I At line 22 RHS
Coin0001I At line 25 BOUNDS
Coin0001I At line 30 ENDATA
Coin0002I Problem FARMER has 4 rows, 9 columns and 12 elements
Coin0001I At line 2 TIME          FARMER
Coin0001I At line 3 PERIODS       IMPLICIT
Coin0001I At line 6 ENDATA

Coin0001I At line 2 STOCH         FARMER
Coin0001I At line 3 SCENARIOS
Coin0001I At line 16 ENDATA
Read SMPS files: 0.000808 sec.
First stage: 1 rows, 3 cols, 3 integers
Second stage: 3 rows, 6 cols, 0 integers
Number of scenarios: 3
Reading parameter files: /Users/yingqiuzhang/Documents/DSPtest/DSP/test/params_grb.txt
Initializing subproblems ... 
Academic license - for non-commercial use only
Warning: parameter changes on this environment will not affect existing models.
Initializing master problem ... 
Initializing ALPS framework ... 
DwModelSmip constructor.
Created BRANCH_NONANT2 rule.
==  Welcome to the Abstract Library for Parallel Search (ALPS) 
==  Copyright 2000-2017 Lehigh University and others 
==  All Rights Reserved. 
==  Distributed under the Eclipse Public License 1.0 
==  Version: Trunk (unstable) 
==  Build Date: Jun  2 2020
Alps0250I Starting search ...
Generated 3 initial columns. Initial dual bound -1.153999994455e+05
Iteration   0: DW Bound +1.797693e+308, Best Dual -1.154000e+05 (gap Large %), nrows 6, ncols 12, timing (total 0.01, master 0.00, gencols 0.01), statue 3000
Iteration   1: DW Bound +1.797693e+308, Best Dual -1.129653e+05 (gap Large %), nrows 9, ncols 12, timing (total 0.01, master 0.00, gencols 0.01), statue 3000
Iteration   2: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 11, ncols 12, timing (total 0.02, master 0.00, gencols 0.01), statue 3000
Iteration   3: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.02, master 0.00, gencols 0.02), statue 3000
Iteration   4: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.02, master 0.00, gencols 0.02), statue 3000
Iteration   5: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.03, master 0.00, gencols 0.02), statue 3000
Iteration   6: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.03, master 0.00, gencols 0.03), statue 3000
Iteration   7: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.03, master 0.00, gencols 0.03), statue 3000
Iteration   8: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.04, master 0.00, gencols 0.03), statue 3000
Iteration   9: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.04, master 0.00, gencols 0.04), statue 3000
Iteration  10: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.05, master 0.01, gencols 0.04), statue 3000
Iteration  11: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.05, master 0.01, gencols 0.04), statue 3000
Iteration  12: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.06, master 0.01, gencols 0.05), statue 3000
Iteration  13: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.06, master 0.01, gencols 0.05), statue 3000
Iteration  14: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.06, master 0.01, gencols 0.05), statue 3000
Iteration  15: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.07, master 0.01, gencols 0.06), statue 3000
Iteration  16: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.08, master 0.01, gencols 0.07), statue 3000
Iteration  17: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.08, master 0.01, gencols 0.07), statue 3000
Iteration  18: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.08, master 0.01, gencols 0.07), statue 3000
Iteration  19: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.08, master 0.01, gencols 0.07), statue 3000
Iteration  20: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.09, master 0.01, gencols 0.07), statue 3000
Iteration  21: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.09, master 0.01, gencols 0.08), statue 3000
Iteration  22: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.09, master 0.01, gencols 0.08), statue 3000
Iteration  23: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.10, master 0.01, gencols 0.08), statue 3000
Iteration  24: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.10, master 0.01, gencols 0.09), statue 3000
Iteration  25: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.11, master 0.01, gencols 0.09), statue 3000
Iteration  26: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.11, master 0.01, gencols 0.10), statue 3000
Iteration  27: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.12, master 0.01, gencols 0.10), statue 3000
Iteration  28: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.12, master 0.01, gencols 0.11), statue 3000
Iteration  29: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.13, master 0.01, gencols 0.11), statue 3000
Iteration  30: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.13, master 0.01, gencols 0.11), statue 3000
Iteration  31: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.14, master 0.01, gencols 0.12), statue 3000
Iteration  32: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.14, master 0.01, gencols 0.12), statue 3000
Iteration  33: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.14, master 0.01, gencols 0.13), statue 3000
Iteration  34: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.15, master 0.01, gencols 0.13), statue 3000
Iteration  35: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.15, master 0.01, gencols 0.13), statue 3000
Iteration  36: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.15, master 0.01, gencols 0.13), statue 3000
Iteration  37: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.15, master 0.01, gencols 0.14), statue 3000
Iteration  38: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.16, master 0.01, gencols 0.14), statue 3000
Iteration  39: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.16, master 0.01, gencols 0.14), statue 3000
Iteration  40: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.17, master 0.01, gencols 0.15), statue 3000
Iteration  41: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.17, master 0.01, gencols 0.15), statue 3000
Iteration  42: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.17, master 0.01, gencols 0.15), statue 3000
Iteration  43: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.17, master 0.02, gencols 0.16), statue 3000
Iteration  44: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.18, master 0.02, gencols 0.16), statue 3000
Iteration  45: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.18, master 0.02, gencols 0.16), statue 3000
Iteration  46: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.19, master 0.02, gencols 0.17), statue 3000
Iteration  47: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.19, master 0.02, gencols 0.17), statue 3000
Iteration  48: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.20, master 0.02, gencols 0.18), statue 3000
Iteration  49: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.20, master 0.02, gencols 0.18), statue 3000
Iteration  50: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.20, master 0.02, gencols 0.18), statue 3000
Iteration  51: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.21, master 0.02, gencols 0.18), statue 3000
Iteration  52: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.21, master 0.02, gencols 0.19), statue 3000
Iteration  53: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.21, master 0.02, gencols 0.19), statue 3000
Iteration  54: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.22, master 0.02, gencols 0.20), statue 3000
Iteration  55: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.22, master 0.02, gencols 0.20), statue 3000
Iteration  56: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.22, master 0.02, gencols 0.20), statue 3000
Iteration  57: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.23, master 0.02, gencols 0.20), statue 3000
Iteration  58: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.23, master 0.02, gencols 0.21), statue 3000
Iteration  59: DW Bound +1.797693e+308, Best Dual -1.120503e+05 (gap Large %), nrows 12, ncols 12, timing (total 0.24, master 0.02, gencols 0.21), statue 3000
Found new primal solution: -1.072400e+05
[0.240335] curLb 1.79769313e+308, bestUb -1.07239999e+05, bestLb 1.79769313e+308
The current node is fathomed.
Alps0240I Proc: 1, Part: 0, Cand: 0, Best N: 1e+75, Best S: -107240

Alps0208I Search completed.
Alps0260I Best solution found had quality -107240
Alps0264I Number of nodes processed:                1
Alps0267I Number of nodes branched:                 0
Alps0268I Number of nodes pruned before processing: 0
Alps0270I Number of nodes left:                     0
Alps0272I Tree depth: 0
Alps0274I Search CPU time: 0.19 seconds
Alps0278I Search wall-clock time: 0.24 seconds
Time spent in heuristics: 0.00 seconds
Status: 3000
Primal Bound: -107240
Dual Bound  : -107240
Gap (%)     : 0
Deleting DSP environment

So I believe the Gurobi is not solving the master problem correctly.
I was trying to solve this problem for several days. I located where the iterations is printed, it turns out it is in Alps library. From my understanding, all models and solvers' information are passed into Alps library for DW algorithm. More specifically, it is in the rootsearch() function, and the rootsearch() function called the function solveMaster ().
However, I still cannot figure out why I cannot get the optimal solution, why this error happens.

By the way, in the information printed in each iteration, should it be state 3000 instead of statue 3000?

src/Utility/DspParams.cpp Outdated Show resolved Hide resolved
@kibaekkim kibaekkim linked an issue Jun 3, 2020 that may be closed by this pull request
@cheesecakeball
Copy link
Collaborator Author

This is ready to review.
All tests (with and without MPI) are passed.
Fixed the behavior for DW.
Updated cmake files.
Deleted garbage messages.

kibaekkim added a commit that referenced this pull request Jun 11, 2020
The code has already been reviewed in the previous PR #63
@kibaekkim kibaekkim removed a link to an issue Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong behavior of DW with Gurobi
2 participants