Skip to content

Conversation

eminyouskn
Copy link
Contributor

Fixes NA

Summary/Motivation:

This PR introduced a new KNITRO direct solver interface.

Changes proposed in this PR:

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

Copy link

codecov bot commented Sep 18, 2025

Codecov Report

❌ Patch coverage is 92.60238% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.34%. Comparing base (cb52a02) to head (67a9a92).

Files with missing lines Patch % Lines
pyomo/contrib/solver/solvers/knitro/base.py 84.27% 25 Missing ⚠️
pyomo/contrib/solver/solvers/knitro/engine.py 91.92% 23 Missing ⚠️
pyomo/contrib/solver/solvers/knitro/package.py 89.36% 5 Missing ⚠️
pyomo/contrib/solver/solvers/knitro/direct.py 96.87% 1 Missing ⚠️
pyomo/contrib/solver/solvers/knitro/solution.py 96.66% 1 Missing ⚠️
pyomo/contrib/solver/solvers/knitro/utils.py 99.03% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3707      +/-   ##
==========================================
+ Coverage   89.31%   89.34%   +0.02%     
==========================================
  Files         896      906      +10     
  Lines      103687   104444     +757     
==========================================
+ Hits        92609    93314     +705     
- Misses      11078    11130      +52     
Flag Coverage Δ
builders 29.20% <41.87%> (+0.10%) ⬆️
default 85.98% <92.47%> (?)
expensive 35.91% <41.87%> (?)
linux 86.62% <39.91%> (-2.43%) ⬇️
linux_other 86.62% <39.91%> (-0.35%) ⬇️
osx 82.78% <39.91%> (-0.32%) ⬇️
win 84.88% <39.91%> (-0.34%) ⬇️
win_other 84.88% <39.91%> (-0.34%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mrmundt
Copy link
Contributor

mrmundt commented Sep 19, 2025

Hi @eminyouskn - okay, so, the tests are running but a large number of them are failing. Here is part of the stacktrace:

19:55:28 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
19:55:28 pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py:1963: in test_variables_elsewhere
19:55:28     self.assertAlmostEqual(res.incumbent_objective, 1)
19:55:28 E   AssertionError: 1.0000008993019858 != 1 within 7 places (8.993019857683748e-07 difference)
19:55:28 ----------------------------- Captured stdout call -----------------------------
19:55:28 
19:55:28 =======================================
19:55:28 *** NO CHECK MADE FOR LICENSE ***
19:55:28          Artelys Knitro 15.0.0
19:55:28 =======================================
19:55:28 
19:55:28 Knitro using 1 thread.
19:55:28 No start point provided -- Knitro computing one.
19:55:28 
19:55:28 Knitro performing finite-difference gradient computation with 1 thread.
19:55:28 Knitro presolve eliminated 0 variables and 0 constraints.
19:55:28 
19:55:28 concurrent_evals         0
19:55:28 feastol                  1e-06
19:55:28 feastol_abs              0.001
19:55:28 opttol                   1e-06
19:55:28 opttol_abs               0.001
19:55:28 outlev                   6
19:55:28 Knitro changing hessopt to exact (because the problem is an LP).
19:55:28 The problem is identified as an LP.
19:55:28 Knitro changing algorithm from AUTO to 1.
19:55:28 Knitro changing blasoption from AUTO to 1.
19:55:28 Knitro changing bar_initpt from AUTO to 1.
19:55:28 Knitro changing bar_murule from AUTO to 4.
19:55:28 Knitro changing bar_penaltycons from AUTO to 0.
19:55:28 Knitro changing bar_penaltyrule from AUTO to 2.
19:55:28 Knitro changing bar_switchrule from AUTO to 2.
19:55:28 Knitro changing hessopt from AUTO to 1.
19:55:28 Knitro changing initpt_strategy from AUTO to 1.
19:55:28 Knitro changing linesearch from AUTO to 1.
19:55:28 Knitro changing linsolver from AUTO to 2.
19:55:28 
19:55:28 Problem Characteristics                                 (   Presolved)
19:55:28 -----------------------
19:55:28 Objective goal:  Minimize
19:55:28 Objective type:  linear
19:55:28 Number of variables:                                  2 (           2)
19:55:28     bounded below only:                               0 (           0)
19:55:28     bounded above only:                               0 (           0)
19:55:28     bounded below and above:                          0 (           0)
19:55:28     fixed:                                            0 (           0)
19:55:28     free:                                             2 (           2)
19:55:28 Number of constraints:                                2 (           2)
19:55:28     linear equalities:                                0 (           0)
19:55:28     quadratic equalities:                             0 (           0)
19:55:28     gen. nonlinear equalities:                        0 (           0)
19:55:28     linear one-sided inequalities:                    2 (           2)
19:55:28     quadratic one-sided inequalities:                 0 (           0)
19:55:28     gen. nonlinear one-sided inequalities:            0 (           0)
19:55:28     linear two-sided inequalities:                    0 (           0)
19:55:28     quadratic two-sided inequalities:                 0 (           0)
19:55:28     gen. nonlinear two-sided inequalities:            0 (           0)
19:55:28 Number of nonzeros in Jacobian:                       4 (           4)
19:55:28 Number of nonzeros in Hessian:                        0 (           0)
19:55:28 
19:55:28 Knitro using the Interior-Point/Barrier Direct algorithm.
19:55:28 
19:55:28   Iter     fCount     Objective      FeasError   OptError    ||Step||    CGits 
19:55:28 --------  --------  --------------  ----------  ----------  ----------  -------
19:55:28        0         5    1.000000e-08   2.314e+00
19:55:28        1         7    1.000000e-08   2.314e+00   4.975e-01   1.652e+00        0
19:55:28        2         9    1.267867e+00   0.000e+00   1.336e-01   1.827e+00        0
19:55:28        3        11    1.001339e+00   0.000e+00   6.715e-04   2.665e-01        0
19:55:28        4        13    1.000001e+00   0.000e+00   4.509e-07   1.338e-03        0
19:55:28 
19:55:28 EXIT: Optimal solution found.
19:55:28 
19:55:28 Final Statistics
19:55:28 ----------------
19:55:28 Final objective value               =   1.00000089930199e+00
19:55:28 Final feasibility error (abs / rel) =   0.00e+00 / 0.00e+00
19:55:28 Final optimality error  (abs / rel) =   4.51e-07 / 4.51e-07
19:55:28 # of iterations                     =          4 
19:55:28 # of CG iterations                  =          0 
19:55:28 # of function evaluations           =         15
19:55:28 # of gradient evaluations           =          0
19:55:28 # of Hessian evaluations            =          0
19:55:28 Total program time (secs)           =       0.00132 (     0.002 CPU time)
19:55:28 Time spent in evaluations (secs)    =       0.00053
19:55:28 
19:55:28 Constraint Vector 		     Lagrange Multipliers
19:55:28 ----------------- 		     ---------------------
19:55:28 c[       0] =  -9.01802131636e-07,   lambda[       0] =                 0.5
19:55:28 c[       1] =  -8.96801839678e-07,   lambda[       1] =                 0.5
19:55:28 
19:55:28 Solution Vector
19:55:28 ---------------
19:55:28 x[       0] =        1.0000008993,   lambda[       2] =                   0
19:55:28 x[       1] =       -1.0000000025,   lambda[       3] =                   0
19:55:28 
19:55:28 ===============================================================================
19:55:28 
19:55:28 _________________ TestSolvers.test_with_numpy_5_knitro_direct __________________
19:55:28 
19:55:28 a = (<pyomo.contrib.solver.tests.solvers.test_solvers.TestSolvers testMethod=test_with_numpy_5_knitro_direct>,)
19:55:28 kw = {}
19:55:28 
19:55:28     @wraps(func)
19:55:28     def standalone_func(*a, **kw):
19:55:28 >       return func(*(a + p.args), **p.kwargs, **kw)
19:55:28 
19:55:28 python3.10/site-packages/parameterized/parameterized.py:620: 
19:55:28 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
19:55:28 pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py:1576: in test_with_numpy
19:55:28     self.assertAlmostEqual(m.x.value, (b2 - b1) / (a1 - a2))
19:55:28 E   AssertionError: -0.6666663318632648 != -0.6666666666666666 within 7 places (3.3480340178027035e-07 difference)
19:55:28 ----------------------------- Captured stdout call -----------------------------
19:55:28 
19:55:28 =======================================
19:55:28 *** NO CHECK MADE FOR LICENSE ***
19:55:28          Artelys Knitro 15.0.0
19:55:28 =======================================
19:55:28 
19:55:28 Knitro using 1 thread.
19:55:28 No start point provided -- Knitro computing one.
19:55:28 
19:55:28 Knitro performing finite-difference gradient computation with 1 thread.
19:55:28 Knitro presolve eliminated 0 variables and 0 constraints.
19:55:28 
19:55:28 concurrent_evals         0
19:55:28 feastol                  1e-06
19:55:28 feastol_abs              0.001
19:55:28 opttol                   1e-06
19:55:28 opttol_abs               0.001
19:55:28 outlev                   6
19:55:28 Knitro changing hessopt to exact (because the problem is an LP).
19:55:28 The problem is identified as an LP.
19:55:28 Knitro changing algorithm from AUTO to 1.
19:55:28 Knitro changing blasoption from AUTO to 1.
19:55:28 Knitro changing bar_initpt from AUTO to 1.
19:55:28 Knitro changing bar_murule from AUTO to 4.
19:55:28 Knitro changing bar_penaltycons from AUTO to 0.
19:55:28 Knitro changing bar_penaltyrule from AUTO to 2.
19:55:28 Knitro changing bar_switchrule from AUTO to 2.
19:55:28 Knitro changing hessopt from AUTO to 1.
19:55:28 Knitro changing initpt_strategy from AUTO to 1.
19:55:28 Knitro changing linesearch from AUTO to 1.
19:55:28 Knitro changing linsolver from AUTO to 2.
19:55:28 
19:55:28 Problem Characteristics                                 (   Presolved)
19:55:28 -----------------------
19:55:28 Objective goal:  Minimize
19:55:28 Objective type:  linear
19:55:28 Number of variables:                                  2 (           2)
19:55:28     bounded below only:                               0 (           0)
19:55:28     bounded above only:                               0 (           0)
19:55:28     bounded below and above:                          0 (           0)
19:55:28     fixed:                                            0 (           0)
19:55:28     free:                                             2 (           2)
19:55:28 Number of constraints:                                2 (           2)
19:55:28     linear equalities:                                0 (           0)
19:55:28     quadratic equalities:                             0 (           0)
19:55:28     gen. nonlinear equalities:                        0 (           0)
19:55:28     linear one-sided inequalities:                    2 (           2)
19:55:28     quadratic one-sided inequalities:                 0 (           0)
19:55:28     gen. nonlinear one-sided inequalities:            0 (           0)
19:55:28     linear two-sided inequalities:                    0 (           0)
19:55:28     quadratic two-sided inequalities:                 0 (           0)
19:55:28     gen. nonlinear two-sided inequalities:            0 (           0)
19:55:28 Number of nonzeros in Jacobian:                       4 (           4)
19:55:28 Number of nonzeros in Hessian:                        0 (           0)
19:55:28 
19:55:28 Knitro using the Interior-Point/Barrier Direct algorithm.
19:55:28 
19:55:28   Iter     fCount     Objective      FeasError   OptError    ||Step||    CGits 
19:55:28 --------  --------  --------------  ----------  ----------  ----------  -------
19:55:28        0         5    1.000000e-08   3.314e+00
19:55:28        1         7    1.000000e-08   3.314e+00   6.626e-01   2.531e+00        0
19:55:28        2         9    2.552612e+00   0.000e+00   1.372e-01   2.701e+00        0
19:55:28        3        11    2.334430e+00   0.000e+00   6.893e-04   2.386e-01        0
19:55:28        4        13    2.333334e+00   0.000e+00   4.751e-07   1.198e-03        0
19:55:28 
19:55:28 EXIT: Optimal solution found.
19:55:28 
19:55:28 Final Statistics
19:55:28 ----------------
19:55:28 Final objective value               =   2.33333408895725e+00
19:55:28 Final feasibility error (abs / rel) =   0.00e+00 / 0.00e+00
19:55:28 Final optimality error  (abs / rel) =   4.75e-07 / 4.75e-07
19:55:28 # of iterations                     =          4 
19:55:28 # of CG iterations                  =          0 
19:55:28 # of function evaluations           =         15
19:55:28 # of gradient evaluations           =          0
19:55:28 # of Hessian evaluations            =          0
19:55:28 Total program time (secs)           =       0.00127 (     0.001 CPU time)
19:55:28 Time spent in evaluations (secs)    =       0.00047
19:55:28 
19:55:28 Constraint Vector 		     Lagrange Multipliers
19:55:28 ----------------- 		     ---------------------
19:55:28 c[       0] =   4.20820514435e-07,   lambda[       0] =     -0.666666666667
19:55:28 c[       1] =  -1.42523071966e-06,   lambda[       1] =      0.333333333333
19:55:28 
19:55:28 Solution Vector
19:55:28 ---------------
19:55:28 x[       0] =       2.33333408896,   lambda[       2] =                   0
19:55:28 x[       1] =     -0.666666331863,   lambda[       3] =                   0
19:55:28 
19:55:38 =========================== short test summary info ============================
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_add_and_remove_vars_5_knitro_direct - AssertionError: 1.500000828607814 != 1.5 within 7 places (8.286078139185804e-07 difference)
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_add_remove_cons_5_knitro_direct - AssertionError: 1.5000008827313833 != 1.5 within 7 places (8.827313833226214e-07 difference)
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_duals_5_knitro_direct - AssertionError: 1.000000882731383 != 1 within 7 places (8.827313831005767e-07 difference)
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_fixed_vars_2_5_knitro_direct - AssertionError: 1.5000008827313833 != 1.5 within 7 places (8.827313833226214e-07 difference)
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_fixed_vars_4_2_knitro_direct - AssertionError: 1.4142134816662406 != 1.4142135623730951 within 7 places (8.070685453276383e-08 difference)
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_fixed_vars_5_knitro_direct - AssertionError: 1.5000008827313833 != 1.5 within 7 places (8.827313833226214e-07 difference)
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_immutable_param_5_knitro_direct - AssertionError: 1.5000008827313833 != 1.5 within 7 places (8.827313833226214e-07 difference)
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_no_objective_5_knitro_direct - AssertionError: 0.0 != None
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_objective_changes_5_knitro_direct - AssertionError: 1.0000008827313833 != 1 within 7 places (8.827313833226214e-07 difference)
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_param_changes_5_knitro_direct - AssertionError: 1.5000008827313833 != 1.5 within 7 places (8.827313833226214e-07 difference)
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_results_infeasible_5_knitro_direct - AssertionError: <TerminationCondition.unknown: 42> not found in {<TerminationCondition.infeasibleOrUnbounded: 8>, <TerminationCondition.provenInfeasible: 6>}
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_scaling_5_knitro_direct - AssertionError: 1.000000882731383 != 1 within 7 places (8.827313831005767e-07 difference)
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_stale_vars_5_knitro_direct - AssertionError: False is not true
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_variables_elsewhere2_5_knitro_direct - AssertionError: 8.993019857525455e-07 != 0 within 7 places (8.993019857525455e-07 difference)
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_variables_elsewhere_5_knitro_direct - AssertionError: 1.0000008993019858 != 1 within 7 places (8.993019857683748e-07 difference)
19:55:38 FAILED pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py::TestSolvers::test_with_numpy_5_knitro_direct - AssertionError: -0.6666663318632648 != -0.6666666666666666 within 7 places (3.3480340178027035e-07 difference)

Most of the failures are just tolerance problems / the tolerance needs to be loosened.

@mrmundt
Copy link
Contributor

mrmundt commented Sep 19, 2025

One-off failures:

pyomo.contrib.solver.tests.solvers.test_solvers.TestSolvers.test_no_objective_5_knitro_direct (from pytest)

Error Message

AssertionError: 0.0 != None

Stacktrace

a = (<pyomo.contrib.solver.tests.solvers.test_solvers.TestSolvers testMethod=test_no_objective_5_knitro_direct>,)
kw = {}

    @wraps(func)
    def standalone_func(*a, **kw):
>       return func(*(a + p.args), **p.kwargs, **kw)

/python3.12/site-packages/parameterized/parameterized.py:620: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py:930: in test_no_objective
    self.assertEqual(res.incumbent_objective, None)
E   AssertionError: 0.0 != None

Second one-off:

pyomo.contrib.solver.tests.solvers.test_solvers.TestSolvers.test_stale_vars_5_knitro_direct (from pytest)

Error Message

AssertionError: False is not true

Stacktrace

a = (<pyomo.contrib.solver.tests.solvers.test_solvers.TestSolvers testMethod=test_stale_vars_5_knitro_direct>,)
kw = {}

    @wraps(func)
    def standalone_func(*a, **kw):
>       return func(*(a + p.args), **p.kwargs, **kw)
/python3.12/site-packages/parameterized/parameterized.py:620: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyomo/pyomo/contrib/solver/tests/solvers/test_solvers.py:618: in test_stale_vars
    self.assertTrue(m.x.stale)
E   AssertionError: False is not true

@eminyouskn
Copy link
Contributor Author

Thanks @mrmundt for the report. I didn’t run these tests locally since I didn’t have NumPy installed, and in that case, the tests are skipped. I’ll make sure to check them before pushing code from now on.

I do have a question: is there a way to adjust the tolerance for all these tests at once? Ideally, we’d only change it for Knitro, but I imagine that might be more complicated.

Regarding the two remaining failures, I’ve already fixed the one related to the objective. However, I’m not sure how to address the stale one, it’s not clear to me what exactly that test is supposed to check.

Copy link
Contributor

@mrmundt mrmundt left a comment

Choose a reason for hiding this comment

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

Thanks, @eminyouskn , for this! I have a lot of comments to start us off. Happy to hear pushback!

@eminyouskn
Copy link
Contributor Author

@mrmundt Thanks for your comments. I’ve addressed the majority of them. For two of your comments, I left my original implementation and added my reasoning. If you feel my explanations are not convincing, I’m open to adjusting the code accordingly.

Copy link
Contributor

@mrmundt mrmundt left a comment

Choose a reason for hiding this comment

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

I swear, I am almost done leaving comments. This is looking great. I found one uncaught typo and have a couple of suggestions. Also, I noticed that you don't use a logger anywhere. Not saying you have to, but you might consider doing so for any helpful messages / debugging for users' benefit?

@eminyouskn
Copy link
Contributor Author

Thanks @mrmundt for the quick and thorough review. As you mentioned, I didn’t use the logger, everything requiring user attention is either handled directly or raised an error, in which case the higher-level code is responsible for communicating it to the user.

@eminyouskn
Copy link
Contributor Author

However, your point about debugging is valid. I need to consider whether there are parts that should be logged specifically for debugging purposes.

@eminyouskn
Copy link
Contributor Author

@mrmundt One of the two failing tests doesn’t seem related to Knitro. For the other one, could you share the output so I can work on fixing it?

@mrmundt
Copy link
Contributor

mrmundt commented Sep 25, 2025

@mrmundt One of the two failing tests doesn’t seem related to Knitro. For the other one, could you share the output so I can work on fixing it?

Yup, this one should be an easy fix:

15:06:10 =================================== FAILURES ===================================
15:06:10 ____________________ TestPyomoEnviron.test_tpl_import_time _____________________
15:06:10 
15:06:10 self = <pyomo.environ.tests.test_environ.TestPyomoEnviron testMethod=test_tpl_import_time>
15:06:10 
15:06:10     @unittest.skipIf(
15:06:10         'pypy_version_info' in dir(sys), "PyPy does not support '-X importtime"
15:06:10     )
15:06:10     def test_tpl_import_time(self):
15:06:10         data = collect_import_time('pyomo.environ')
15:06:10         pyomo_time = sum(data.pyomo.values())
15:06:10         tpl_time = sum(data.tpl.values())
15:06:10         total = float(pyomo_time + tpl_time)
15:06:10         print("Pyomo (by module time):")
15:06:10         print(
15:06:10             "\n".join(
15:06:10                 "   %s: %s" % i for i in sorted(data.pyomo.items(), key=lambda x: x[1])
15:06:10             )
15:06:10         )
15:06:10         print("TPLS:")
15:06:10         _line_fmt = "   %%%ds: %%6d %%s" % (
15:06:10             max(len(k[: k.find(' ')]) for k in data.tpl),
15:06:10         )
15:06:10         print(
15:06:10             "\n".join(
15:06:10                 _line_fmt % (k[: k.find(' ')], v, k[k.find(' ') :])
15:06:10                 for k, v in sorted(data.tpl.items())
15:06:10             )
15:06:10         )
15:06:10         tpl = {}
15:06:10         for k, v in data.tpl.items():
15:06:10             _mod = k[: k.find(' ')].split('.')[0]
15:06:10             tpl[_mod] = tpl.get(_mod, 0) + v
15:06:10         tpl_by_time = sorted(tpl.items(), key=lambda x: x[1])
15:06:10         print("TPLS (by package time):")
15:06:10         print(
15:06:10             "\n".join(
15:06:10                 "   %12s: %6d (%4.1f%%)" % (m, t, 100 * t / total)
15:06:10                 for m, t in tpl_by_time
15:06:10             )
15:06:10         )
15:06:10         print("Pyomo:    %6d (%4.1f%%)" % (pyomo_time, 100 * pyomo_time / total))
15:06:10         print("TPL:      %6d (%4.1f%%)" % (tpl_time, 100 * tpl_time / total))
15:06:10         # Arbitrarily choose a threshold 10% more than the expected
15:06:10         # value (at time of writing, TPL imports were 52-57% of the
15:06:10         # import time on a development machine)
15:06:10         self.assertLess(tpl_time / total, 0.65)
15:06:10         # Spot-check the (known) worst offenders.  The following are
15:06:10         # modules from the "standard" library.  Their order in the list
15:06:10         # of slow-loading TPLs can vary from platform to platform.
15:06:10         ref = {
15:06:10             '__future__',
15:06:10             'argparse',
15:06:10             'ast',  # Imported on Windows
15:06:10             'backports_abc',  # Imported by cython on Linux
15:06:10             'base64',  # Imported on Windows
15:06:10             'bisect',  # Imported by dae, dataportal, contrib/mpc
15:06:10             'cPickle',
15:06:10             'csv',
15:06:10             'ctypes',  # mandatory import in core/base/external.py; TODO: fix this
15:06:10             'datetime',  # imported by contrib.solver
15:06:10             'decimal',
15:06:10             'gc',  # Imported on MacOS, Windows; Linux in 3.10
15:06:10             'glob',
15:06:10             'heapq',  # Added in Python 3.10
15:06:10             'importlib',
15:06:10             'inspect',
15:06:10             'json',  # Imported on Windows
15:06:10             'locale',  # Added in Python 3.9
15:06:10             'logging',
15:06:10             'pickle',
15:06:10             'platform',
15:06:10             'shlex',
15:06:10             'socket',  # Imported on MacOS, Windows; Linux in 3.10
15:06:10             'subprocess',
15:06:10             'tempfile',  # Imported on MacOS, Windows
15:06:10             'textwrap',
15:06:10             'typing',
15:06:10             'win32file',  # Imported on Windows
15:06:10             'win32pipe',  # Imported on Windows
15:06:10         }
15:06:10         # Non-standard-library TPLs that Pyomo will load unconditionally
15:06:10         ref.add('ply')
15:06:10         diff = set(_[0] for _ in tpl_by_time[-5:]).difference(ref)
15:06:10 >       self.assertEqual(
15:06:10             diff, set(), "Unexpected module found in 5 slowest-loading TPL modules"
15:06:10         )
15:06:10 E       AssertionError: Items in the first set but not the second:
15:06:10 E       'knitro' : Unexpected module found in 5 slowest-loading TPL modules
15:06:10 
15:06:10 /host/tester/python/python311/pyomo/pyomo/environ/tests/test_environ.py:168: AssertionError
15:06:10 ----------------------------- Captured stdout call -----------------------------
15:06:10 Pyomo (by module time):
15:06:10    pyomo.core.expr.numvalue: 26
15:06:10    pyomo.core.base.var: 27
15:06:10    pyomo.contrib.appsi.utils.get_objective: 27
15:06:10    pyomo.opt.base: 28
15:06:10    pyomo.dataportal.DataPortal: 30
15:06:10    pyomo.version.info: 36
15:06:10    pyomo.contrib.example.bar: 573
15:06:10    pyomo.contrib.example.plugins: 597
15:06:10    pyomo.common.extensions: 602
15:06:10    pyomo.opt.base.opt_config: 606
15:06:10    pyomo.contrib.mcpp.getMCPP: 615
15:06:10    pyomo.contrib.cspline_external.build: 620
15:06:10    pyomo.contrib.solver.common: 624
15:06:10    pyomo.gdp: 625
15:06:10    pyomo.contrib.mcpp: 627
15:06:10    pyomo.solvers.amplfunc_merge: 629
15:06:10    pyomo.util.components: 630
15:06:10    pyomo.contrib.pynumero.algorithms: 633
15:06:10    pyomo.contrib.fme: 634
15:06:10    pyomo.opt.base.convert: 635
15:06:10    pyomo.contrib.ampl_function_demo.build: 635
15:06:10    pyomo.contrib.cp.scheduling_expr: 636
15:06:10    pyomo.mpec.plugins.solver2: 638
15:06:10    pyomo.opt.solver: 641
15:06:10    pyomo.solvers.plugins.converter.pico: 643
15:06:10    pyomo.core.expr.expr_errors: 644
15:06:10    pyomo.contrib: 644
15:06:10    pyomo.network.util: 644
15:06:10    pyomo.mpec.plugins.pathampl: 644
15:06:10    pyomo.contrib.appsi.writers.config: 646
15:06:10    pyomo.common.modeling: 647
15:06:10    pyomo.contrib.multistart.high_conf_stop: 647
15:06:10    pyomo.core.base.symbol_map: 648
15:06:10    pyomo.contrib.gdpopt.cut_generation: 648
15:06:10    pyomo.contrib.gjh.getGJH: 649
15:06:10    pyomo.contrib.community_detection.event_log: 651
15:06:10    pyomo.contrib.multistart.reinit: 652
15:06:10    pyomo.mpec.plugins.mpec3: 653
15:06:10    pyomo.contrib.appsi.cmodel: 653
15:06:10    pyomo.common.cmake_builder: 656
15:06:10    pyomo.contrib.gdp_bounds.info: 656
15:06:10    pyomo.contrib.satsolver: 657
15:06:10    pyomo.core.expr.calculus.diff_with_sympy: 658
15:06:10    pyomo.repn: 658
15:06:10    pyomo.contrib.trustregion.filter: 660
15:06:10    pyomo.contrib.gdpopt.solve_discrete_problem: 661
15:06:10    pyomo.common._command: 662
15:06:10    pyomo.core.base.disable_methods: 664
15:06:10    pyomo.opt.parallel: 665
15:06:10    pyomo.solvers.mockmip: 666
15:06:10    pyomo.solvers.plugins.solvers.pywrapper: 666
15:06:10    pyomo.mpec.plugins.solver1: 667
15:06:10    pyomo.contrib.cp: 668
15:06:10    pyomo.network: 670
15:06:10    pyomo.contrib.community_detection.community_graph: 671
15:06:10    pyomo.contrib.mcpp.build: 671
15:06:10    pyomo.contrib.appsi.utils.collect_vars_and_named_exprs: 672
15:06:10    pyomo.contrib.appsi.utils: 673
15:06:10    pyomo.repn.standard_aux: 676
15:06:10    pyomo.solvers.plugins.solvers.XPRESS: 676
15:06:10    pyomo.opt.base.problem: 678
15:06:10    pyomo.mpec.plugins.mpec4: 680
15:06:10    pyomo.core.base.set_types: 681
15:06:10    pyomo.core.kernel.container_utils: 683
15:06:10    pyomo.solvers.plugins.converter.glpsol: 685
15:06:10    pyomo.contrib.appsi.build: 687
15:06:10    pyomo.opt.problem: 688
15:06:10    pyomo.contrib.cp.repn: 692
15:06:10    pyomo.mpec.plugins.mpec2: 692
15:06:10    pyomo.contrib.gdpopt.nlp_initialization: 692
15:06:10    pyomo.core.plugins.transform.util: 694
15:06:10    pyomo.common.flags: 697
15:06:10    pyomo.opt.solver.ilmcmd: 697
15:06:10    pyomo.core.expr.taylor_series: 699
15:06:10    pyomo.contrib.gdpopt.oa_algorithm_utils: 699
15:06:10    pyomo.common.sorting: 701
15:06:10    pyomo.common.pyomo_typing: 701
15:06:10    pyomo.dataportal.plugins.text: 701
15:06:10    pyomo.common.collections._hasher: 703
15:06:10    pyomo.opt.base.results: 703
15:06:10    pyomo.common.multithread: 704
15:06:10    pyomo.scripting.solve_config: 709
15:06:10    pyomo.opt.results: 710
15:06:10    pyomo.core.expr.calculus: 712
15:06:10    pyomo.dataportal.factory: 712
15:06:10    pyomo.core.kernel.heterogeneous_container: 714
15:06:10    pyomo.dataportal.plugins.xml_table: 715
15:06:10    pyomo.core.util: 716
15:06:10    pyomo.contrib.preprocessing.plugins.zero_sum_propagator: 717
15:06:10    pyomo.solvers.plugins.converter.model: 719
15:06:10    pyomo.contrib.preprocessing.util: 719
15:06:10    pyomo.common.shutdown: 723
15:06:10    pyomo.core.base.misc: 723
15:06:10    pyomo.contrib.cp.transform: 727
15:06:10    pyomo.core.kernel.homogeneous_container: 728
15:06:10    pyomo.common.factory: 729
15:06:10    pyomo.gdp.plugins.between_steps: 730
15:06:10    pyomo.version: 731
15:06:10    pyomo.common.envvar: 731
15:06:10    pyomo.core.kernel.set_types: 734
15:06:10    pyomo.contrib.gdp_bounds.compute_bounds: 734
15:06:10    pyomo.util: 735
15:06:10    pyomo.core.expr.symbol_map: 736
15:06:10    pyomo.solvers.plugins.solvers.CONOPT: 736
15:06:10    pyomo.opt.parallel.local: 739
15:06:10    pyomo.core.pyomoobject: 740
15:06:10    pyomo.contrib.gdpopt.config_options: 740
15:06:10    pyomo.contrib.solver.solvers: 741
15:06:10    pyomo.scripting.pyomo_parser: 746
15:06:10    pyomo.opt.plugins.sol: 749
15:06:10    pyomo.gdp.plugins.gdp_var_mover: 750
15:06:10    pyomo.contrib.preprocessing.plugins.init_vars: 750
15:06:10    pyomo.solvers.plugins.solvers.cplex_persistent: 751
15:06:10    pyomo.contrib.gdpopt.solve_subproblem: 753
15:06:10    pyomo.core.plugins.transform.hierarchy: 754
15:06:10    pyomo.contrib.fbbt.interval: 754
15:06:10    pyomo.util.model_size: 756
15:06:10    pyomo.common.collections: 757
15:06:10    pyomo.contrib.gdpopt.create_oa_subproblems: 758
15:06:10    pyomo.core.kernel.piecewise_library: 759
15:06:10    pyomo.dataportal.plugins.datacommands: 759
15:06:10    pyomo.core.staleflag: 762
15:06:10    pyomo.neos.plugins.kestrel_plugin: 763
15:06:10    pyomo.common.gc_manager: 765
15:06:10    pyomo.repn.plugins.ampl: 765
15:06:10    pyomo.gdp.plugins.bigm_mixin: 765
15:06:10    pyomo.contrib.mindtpy.config_options: 768
15:06:10    pyomo.contrib.trustregion.util: 768
15:06:10    pyomo.contrib.aslfunctions.build: 772
15:06:10    pyomo.opt: 773
15:06:10    pyomo.dataportal.plugins.sheet: 773
15:06:10    pyomo.contrib.gdpopt.discrete_problem_initialize: 773
15:06:10    pyomo.solvers.plugins.solvers.SCIPAMPL: 775
15:06:10    pyomo.gdp.plugins.bilinear: 775
15:06:10    pyomo.dae.misc: 775
15:06:10    pyomo.contrib.gjh.GJH: 775
15:06:10    pyomo.common.collections.orderedset: 776
15:06:10    pyomo.contrib.example.foo: 776
15:06:10    pyomo.solvers.plugins.solvers.direct_or_persistent_solver: 777
15:06:10    pyomo.core.base.instance2dat: 778
15:06:10    pyomo.solvers.plugins.solvers.KNITROAMPL: 779
15:06:10    pyomo.contrib.appsi.writers.lp_writer: 779
15:06:10    pyomo.contrib.preprocessing.plugins.remove_zero_terms: 780
15:06:10    pyomo.solvers.plugins.solvers.xpress_persistent: 789
15:06:10    pyomo.solvers.plugins.solvers.direct_solver: 791
15:06:10    pyomo.contrib.pynumero.build: 791
15:06:10    pyomo.core.kernel.list_container: 793
15:06:10    pyomo.core.plugins.transform.add_slack_vars: 797
15:06:10    pyomo.core.expr.cnf_walker: 798
15:06:10    pyomo.opt.plugins.res: 798
15:06:10    pyomo.contrib.cp.transform.logical_to_disjunctive_walker: 800
15:06:10    pyomo.contrib.pynumero.algorithms.solvers.square_solver_base: 803
15:06:10    pyomo.core.kernel.tuple_container: 805
15:06:10    pyomo.contrib.preprocessing.plugins.var_aggregator: 807
15:06:10    pyomo.repn.plugins.mps: 810
15:06:10    pyomo.opt.base.error: 811
15:06:10    pyomo.contrib.mindtpy.cut_generation: 812
15:06:10    pyomo.solvers.plugins.solvers.BARON: 813
15:06:10    pyomo.core.plugins.transform.expand_connectors: 814
15:06:10    pyomo.solvers.plugins.solvers.persistent_solver: 814
15:06:10    pyomo.dae.diffvar: 821
15:06:10    pyomo.contrib.simplification.build: 822
15:06:10    pyomo.core.base.check: 824
15:06:10    pyomo.core.plugins.transform.radix_linearization: 824
15:06:10    pyomo.util.subsystems: 826
15:06:10    pyomo.contrib.fbbt: 829
15:06:10    pyomo.contrib.appsi.solvers: 829
15:06:10    pyomo.gdp.plugins.binary_multiplication: 831
15:06:10    pyomo.common.collections.component_set: 833
15:06:10    pyomo.core.expr.calculus.diff_with_pyomo: 834
15:06:10    pyomo.contrib.solver.common.solution_loader: 837
15:06:10    pyomo.contrib.appsi.writers: 838
15:06:10    pyomo.dataportal.TableData: 840
15:06:10    pyomo.solvers.plugins.converter: 840
15:06:10    pyomo.opt.problem.ampl: 842
15:06:10    pyomo.dataportal.plugins.json_dict: 844
15:06:10    pyomo.contrib.pynumero.algorithms.solvers: 844
15:06:10    pyomo.dataportal: 846
15:06:10    pyomo.solvers.plugins.solvers.ASL: 846
15:06:10    pyomo.solvers.plugins.solvers.gurobi_persistent: 846
15:06:10    pyomo.contrib.simplification.ginac: 846
15:06:10    pyomo.contrib.solver.solvers.knitro.config: 849
15:06:10    pyomo.core.base.action: 850
15:06:10    pyomo.dae.plugins.finitedifference: 852
15:06:10    pyomo.contrib.preprocessing.plugins.constraint_tightener: 852
15:06:10    pyomo.contrib.preprocessing.plugins.int_to_binary: 854
15:06:10    pyomo.common.numeric_types: 859
15:06:10    pyomo.core.plugins.transform.nonnegative_transform: 859
15:06:10    pyomo.contrib.trustregion.interface: 859
15:06:10    pyomo.core.expr.sympy_tools: 860
15:06:10    pyomo.duality.collect: 860
15:06:10    pyomo.solvers.plugins.converter.ampl: 860
15:06:10    pyomo.contrib.community_detection.detection: 861
15:06:10    pyomo.gdp.transformed_disjunct: 868
15:06:10    pyomo.core.expr.base: 870
15:06:10    pyomo.solvers.plugins.solvers.mosek_persistent: 874
15:06:10    pyomo.gdp.util: 874
15:06:10    pyomo.util.vars_from_expressions: 879
15:06:10    pyomo.neos.plugins.NEOS: 884
15:06:10    pyomo.solvers.plugins.solvers.IPOPT: 887
15:06:10    pyomo.scripting.interface: 888
15:06:10    pyomo.solvers.plugins.solvers.GLPK: 888
15:06:10    pyomo.contrib.solver.solvers.knitro.package: 891
15:06:10    pyomo.dataportal.plugins.csv_table: 894
15:06:10    pyomo.solvers.plugins.solvers: 896
15:06:10    pyomo.common.collections.bunch: 900
15:06:10    pyomo.opt.results.results_: 901
15:06:10    pyomo.core.base.global_set: 903
15:06:10    pyomo.contrib.cp.scheduling_expr.precedence_expressions: 903
15:06:10    pyomo.common.errors: 911
15:06:10    pyomo.contrib.solver.solvers.sol_reader: 912
15:06:10    pyomo.contrib.solver.common.util: 917
15:06:10    pyomo.core.base.config: 922
15:06:10    pyomo.gdp.plugins.bound_pretransformation: 925
15:06:10    pyomo.opt.parallel.async_solver: 927
15:06:10    pyomo.mpec.plugins.mpec1: 927
15:06:10    pyomo.core.kernel.dict_container: 928
15:06:10    pyomo.contrib.pynumero.intrinsic: 931
15:06:10    pyomo.core.plugins.transform.relax_integrality: 937
15:06:10    pyomo.contrib.fbbt.expression_bounds_walker: 941
15:06:10    pyomo.contrib.solver.solvers.knitro.utils: 941
15:06:10    pyomo.scripting: 942
15:06:10    pyomo.network.plugins.expand_arcs: 944
15:06:10    pyomo.common.autoslots: 948
15:06:10    pyomo.core.base.indexed_component_slice: 950
15:06:10    pyomo.core.kernel.piecewise_library.util: 950
15:06:10    pyomo.contrib.solver.common.factory: 951
15:06:10    pyomo.network.foqus_graph: 953
15:06:10    pyomo.opt.solver.shellcmd: 956
15:06:10    pyomo.contrib.solver.solvers.knitro.solution: 958
15:06:10    pyomo.repn.quadratic: 960
15:06:10    pyomo.core.expr.boolean_value: 961
15:06:10    pyomo.common.download: 971
15:06:10    pyomo.repn.plugins.baron_writer: 980
15:06:10    pyomo.core.plugins.transform: 981
15:06:10    pyomo.core.plugins.transform.scaling: 983
15:06:10    pyomo.gdp.plugins.transform_current_disjunctive_state: 984
15:06:10    pyomo.contrib.solver.solvers.knitro.callback: 985
15:06:10    pyomo.contrib.gdpopt.algorithm_base_class: 987
15:06:10    pyomo.core.base.transformation: 989
15:06:10    pyomo.contrib.appsi.solvers.cbc: 989
15:06:10    pyomo.common.collections.component_map: 996
15:06:10    pyomo.core.kernel.piecewise_library.transforms_nd: 998
15:06:10    pyomo.core.kernel: 998
15:06:10    pyomo.util.config_domains: 998
15:06:10    pyomo.contrib.appsi.fbbt: 1006
15:06:10    pyomo.opt.parallel.manager: 1010
15:06:10    pyomo.contrib.gdpopt.util: 1014
15:06:10    pyomo.contrib.preprocessing.plugins.bounds_to_vars: 1018
15:06:10    pyomo.network.decomposition: 1022
15:06:10    pyomo.core.base: 1024
15:06:10    pyomo.repn.linear_template: 1024
15:06:10    pyomo.common: 1027
15:06:10    pyomo.core.base.range: 1027
15:06:10    pyomo.core.expr: 1032
15:06:10    pyomo.contrib.satsolver.satsolver: 1033
15:06:10    pyomo.scripting.plugins.build_ext: 1037
15:06:10    pyomo.core.base.util: 1040
15:06:10    pyomo.opt.results.problem: 1045
15:06:10    pyomo.contrib.preprocessing.plugins.strip_bounds: 1045
15:06:10    pyomo.gdp.plugins.gdp_to_mip_transformation: 1047
15:06:10    pyomo.contrib.cp.scheduling_expr.sequence_expressions: 1048
15:06:10    pyomo.contrib.appsi.writers.nl_writer: 1055
15:06:10    pyomo.contrib.mcpp.pyomo_mcpp: 1058
15:06:10    pyomo.dae.simulator: 1068
15:06:10    pyomo.solvers.plugins.solvers.GUROBI: 1075
15:06:10    pyomo.contrib.cp.transform.logical_to_disjunctive_program: 1075
15:06:10    pyomo.common.timing: 1078
15:06:10    pyomo.solvers.plugins.solvers.cplex_direct: 1086
15:06:10    pyomo.contrib.appsi.solvers.ipopt: 1087
15:06:10    pyomo.common.fileutils: 1098
15:06:10    pyomo.opt.base.solvers: 1098
15:06:10    pyomo.dataportal.plugins.db_table: 1098
15:06:10    pyomo.contrib.cp.scheduling_expr.scheduling_logic: 1099
15:06:10    pyomo.dataportal.parse_datacmds: 1102
15:06:10    pyomo.repn.linear: 1109
15:06:10    pyomo.contrib.solver.common.persistent: 1110
15:06:10    pyomo.dae.contset: 1112
15:06:10    pyomo.contrib.appsi.solvers.wntr: 1124
15:06:10    pyomo.core.plugins.transform.logical_to_linear: 1125
15:06:14    pyomo.contrib.preprocessing.plugins.detect_fixed_vars: 1125
15:06:14    pyomo.solvers.plugins.solvers.xpress_direct: 1133
15:06:14    pyomo.core.expr.calculus.derivatives: 1136
15:06:14    pyomo.core.kernel.base: 1139
15:06:14    pyomo.neos.kestrel: 1142
15:06:14    pyomo.opt.base.formats: 1152
15:06:14    pyomo.dae.plugins.colloc: 1158
15:06:16    pyomo.contrib.appsi.solvers.cplex: 1161
15:06:16    pyomo.scripting.plugins.download: 1172
15:06:16    pyomo.scripting.plugins.extras: 1181
15:06:16    pyomo.core.plugins.transform.discrete_vars: 1189
15:06:16    pyomo.contrib.simplification.simplify: 1191
15:06:16    pyomo.contrib.preprocessing.plugins.induced_linearity: 1193
15:06:16    pyomo.solvers.plugins.solvers.SAS: 1218
15:06:16    pyomo.common.tee: 1224
15:06:16    pyomo.core.kernel.matrix_constraint: 1229
15:06:16    pyomo.solvers.plugins.solvers.GAMS: 1230
15:06:16    pyomo.solvers.plugins.solvers.mosek_direct: 1232
15:06:16    pyomo.contrib.mindtpy.util: 1232
15:06:16    pyomo.solvers.plugins.solvers.gurobi_direct: 1233
15:06:16    pyomo.contrib.gdpopt.GDPopt: 1237
15:06:16    pyomo.core.kernel.objective: 1240
15:06:16    pyomo.repn.ampl: 1250
15:06:16    pyomo.contrib.preprocessing.plugins.equality_propagate: 1254
15:06:16    pyomo.contrib.appsi.solvers.highs: 1258
15:06:16    pyomo.contrib.cp.sequence_var: 1262
15:06:16    pyomo.repn.standard_repn: 1263
15:06:16    pyomo.scripting.pyomo_command: 1267
15:06:16    pyomo.repn.plugins.gams_writer: 1284
15:06:16    pyomo.core.kernel.suffix: 1286
15:06:16    pyomo.opt.results.solution: 1289
15:06:16    pyomo.contrib.fbbt.fbbt: 1296
15:06:16    pyomo.common.plugin_base: 1298
15:06:16    pyomo.repn.parameterized: 1302
15:06:16    pyomo.gdp.plugins.bigm: 1302
15:06:16    pyomo.gdp.plugins.fix_disjuncts: 1307
15:06:16    pyomo.scripting.plugins.solve: 1310
15:06:16    pyomo.contrib.fme.fourier_motzkin_elimination: 1322
15:06:16    pyomo.common.tempfiles: 1334
15:06:16    pyomo.contrib.pynumero.algorithms.solvers.cyipopt_solver: 1337
15:06:16    pyomo.core.kernel.sos: 1339
15:06:16    pyomo.core.kernel.block: 1349
15:06:16    pyomo.dae.integral: 1354
15:06:16    pyomo.dataportal.process_data: 1363
15:06:16    pyomo.scripting.plugins.convert: 1378
15:06:16    pyomo.gdp.plugins.hull: 1382
15:06:16    pyomo.contrib.solver.solvers.gurobi_direct: 1383
15:06:16    pyomo.core.base.indexed_component: 1387
15:06:16    pyomo.core.base.units_container: 1390
15:06:16    pyomo.core.kernel.parameter: 1402
15:06:16    pyomo.core.kernel.variable: 1414
15:06:16    pyomo.contrib.cp.scheduling_expr.step_function_expressions: 1421
15:06:16    pyomo.core.base.component_namer: 1424
15:06:16    pyomo.solvers.plugins.solvers.CBCplugin: 1426
15:06:16    pyomo.opt.results.container: 1436
15:06:16    pyomo.core.plugins.transform.lp_dual: 1466
15:06:16    pyomo.repn.plugins.ampl.ampl_: 1472
15:06:16    pyomo: 1480
15:06:16    pyomo.gdp.plugins.cuttingplane: 1481
15:06:16    pyomo.contrib.mindtpy.feasibility_pump: 1501
15:06:16    pyomo.contrib.pynumero.algorithms.solvers.scipy_solvers: 1519
15:06:16    pyomo.contrib.appsi.solvers.maingo: 1523
15:06:16    pyomo.contrib.mindtpy.extended_cutting_plane: 1528
15:06:16    pyomo.contrib.solver.common.results: 1543
15:06:16    pyomo.core.kernel.expression: 1555
15:06:16    pyomo.contrib.solver.solvers.knitro: 1557
15:06:16    pyomo.core.base.initializer: 1571
15:06:16    pyomo.contrib.mindtpy.global_outer_approximation: 1571
15:06:16    pyomo.network.port: 1574
15:06:16    pyomo.contrib.mindtpy.algorithm_base_class: 1581
15:06:16    pyomo.contrib.solver.solvers.knitro.engine: 1582
15:06:16    pyomo.common.deprecation: 1589
15:06:16    pyomo.common.log: 1596
15:06:16    pyomo.scripting.util: 1598
15:06:16    pyomo.core.kernel.constraint: 1604
15:06:16    pyomo.opt.results.solver: 1632
15:06:16    pyomo.contrib.preprocessing.plugins.deactivate_trivial_constraints: 1632
15:06:16    pyomo.core.base.componentuid: 1647
15:06:16    pyomo.repn.util: 1659
15:06:16    pyomo.core.kernel.piecewise_library.transforms: 1672
15:06:16    pyomo.contrib.solver.solvers.knitro.typing: 1695
15:06:16    pyomo.network.arc: 1696
15:06:16    pyomo.core.base.enums: 1697
15:06:16    pyomo.common.enums: 1700
15:06:16    pyomo.core.kernel.conic: 1727
15:06:16    pyomo.core.base.connector: 1738
15:06:16    pyomo.contrib.appsi.solvers.gurobi: 1739
15:06:16    pyomo.core.base.boolean_var: 1792
15:06:16    pyomo.contrib.solver.solvers.highs: 1809
15:06:16    pyomo.core.expr.expr_common: 1811
15:06:16    pyomo.core.expr.visitor: 1816
15:06:16    pyomo.contrib.mindtpy.outer_approximation: 1821
15:06:16    pyomo.core.base.reference: 1831
15:06:16    pyomo.contrib.example.plugins.ex_plugin: 1902
15:06:16    pyomo.core.base.label: 1905
15:06:16    pyomo.core.base.external: 1915
15:06:16    pyomo.core.base.PyomoModel: 1920
15:06:16    pyomo.contrib.cp.interval_var: 2048
15:06:16    pyomo.common.dependencies: 2054
15:06:16    pyomo.contrib.solver.common.base: 2062
15:06:16    pyomo.core.expr.logical_expr: 2064
15:06:16    pyomo.contrib.solver.solvers.knitro.base: 2079
15:06:16    pyomo.contrib.multistart.multi: 2139
15:06:16    pyomo.core.base.param: 2141
15:06:16    pyomo.contrib.solver.solvers.knitro.direct: 2182
15:06:16    pyomo.repn.plugins.cpxlp: 2212
15:06:16    pyomo.solvers.plugins.solvers.CPLEX: 2299
15:06:16    pyomo.core.base.piecewise: 2368
15:06:16    pyomo.core.expr.relational_expr: 2385
15:06:16    pyomo.repn.plugins.standard_form: 2392
15:06:16    pyomo.contrib.solver.solvers.gurobi_persistent: 2461
15:06:16    pyomo.core.base.sos: 2581
15:06:16    pyomo.core.base.component: 2616
15:06:16    pyomo.core.base.logical_constraint: 2639
15:06:16    pyomo.contrib.solver.solvers.knitro.api: 2645
15:06:16    pyomo.repn.plugins.lp_writer: 2695
15:06:16    pyomo.repn.plugins.parameterized_standard_form: 2695
15:06:16    pyomo.core.base.expression: 2785
15:06:16    pyomo.contrib.trustregion.TRF: 2840
15:06:16    pyomo.mpec.complementarity: 2880
15:06:16    pyomo.core.expr.template_expr: 2954
15:06:16    pyomo.contrib.cp.repn.docplex_writer: 2984
15:06:16    pyomo.core.base.block: 3164
15:06:16    pyomo.core.base.suffix: 3229
15:06:16    pyomo.contrib.appsi.base: 3289
15:06:16    pyomo.core.base.objective: 3497
15:06:16    pyomo.opt.plugins.driver: 3548
15:06:16    pyomo.common.config: 3602
15:06:16    pyomo.gdp.disjunct: 3620
15:06:16    pyomo.gdp.plugins.partition_disjuncts: 3677
15:06:16    pyomo.core.base.constraint: 4094
15:06:16    pyomo.common.formatting: 4180
15:06:16    pyomo.contrib.solver.solvers.ipopt: 4482
15:06:16    pyomo.contrib.gdpopt.enumerate: 4804
15:06:16    pyomo.repn.plugins.nl_writer: 4828
15:06:16    pyomo.core.expr.numeric_expr: 5112
15:06:16    pyomo.contrib.gdpopt.branch_and_bound: 5284
15:06:16    pyomo.contrib.gdpopt.ldsda: 5746
15:06:16    pyomo.contrib.gdpopt.ric: 6240
15:06:16    pyomo.contrib.mindtpy.MindtPy: 6368
15:06:16    pyomo.contrib.gdpopt.gloa: 6493
15:06:16    pyomo.contrib.gdpopt.loa: 6552
15:06:16    pyomo.contrib.solver.common.config: 8482
15:06:16    pyomo.gdp.plugins.multiple_bigm: 10538
15:06:16    pyomo.core.base.set: 24237
15:06:16    pyomo.environ: 41733
15:06:16 TPLS:
15:06:16            argparse:   4524  (from pyomo.common.config)
15:06:16             cPickle:    396  (from pyomo.common.dependencies)
15:06:16                 csv:   2236  (from pyomo.dataportal.plugins.csv_table)
15:06:16              ctypes:  14562  (from pyomo.core.base.external)
15:06:16             decimal:   3694  (from pyomo.dataportal.plugins.db_table)
15:06:16                  gc:    101  (from pyomo.common.gc_manager)
15:06:16               heapq:   2046  (from pyomo.contrib.gdpopt.branch_and_bound)
15:06:16    knitro.constants:   1577  (from pyomo.contrib.solver.solvers.knitro.api)
15:06:16       knitro.knitro:   1314  (from pyomo.contrib.solver.solvers.knitro.api)
15:06:16      knitro.wrapper:  23166  (from pyomo.contrib.solver.solvers.knitro.api)
15:06:16             logging:   4600  (from pyomo.common.log)
15:06:18             ply.lex:   2516  (from pyomo.common.config)
15:06:18            ply.yacc:   1956  (from pyomo.dataportal.parse_datacmds)
15:06:18               shlex:   1260  (from pyomo.common.collections.bunch)
15:06:18 TPLS (by package time):
15:06:18              gc:    101 ( 0.0%)
15:06:18         cPickle:    396 ( 0.1%)
15:06:18           shlex:   1260 ( 0.2%)
15:06:18           heapq:   2046 ( 0.3%)
15:06:18             csv:   2236 ( 0.3%)
15:06:18         decimal:   3694 ( 0.6%)
15:06:18             ply:   4472 ( 0.7%)
15:06:18        argparse:   4524 ( 0.7%)
15:06:18         logging:   4600 ( 0.7%)
15:06:18          ctypes:  14562 ( 2.2%)
15:06:18          knitro:  26057 ( 3.9%)
15:06:18 Pyomo:    601117 (90.4%)
15:06:18 TPL:       63948 ( 9.6%)
15:06:18 - generated xml file: /host/tester/python/python311/TEST-pyomo.xml -
15:06:18 =========================== short test summary info ============================
15:06:18 FAILED pyomo/pyomo/environ/tests/test_environ.py::TestPyomoEnviron::test_tpl_import_time - AssertionError: Items in the first set but not the second:
15:06:18 'knitro' : Unexpected module found in 5 slowest-loading TPL modules

Just update test_environ so it knows to expect that knitro is in the 5.

@eminyouskn
Copy link
Contributor Author

Thanks @mrmundt for the report. I’d prefer not to change the test since it should pass as is. I believe I found the cause of the failure, so I’ll add a fix.

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.

3 participants