code: def test_abstract_model_with_constraints() -> None:
      abs_model = pyomo.AbstractModel()
      abs_model.F = pyomo.Set()
      abs_model.Xmin = pyomo.Param(
          abs_model.F, within=pyomo.Reals, default=0.0
      )
      abs_model.x = pyomo.Var(abs_model.F, within=pyomo.Reals)
      abs_model.constraints = pyomo.Constraint(
          abs_model.F, rule=lambda m, i: m.x[i] >= m.Xmin[i]
      )
      abs_model.obj = pyomo.Objective(rule=square)
  
      # Load the values of the parameters from external file
      dirname = os.path.dirname(__file__)
      filename = os.path.join(dirname, "test_model_1.dat")
      model = abs_model.create_instance(filename)
  
      func = core.Pyomo(model)
      func.parametrization.random_state.seed(12)
      optimizer = ng.optimizers.OnePlusOne(
          parametrization=func.parametrization, budget=200
      )
      recommendation = optimizer.minimize(func.function)
  
      np.testing.assert_almost_equal(
          recommendation.kwargs['x["New York"]'],
          model.Xmin["New York"],
          decimal=1,
      )
      np.testing.assert_almost_equal(
          recommendation.kwargs['x["Hong Kong"]'],
          model.Xmin["Hong Kong"],
          decimal=1,
      )
  
file_path: nevergrad/nevergrad/functions/pyomo/test_core.py
imports: import typing
  import os
  import numpy
  import pyomo.environ
  import nevergrad
  from .None import core
label_desc: Use image node_id 4 for calling a global function with example usage: test_abstract_model_with_constraints() without return types