I have a question regarding pyomo. I have seen quite often, that for the definition of parameters, objectives and constraints, explicit functions are defined. These functions expect some arguments and in Pyomo most often they are not passed when calling. I do not understand how this is possible. Here is an example (taken from https://pyomo.readthedocs.io/en/doc-testbuild/pyomo_modeling_components/Parameters.html)
def s_init(model, i, j): if i == j: return i*i else: return 0.0 model.S2 = pyo.Param(model.A, model.A, initialize=s_init)
s_init requires 3 parameters:
j. However when calling the function no parameter is being passed
initialize=s_init. So I am wondering how this is possible? While the parameter model has been defined (maybe it can be regarded as a static variable like in Java), I have no clue where the function takes the parameters
Can anybody tell me more about this? I'd appreciate every comment and will be quite thankful for your help.