'Confusion in Python Pyomo Components (Parameter and Variable)
I am learning Pyomo Abstract Modeling from a Book.
I have an example that has an objective functionEquation is here to minimize the cost of establishing a warehouse at optimal locations to build warehouses to meet delivery demands. The authors modeled the objective with this script Script is here.
Here in the script "model.d" is "Param" and "model.x" is "Var" Why he has used Param for "model.d" and "Var" for "model.x"? Please take spare precious time to help me to get out of this.
Solution 1:[1]
Not only in pyomo
, but in general, for Operations Researchs or Optimization. A Parameter
is a given value that you know prior solving the problem. On the other hand, a Variable
is a value that you will find solving the problem in order to get the best solution.
Suposse that in your problem model.d
is the cost of constructing the warehouse model.x
. This means that for each potential warehouse x
, construct it cost d
. This assumme that if your building a warehouse, you know the capital cost of constructing such a warehouse, therefore, it is known before solving the problem, then model.d
is a parameter
. model.x
is variable
since you don't know whether if construct it or not. You want want the model to tell you that, therefore, it is a variable
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | pybegginer |