Skip to content

How to use max function within integral in the objective function #305

Answered by pulsipher
christineymshen asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @christineymshen and welcome.

Yes, we can set this up in InfiniteOpt without too much issue. First, we can reformulate using a common linear programming trick shown here to address the max function.

In InfiniteOpt, I get:

using InfiniteOpt, Ipopt

# Initialize the model
model = InfiniteModel(Ipopt.Optimizer)

# Define the infinite parameters
@infinite_parameter(model, x  [-10000, 10000], num_supports  = 100)
@infinite_parameter(model, θ  [-10000, 0], num_supports = 100)

# Define the decision variables and their bounds
@variable(model, λ  0, Infinite(θ)) # creates λ(θ)
@variable(model, z  0)  # creates z
@variable(model, aux  0,  Infinite(x)) # creates auxiliary variable for handl…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@christineymshen
Comment options

@christineymshen
Comment options

@pulsipher
Comment options

@christineymshen
Comment options

@pulsipher
Comment options

Answer selected by christineymshen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants