Objective Function based on Interpolation/Look-Up Table
AnsweredHello,
I have created a function using scipy.interpolate.interp2d . Essentially, I call this function and give two inputs, and receive one output based on the inputs. Here is an example: my data is a fuel map for a diesel generator, I input the load of the generator (0-100%) and the power limit (maximum output 20kW). The function then uses the table values I have set and interpolation to give me an output: the fuel consumption for those specific values.
Now, using gurobi, the load is a variable (and there are about 40 generators) and the capacity is a variable as well. My objective function is to minimize fuel consumption, which means the variables must go through my scipy-created function and output fuel consumption values.
How can I achieve this? (I can give more details/example code upon request)
Thanks in advance!
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
It looks like you are looking to do a 2D piecewise linear approximation. Gurobi has built-in 1D PWL approximations for constraints and objectives. In general, 1D PWL approximation works quite well. However, things start to get challenging once you get beyond 1D.
To help get you started, there are two options introduced in How do I model a piecewise-linear function of more than one variable?
0
Post is closed for comments.
Comments
2 comments