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

Refactor cstr to fix benchmark issues #63

Open
6 of 7 tasks
Tracked by #60
tristantc opened this issue Nov 7, 2024 · 1 comment
Open
6 of 7 tasks
Tracked by #60

Refactor cstr to fix benchmark issues #63

tristantc opened this issue Nov 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@tristantc
Copy link
Contributor

tristantc commented Nov 7, 2024

Description

This Issue aims to address and refactor the cstr model to fix benchmark issues as outlined in Issue #60.

Solution strategy causing issues:

  • Big-M MINLP reformulation
  • Hull MINLP reformulation
  • GLOA
  • Enumeration
  • LOA
  • LBB
  • RIC

Branch

This PR targets the benchmark_zd branch.

Steps to Reproduce

  1. Run the benchmark tests for the cstr module before applying the changes.
  2. Apply the changes from this PR.
  3. Re-run the benchmark tests to verify performance improvements.

Notes

  • Ensure that all sub-solvers are tested thoroughly after refactoring.
  • Additional optimizations may be required based on benchmark results.

Feel free to adjust any details as necessary before submitting the PR.

@tristantc tristantc changed the title Refactor to fix benchmark issues Refactor cstr to fix benchmark issues Nov 7, 2024
@tristantc tristantc added the bug Something isn't working label Nov 7, 2024
@tristantc
Copy link
Contributor Author

tristantc commented Nov 7, 2024

GLOA log output

Starting GDPopt version 22.5.13 using GLOA algorithm
iterlim: None
time_limit: 3600
tee: true
logger: <Logger pyomo.contrib.gdpopt (INFO)>
integer_tolerance: 1e-05
constraint_tolerance: 1e-06
variable_tolerance: 1e-08
subproblem_initialization_method: <function restore_vars_to_original_values at 0x7fd517337ce0>
call_before_subproblem_solve: <class 'pyomo.contrib.gdpopt.util._DoNothing'>
call_after_subproblem_solve: <class 'pyomo.contrib.gdpopt.util._DoNothing'>
call_after_subproblem_feasible: <class 'pyomo.contrib.gdpopt.util._DoNothing'>
force_subproblem_nlp: false
subproblem_presolve: true
tighten_nlp_var_bounds: false
round_discrete_vars: true
max_fbbt_iterations: 3
init_strategy: None
init_algorithm: set_covering
custom_init_disjuncts: []
max_slack: 1000.0
OA_penalty_factor: 1000.0
set_cover_iterlim: 8
discrete_problem_transformation: gdp.bigm
call_before_discrete_problem_solve: <class 'pyomo.contrib.gdpopt.util._DoNothing'>
call_after_discrete_problem_solve: <class 'pyomo.contrib.gdpopt.util._DoNothing'>
call_before_master_solve: <class 'pyomo.contrib.gdpopt.util._DoNothing'>
call_after_master_solve: <class 'pyomo.contrib.gdpopt.util._DoNothing'>
mip_presolve: true
calc_disjunctive_bounds: false
obbt_disjunctive_bounds: false
mip_solver: gams
mip_solver_args:
  add_options: ['option threads=1']
  tee: true
nlp_solver: gams
nlp_solver_args:
  add_options: ['option threads=1;', '$onecho > baron.opt', 'FirstLoc 1', '$offecho', 'GAMS_MODEL.optfile=1', 'option optcr=1e-2;']
  solver: baron
  tee: true
minlp_solver: gams
minlp_solver_args:
  add_options: ['option threads=1;', 'option optcr=1e-6;']
  solver: baron
  tee: true
local_minlp_solver: gams
local_minlp_solver_args:
  add_options: ['option threads=1;', '$onecho > baron.opt', 'FirstLoc 1', '$offecho', 'GAMS_MODEL.optfile=1', 'option optcr=1e-2;']
  solver: baron
  tee: true
small_dual_tolerance: 1e-08
bound_tolerance: 0.01

If you use this software, you may cite the following:
            - Implementation:
            Chen, Q; Johnson, ES; Bernal, DE; Valentin, R; Kale, S;
            Bates, J; Siirola, JD; Grossmann, IE.
            Pyomo.GDP: an ecosystem for logic based modeling and optimization
            development.
            Optimization and Engineering, 2021.

- GLOA algorithm:
        Lee, S; Grossmann, IE.
        A Global Optimization Algorithm for Nonconvex Generalized
        Disjunctive Programming and Applications to Process Systems.
        Comp. and Chem. Eng. 2001, 25, 1675-1697.
        DOI: 10.1016/S0098-1354(01)00732-3.
Original model has 100 constraints (17 nonlinear) and 10 disjunctions, with 76 variables, of which 20 are binary, 0 are integer, and 56 are continuous.
---Starting GDPopt initialization---
Starting set covering initialization.
=============================================================================================
Iteration | Subproblem Type | Lower Bound | Upper Bound |   Gap    | Time(s)

--- Job model.gms Start 10/17/24 20:21:43 47.6.0 c2de9d6d LEX-LEG x86 64bit/Linux
--- Applying:
    /package/gams/47.6.0/gmsprmun.txt
--- GAMS Parameters defined
    Input /tmp/tmpadv92w2s/model.gms
    Output /tmp/tmpadv92w2s/output.lst
    ScrDir /tmp/tmpadv92w2s/225a/
    SysDir /package/gams/47.6.0/
    CurDir /tmp/tmpadv92w2s/
    LogOption 3

Processor information: 1 socket(s), 48 core(s), and 96 thread(s) available
GAMS 47.6.0   Copyright (C) 1987-2024 GAMS Development. All rights reserved
--- Starting compilation
--- model.gms(1286) 2 Mb
--- Starting execution: elapsed 0:00:00.016
--- model.gms(835) 3 Mb
--- Generating MIP model GAMS_MODEL
--- model.gms(839) 3 Mb
---   280 rows  114 columns  655 non-zeroes
---   65 discrete-columns
--- Range statistics (absolute non-zero finite values)
--- RHS       [min, max] : [ 1.000E+00, 2.000E+01] - Zero values observed as well
--- Bound     [min, max] : [ 1.000E+00, 1.000E+01] - Zero values observed as well
--- Matrix    [min, max] : [ 9.500E-01, 2.000E+01]
--- Executing CPLEX (Solvelink=5): elapsed 0:00:00.020

IBM ILOG CPLEX   47.6.0 c2de9d6d Sep 12, 2024          LEG x86 64bit/Linux    

--- GAMS/CPLEX licensed for continuous and discrete problems.
--- GMO setup time: 0.00s
--- GMO memory 0.54 Mb (peak 0.55 Mb)
--- Dictionary memory 0.00 Mb
--- Cplex 22.1.1.0 link memory 0.01 Mb (peak 0.02 Mb)
--- Starting Cplex

Version identifier: 22.1.1.0 | 2022-11-28 | 9160aff4d
CPXPARAM_Advance                                 0
CPXPARAM_Threads                                 1
CPXPARAM_MIP_Display                             4
CPXPARAM_MIP_Pool_Capacity                       0
CPXPARAM_TimeLimit                               3599.7754099676386
CPXPARAM_MIP_Tolerances_AbsMIPGap                0
Generic callback                                 0x50
Tried aggregator 3 times.
MIP Presolve eliminated 155 rows and 42 columns.
MIP Presolve modified 59 coefficients.
Aggregator did 31 substitutions.
Reduced MIP has 93 rows, 41 columns, and 231 nonzeros.
Reduced MIP has 16 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.00 sec. (0.62 ticks)
Found incumbent of value 55.000000 after 0.00 sec. (0.84 ticks)
Probing changed sense of 4 constraints.
Probing time = 0.00 sec. (0.07 ticks)
Cover probing fixed 0 vars, tightened 1 bounds.
Tried aggregator 1 time.
Detecting symmetries...
MIP Presolve eliminated 11 rows and 4 columns.
MIP Presolve modified 10 coefficients.
Reduced MIP has 82 rows, 37 columns, and 197 nonzeros.
Reduced MIP has 12 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.00 sec. (0.18 ticks)
Probing time = 0.00 sec. (0.04 ticks)
Clique table members: 16.
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: none, using 1 thread.
Tried aggregator 1 time.
No LP presolve or aggregator reductions.
Presolve time = 0.00 sec. (0.03 ticks)
Initializing dual steep norms . . .

Iteration log . . .
Iteration:     1   Dual objective     =            85.000000
Root relaxation solution time = 0.00 sec. (0.07 ticks)

        Nodes                                         Cuts/
   Node  Left     Objective  IInf  Best Integer    Best Bound    ItCnt     Gap

*     0+    0                           55.0000       85.0000            54.55%
Found incumbent of value 55.000000 after 0.00 sec. (1.30 ticks)
*     0     0      integral     0       85.0000       85.0000        1    0.00%
Elapsed time = 0.00 sec. (1.31 ticks, tree = 0.00 MB)
Found incumbent of value 85.000000 after 0.00 sec. (1.31 ticks)

Root node processing (before b&c):
  Real time             =    0.00 sec. (1.31 ticks)
Sequential b&c:
  Real time             =    0.00 sec. (0.00 ticks)
                          ------------
Total (root+branch&cut) =    0.00 sec. (1.31 ticks)

--- MIP status (101): integer optimal solution.
--- Cplex Time: 0.00sec (det. 1.31 ticks)

--- Returning a primal only solution to GAMS (marginals all set to NA).
--- Fixing integer variables and solving final LP...

Version identifier: 22.1.1.0 | 2022-11-28 | 9160aff4d
CPXPARAM_Advance                                 2
CPXPARAM_Threads                                 1
CPXPARAM_MIP_Display                             4
CPXPARAM_MIP_Pool_Capacity                       0
CPXPARAM_TimeLimit                               3599.7754099676386
CPXPARAM_MIP_Tolerances_AbsMIPGap                0
Tried aggregator 1 time.
LP Presolve eliminated 276 rows and 111 columns.
Aggregator did 3 substitutions.
All rows and columns eliminated.
Presolve time = 0.00 sec. (0.10 ticks)

--- Fixed MIP status (1): optimal.
--- Cplex Time: 0.00sec (det. 0.18 ticks)


Proven optimal solution
MIP Solution:           85.000000    (1 iterations, 0 nodes)
Final Solve:            85.000000    (0 iterations)

Best possible:          85.000000
Absolute gap:            0.000000
Relative gap:            0.000000

--- Reading solution for model GAMS_MODEL
--- Executing after solve: elapsed 0:00:00.028
--- model.gms(1286) 5 Mb
--- Putfile results /tmp/tmpadv92w2s/results.dat
--- Putfile statresults /tmp/tmpadv92w2s/resultsstat.dat
*** Status: Normal completion
--- Job model.gms Stop 10/17/24 20:21:43 elapsed 0:00:00.029
WARNING: implicitly casting 'YR_is_recycle[1].indicator_var' value 1 to bool
WARNING: implicitly casting 'YP_is_cstr[1].indicator_var' value 1 to bool
WARNING: implicitly casting 'YR_is_recycle[2].indicator_var' value 0 to bool
WARNING: implicitly casting 'YP_is_cstr[2].indicator_var' value 1 to bool
WARNING: implicitly casting 'YR_is_recycle[3].indicator_var' value 0 to bool
WARNING: implicitly casting 'YP_is_cstr[3].indicator_var' value 1 to bool
WARNING: implicitly casting 'YR_is_recycle[4].indicator_var' value 0 to bool
WARNING: implicitly casting 'YP_is_cstr[4].indicator_var' value 1 to bool
WARNING: implicitly casting 'YR_is_recycle[5].indicator_var' value 0 to bool
WARNING: implicitly casting 'YP_is_cstr[5].indicator_var' value 1 to bool
--- Job model.gms Start 10/17/24 20:21:44 47.6.0 c2de9d6d LEX-LEG x86 64bit/Linux
--- Applying:
    /package/gams/47.6.0/gmsprmun.txt
--- GAMS Parameters defined
    Input /tmp/tmp71nz7lio/model.gms
    Output /tmp/tmp71nz7lio/output.lst
    ScrDir /tmp/tmp71nz7lio/225a/
    SysDir /package/gams/47.6.0/
    CurDir /tmp/tmp71nz7lio/
    LogOption 3

Processor information: 1 socket(s), 48 core(s), and 96 thread(s) available
GAMS 47.6.0   Copyright (C) 1987-2024 GAMS Development. All rights reserved
--- Starting compilation
--- model.gms(407) 2 Mb
--- Starting execution: elapsed 0:00:00.015
--- model.gms(257) 3 Mb
--- Generating MINLP model GAMS_MODEL
--- model.gms(261) 5 Mb
--- Reset Solvelink = 2
---   48 rows  45 columns  129 non-zeroes
---   83 nl-code  40 nl-non-zeroes
---   4 discrete-columns
--- Range statistics (absolute non-zero finite values)
--- RHS       [min, max] : [ 1.000E-02, 9.000E+00] - Zero values observed as well
--- Bound     [min, max] : [ 1.000E+00, 1.000E+01] - Zero values observed as well
--- Matrix    [min, max] : [ 9.500E-01, 5.000E+00] - Zero values observed as well
--- model.gms(261) 3 Mb
--- Executing BARON (Solvelink=2): elapsed 0:00:00.016

GAMS/BARON       47.6.0 c2de9d6d Sep 12, 2024          LEG x86 64bit/Linux    

===========================================================================
 BARON version 24.5.8. Built: LNX-64 Wed May 8 10:06:40 EDT 2024 
 Running on machine dantzig.ecn.purdue.edu

 BARON is a product of The Optimization Firm.
 For information on BARON, see https://minlp.com/about-baron

 If you publish work using this software, please cite publications from
 https://minlp.com/baron-publications, such as: 

 Khajavirad, A. and N. V. Sahinidis,
 A hybrid LP/NLP paradigm for global optimization relaxations,
 Mathematical Programming Computation, 10, 383-421, 2018.
===========================================================================
 This BARON run may utilize the following subsolver(s)
 For LP/MIP/QP: CLP/CBC, ILOG CPLEX                             
 For NLP: MINOS, SNOPT, External NLP, IPOPT, FILTERSQP
===========================================================================
 Doing local search
 Preprocessing found feasible solution with value 3.13020
 Solving bounding LP
 Starting multi-start local search
 Done with local search
===========================================================================
  Iteration    Open nodes         Time (s)    Lower bound      Upper bound
          1             1             0.18      1.14300          3.13020                 
*         8+            4             0.33      2.18511          3.13019                 
*       426            15             0.81      3.03166          3.13017                 
*       485            13             0.90      3.03166          3.13016                 
*       654            11             0.99      3.03166          3.13014                 
       2010             0             1.78      3.13013          3.13013                 

                         *** Normal completion ***            

 Wall clock time:                     1.79
 Total CPU time used:                 1.78

 Total no. of BaR iterations:    2010
 Best solution found at node:    1208
 Max. no. of nodes in memory:      20
 
 All done
===========================================================================

Solution      = 3.13012906092058  found at node 1208
Best possible = 3.13012906092058
Absolute gap  = 0  optca = 1E-9
Relative gap  = 0  optcr = 1E-6

--- Reading solution for model GAMS_MODEL
***
*** Solver did not provide marginals for model GAMS_MODEL
***
--- Executing after solve: elapsed 0:00:01.836
--- model.gms(264) 3 Mb
--- model.gms(407) 5 Mb
--- Putfile results /tmp/tmp71nz7lio/results.dat
--- Putfile statresults /tmp/tmp71nz7lio/resultsstat.dat
*** Status: Normal completion
--- Job model.gms Stop 10/17/24 20:21:45 elapsed 0:00:01.837
        0        subproblem          -inf       3.13013       inf%      2.37  *

Solved in 0 iterations and 2.36730 seconds
Optimal objective value 3.1301290609
Relative optimality gap inf%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant