scipopt / PyGCGOpt

Python interface and modeling environment for GCG
https://scipopt.github.io/PyGCGOpt/
MIT License
12 stars 4 forks source link

The issue to run PyGCGOpt on Colab #16

Closed abb-omidi closed 9 months ago

abb-omidi commented 1 year ago

Dear support team,

I hope you are doing well. I am trying to solve the scheduling problems by PyGCGopt on Colab in order to compare the solving time of different formulations between GCG and SCIP. Some days ago, I could install Conda on the Colab with !pip install conda, but it does not work for now. I try to import and run that in a different way that works for PySCIPopt, but it caused a major error on GCG. Please, see this MRE.

image

I was wondering if, how can I fix that?

Best regards Abbas

abb-omidi commented 1 year ago

Dear support team,

Is it possible to check the above issue and say how can I fix this?

Regards Abbas

jurgen-lentz commented 1 year ago

Sorry. I will take a look at it in the next days.

jurgen-lentz commented 1 year ago

I run the notebook on Colab. It crashes but it gives me the following output

presolving:
(round 1, fast)       55 del vars, 10 del conss, 0 add conss, 15 chg bounds, 0 chg sides, 0 chg coeffs, 0 upgd conss, 0 impls, 10 clqs
(round 2, fast)       55 del vars, 10 del conss, 0 add conss, 16 chg bounds, 0 chg sides, 0 chg coeffs, 0 upgd conss, 0 impls, 10 clqs
(round 3, exhaustive) 55 del vars, 10 del conss, 0 add conss, 16 chg bounds, 0 chg sides, 0 chg coeffs, 10 upgd conss, 0 impls, 10 clqs
   (0.0s) probing: 51/85 (60.0%) - 0 fixings, 0 aggregations, 0 implications, 0 bound changes
   (0.0s) probing aborted: 50/50 successive totally useless probings
presolving (4 rounds: 4 fast, 2 medium, 2 exhaustive):
 55 deleted vars, 10 deleted constraints, 0 added constraints, 16 tightened bounds, 0 added holes, 0 changed sides, 0 changed coefficients
 0 implications, 10 cliques
presolved problem has 96 variables (85 bin, 0 int, 0 impl, 11 cont) and 384 constraints
     10 constraints of type <setppc>
    374 constraints of type <linear>
Presolving Time: 0.01
 Consclassifier "nonzeros" yields a classification with 3  different constraint classes 
 Consclassifier "constypes" yields a classification with 2 different constraint classes 
 Consclassifier "constypes according to miplib" yields a classification with 3 different constraint classes 
 Conspartition "constypes according to miplib" is not considered since it offers the same structure as "nonzeros" conspartition
 Consclassifier "gamsdomain" yields a classification with 1  different constraint classes 
 Consclassifier "gamssymbols" yields a classification with 1  different constraint classes 
 Conspartition "gamssymbols" is not considered since it offers the same structure as "gamsdomain" conspartition
 Varclassifier "gamsdomain" yields a classification with 1  different variable classes 
 Varclassifier "gamssymbols" yields a classification with 1  different variable classes 
 Varpartition "gamssymbols" is not considered since it offers the same structure as "gamsdomain"
 Varclassifier "vartypes" yields a classification with 2 different variable classes
 Varclassifier "varobjvals" yields a classification with 2 different variable classes
 Varclassifier "varobjvalsigns" yields a classification with 2 different variable classes
 Varpartition "varobjvalsigns" is not considered since it offers the same structure as "varobjvals"
 in dec_consclass: there are 3 different constraint classes   
  the current constraint classifier "nonzeros" consists of 3 different classes   
  the current constraint classifier "constypes" consists of 2 different classes   
  the current constraint classifier "gamsdomain" consists of 1 different classes   
 dec_consclass found 11 new partialdecs 
dec_densemasterconss found 1 new partialdec 
dec_neighborhoodmaster found 1 new partialdec 
POSTPROCESSING of decompositions. Added 1 new decomps. 
Found 15 finished decompositions.
Measured running time per detector:
Detector postprocess               worked on        1 finished decompositions and took a total time of      0.000
Detector consclass                 worked on        8 finished decompositions and took a total time of      0.001
Detector neighborhoodmaster        worked on        1 finished decompositions and took a total time of      0.000
Detector connectedbase             worked on       14 finished decompositions and took a total time of      0.003
Detector varclass                  worked on        5 finished decompositions and took a total time of      0.000
Detection Time: 0.01

A Dantzig-Wolfe reformulation is applied to solve the original problem.
Chosen structure has 11 blocks, 85 linking variables, and 0 linking constraints.
This decomposition has a maxwhite score of 0.002984.
Warning: Discretization with continuous variables is only an experimental feature.

  time | node  | left  |SLP iter|MLP iter|LP it/n| mem |mdpt |ovars|mvars|ocons|mcons|mcuts|  dualbound   | primalbound  |  deg   |  gap   
   0.1s|     1 |     0 |      0 |      0 |     - |6120k|   0 |  96 |   0 | 384 |   0 |   0 | 8.200000e+01 |      --      |   --   |    Inf 
r  0.1s|     1 |     0 |      0 |      0 |     - |6125k|   0 |  96 |   0 | 384 |   0 |   0 | 8.200000e+01 | 1.030000e+02 |   --   |  25.61%
   0.1s|     1 |     0 |      0 |      0 |     - |6437k|   0 |  96 |  51 | 385 |  92 |   0 | 8.200000e+01 | 1.030000e+02 |   0.00%|  25.61%   0.1s|     1 |     0 |      0 |      0 |     - |6437k|   0 |  96 |  51 | 385 |  92 |   0 | 8.200000e+01 | 1.030000e+02 |   0.00%|  25.61%   0.5s|     1 |     0 |    938 |    128 |     - |6905k|   0 |  96 | 136 | 385 |  92 |   0 | 8.200000e+01 | 1.030000e+02 |  84.74%|  25.61%   0.5s|     1 |     0 |    984 |    174 |     - |7257k|   0 |  96 | 136 | 385 |  92 |   0 | 8.200000e+01 | 1.030000e+02 |  84.74%|  25.61%
   0.5s|     1 |     0 |    984 |    174 |     - |7257k|   0 |  96 | 136 | 385 |  92 |   0 | 8.200000e+01 | 1.030000e+02 |  84.74%|  25.61%
   0.5s|     1 |     0 |    984 |    174 |     - |7292k|   0 |  96 | 147 | 385 |  92 |   0 | 8.200000e+01 | 1.030000e+02 |  84.74%|  25.61%
r  0.5s|     1 |     0 |    984 |    174 |     - |7327k|   0 |  96 | 158 | 385 |  92 |   0 | 8.200000e+01 | 8.900000e+01 |  84.74%|   8.54%
   0.5s|     1 |     0 |    984 |    174 |     - |7327k|   0 |  96 | 158 | 385 |  92 |   0 | 8.200000e+01 | 8.900000e+01 |  84.74%|   8.54%
   0.5s|     1 |     0 |    984 |    174 |     - |7329k|   0 |  96 | 158 | 385 |  92 |   0 | 8.200000e+01 | 8.900000e+01 |  84.74%|   8.54%
   0.5s|     1 |     0 |    984 |    174 |     - |7329k|   0 |  96 | 158 | 385 |  92 |   0 | 8.200000e+01 | 8.900000e+01 |  84.74%|   8.54%
   0.5s|     1 |     0 |    984 |    174 |     - |7328k|   0 |  96 | 158 | 374 |  92 |   0 | 8.200000e+01 | 8.900000e+01 |  84.74%|   8.54%
o  0.5s|     1 |     0 |    984 |    174 |     - |7383k|   0 |  96 | 169 | 374 |  92 |   0 | 8.200000e+01 | 8.300000e+01 |  84.74%|   1.22%
L  0.5s|     1 |     0 |    984 |    174 |     - |7413k|   0 |  96 | 180 | 374 |  92 |   0 | 8.200000e+01 | 8.200000e+01 |  84.74%|   0.00%
  time | node  | left  |SLP iter|MLP iter|LP it/n| mem |mdpt |ovars|mvars|ocons|mcons|mcuts|  dualbound   | primalbound  |  deg   |  gap   
   0.5s|     1 |     0 |    984 |    174 |     - |7413k|   0 |  96 | 180 | 374 |  92 |   0 | 8.200000e+01 | 8.200000e+01 |  84.74%|   0.00%

SCIP Status        : problem is solved [optimal solution found]
Solving Time (sec) : 0.55
Solving Nodes      : 1
Primal Bound       : +8.20000000000000e+01 (5 solutions)
Dual Bound         : +8.20000000000000e+01
Gap                : 0.00 %

start task  1  on machine 3 = 61.0
finish task  1  on machine 3 = 65.0
-----------------------------------
start task  2  on machine 3 = 59.0
finish task  2  on machine 3 = 68.0
-----------------------------------
start task  3  on machine 3 = 1.0
finish task  3  on machine 3 = 8.0
-----------------------------------
start task  4  on machine 3 = 65.0
finish task  4  on machine 3 = 70.0
-----------------------------------
start task  5  on machine 3 = 8.0
finish task  5  on machine 3 = 13.0
-----------------------------------
start task  6  on machine 3 = 13.0
finish task  6  on machine 3 = 17.0
-----------------------------------
start task  7  on machine 3 = 67.99999999999996
finish task  7  on machine 3 = 72.99999999999996
-----------------------------------
start task  8  on machine 3 = 70.0
finish task  8  on machine 3 = 79.0
-----------------------------------
start task  9  on machine 3 = 79.0
finish task  9  on machine 3 = 82.0
-----------------------------------
start task  10  on machine 3 = 75.0
finish task  10  on machine 3 = 82.0
-----------------------------------
abb-omidi commented 1 year ago

@jurgen-lentz,

Thanks a lot for your attention. I should note, in many cases, it crashes and in a few one, it can solve the models. Actually. I cannot take a solution from the MRE. I think you are so lucky. :) I am looking forward to hearing from you.

Regards Abbas

abb-omidi commented 1 year ago

Dear support team,

Would you say please, do you have any update on pygcgopt running on the colab to resolve this issue?

Regards Abbas

jurgen-lentz commented 1 year ago

Did the answer of Matthias not work?

Hi Abbas,

"!pip install conda" is not going to work. You should use the following to get conda in Colab:

!pip install -q condacolab import condacolab condacolab.install()

I hope that helps!

Cheers Matthias

abb-omidi commented 1 year ago

Dear @jurgen-lentz,

Thanks for your attention. Actually I have used condalab instead of conda because recently colab does not support conda at all.

I have checked pygcgopt on the different problems and almost in all of the cases the issues is remaining. Even though I try to install pyscipopt first and then pygcgopt, but the solver behavior is the same as the before.

I was wondering if, you can check that and see this strange behavior.

All the best Abbas

jurgen-lentz commented 1 year ago

Dear @abb-omidi,

yes, I also have the same behavior on Colaboratory.

But running your code as a python script with conda locally, did work perfectly. Can you look if it crashes also locally?

Best wishes Jurgen

abb-omidi commented 1 year ago

Dear @jurgen-lentz,

Thank you so much for checking and verifying that. Actually, I used pygcgopt locally with colab and it works well. At the moment I am willing to work with that as a part of DDOM on colab and it would be great if its developer team could fix this issue.

Best regards Abbas