cog-imperial / OMLT

Represent trained machine learning models as Pyomo optimization formulations
Other
257 stars 56 forks source link

pyomo.common.errors.DeveloperError: Internal Pyomo implementation error: #106

Closed RuifMaxx closed 1 year ago

RuifMaxx commented 1 year ago

Summary

I ran pyomo solve in with omlt and get a bug end with

pyomo.common.errors.DeveloperError: Internal Pyomo implementation error:
        "The '_data' dictionary and '_index' attribute are out of sync for indexed Block 'unknown': The None entry in the '_data' dictionary does not map back to this component data object."
        Please report this to the Pyomo Developers.

Error Message

============== Diagnostic Run torch.onnx.export version 2.0.0+cpu ==============
verbose: False, log level: Level.ERROR
======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR ========================

0       InputLayer(input_size=[3], output_size=[3])     linear
1       DenseLayer(input_size=[3], output_size=[128])   sigmoid
2       DenseLayer(input_size=[128], output_size=[128]) sigmoid
3       DenseLayer(input_size=[128], output_size=[128]) sigmoid
4       DenseLayer(input_size=[128], output_size=[1])   linear
============== Diagnostic Run torch.onnx.export version 2.0.0+cpu ==============
verbose: False, log level: Level.ERROR
======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR ========================

0       InputLayer(input_size=[3], output_size=[3])     linear
1       DenseLayer(input_size=[3], output_size=[128])   sigmoid
2       DenseLayer(input_size=[128], output_size=[128]) sigmoid
3       DenseLayer(input_size=[128], output_size=[128]) sigmoid
4       DenseLayer(input_size=[128], output_size=[1])   linear
WARNING (W1002): Setting Var 'neural_net_block0.scaled_inputs[0]' to a numeric
    value `0` outside the bounds (0.45, 100).
    See also https://pyomo.readthedocs.io/en/stable/errors.html#w1002
WARNING (W1002): Setting Var 'neural_net_block0.scaled_inputs[0]' to a numeric
    value `0` outside the bounds (0.45, 100).
    See also https://pyomo.readthedocs.io/en/stable/errors.html#w1002
WARNING (W1002): Setting Var 'neural_net_block0.scaled_inputs[1]' to a numeric
    value `0` outside the bounds (0.45, 100).
    See also https://pyomo.readthedocs.io/en/stable/errors.html#w1002
WARNING (W1002): Setting Var 'neural_net_block1.scaled_inputs[0]' to a numeric
    value `0` outside the bounds (0.45, 100).
    See also https://pyomo.readthedocs.io/en/stable/errors.html#w1002
WARNING (W1002): Setting Var 'neural_net_block1.scaled_inputs[0]' to a numeric
    value `0` outside the bounds (0.45, 100).
    See also https://pyomo.readthedocs.io/en/stable/errors.html#w1002
WARNING (W1002): Setting Var 'neural_net_block1.scaled_inputs[1]' to a numeric
    value `0` outside the bounds (0.45, 100).
    See also https://pyomo.readthedocs.io/en/stable/errors.html#w1002
Traceback (most recent call last):
  File "cluster_mange_2.py", line 230, in <module>
    tester.main_route()
  File "cluster_mange_2.py", line 175, in main_route
    self.calculate_next()
  File "cluster_mange_2.py", line 141, in calculate_next
    self.action,qps,stats = c.sk_baye()
  File "/root/k8s_manger/algorithm/modelOptV2.py", line 291, in sk_baye
    res = skopt.gp_minimize(self.opt,                  # the function to minimize
  File "/root/mrf_python/lib/python3.8/site-packages/skopt/optimizer/gp.py", line 259, in gp_minimize
    return base_minimize(
  File "/root/mrf_python/lib/python3.8/site-packages/skopt/optimizer/base.py", line 299, in base_minimize
    next_y = func(next_x)
  File "/root/k8s_manger/algorithm/modelOptV2.py", line 307, in opt
    x,_,cost = self.c.CreatOpt(q)
  File "/root/k8s_manger/algorithm/modelOptV2.py", line 405, in CreatOpt
    results = opt.solve(m, tee=True)
  File "/root/mrf_python/lib/python3.8/site-packages/pyomo/opt/base/solvers.py", line 570, in solve
    self._presolve(*args, **kwds)
  File "/root/mrf_python/lib/python3.8/site-packages/pyomo/opt/solver/shellcmd.py", line 219, in _presolve
    OptSolver._presolve(self, *args, **kwds)
  File "/root/mrf_python/lib/python3.8/site-packages/pyomo/opt/base/solvers.py", line 667, in _presolve
    self._convert_problem(args,
  File "/root/mrf_python/lib/python3.8/site-packages/pyomo/opt/base/solvers.py", line 718, in _convert_problem
    return convert_problem(args,
  File "/root/mrf_python/lib/python3.8/site-packages/pyomo/opt/base/convert.py", line 101, in convert_problem
    problem_files, symbol_map = converter.apply(*tmp, **tmpkw)
  File "/root/mrf_python/lib/python3.8/site-packages/pyomo/solvers/plugins/converter/model.py", line 187, in apply
    (problem_filename, symbol_map_id) = instance.write(
  File "/root/mrf_python/lib/python3.8/site-packages/pyomo/core/base/block.py", line 2016, in write
    (filename, smap) = problem_writer(self,
  File "/root/mrf_python/lib/python3.8/site-packages/pyomo/repn/plugins/nl_writer.py", line 339, in __call__
    info = self.write(model, FILE, ROWFILE, COLFILE, config=config)
  File "/root/mrf_python/lib/python3.8/site-packages/pyomo/repn/plugins/nl_writer.py", line 382, in write
    return impl.write(model)
  File "/root/mrf_python/lib/python3.8/site-packages/pyomo/repn/plugins/nl_writer.py", line 1078, in write
    line_1_txt = f"g3 1 1 0\t# problem {model.name}\n"
  File "/root/mrf_python/lib/python3.8/site-packages/pyomo/core/base/component.py", line 612, in name
    return self.getname(fully_qualified=True)
  File "/root/mrf_python/lib/python3.8/site-packages/pyomo/core/base/component.py", line 867, in getname
    return base + index_repr(self.index())
  File "/root/mrf_python/lib/python3.8/site-packages/pyomo/core/base/component.py", line 797, in index
    raise DeveloperError(
pyomo.common.errors.DeveloperError: Internal Pyomo implementation error:
        "The '_data' dictionary and '_index' attribute are out of sync for indexed Block 'unknown': The None entry in the '_data' dictionary does not map back to this component data object."
        Please report this to the Pyomo Developers.

Information on your system

Pyomo version:6.5.0 Python version:3.8.10 Operating system:Ubuntu 20.04 LTS How Pyomo was installed (PyPI, conda, source):PyPI, Solver (if applicable):IPOPT