Adam
Adam

Reputation: 363

Correct way to enter constraints using derivative values in JuMP?

I was wondering if there is a best practices to calculating variables, or more specifically, adding constraints to an optimization model using derivatives of variables.

To provide a concrete example. I have a function let's call output which I know is a non-linear combination of inputs.

ln Q = sum(phi_i ln(X_i) for i in n) 

However, I know that there is a budget constraint. And using this I can use the Lagragian to get some information about the change in Q and inputs. More specifically I know.

d(X_i)/X_i = d(Q)/Q - sum(eta * phi_j * (P_i - P_j) for j in n if j != i) 

equivalently

d(ln(X_i)) = d(ln(Q)) - sum(eta * phi_j * (P_i - P_j) for j in n if j != i) 

Entering the constraints into the JuMP optimization problem is a bit confusing if I don't have a way of calculating Q from d(Q). I suppose I could create a new equation that would be

Q_new = Q_prev + d(Q)

However, when running this model in "near" continuous time, I would have to set up lags where Q_prev was the Q from the previous optimized model. I have seen other modeling languages incorporate d(variable) into the constraints, and I'm wondering if JuMP has an elegant way of doing this.

Upvotes: 1

Views: 119

Answers (1)

Oscar Dowson
Oscar Dowson

Reputation: 2574

I'm not sure I fully understand your question, but the short answer is probably "no, JuMP doesn't have an elegant way of using the derivative of a variable in a constraint."

If you're doing some sort of trajectory optimization, you might want to take a look at

You might also want to take a look at these tutorials:

using derivatives of variables

The derivative of a variable with respect to what?

JuMP is a library for constrained mathematical optimization. What are the decision variables? What are the constraints? What is the objective?

I have seen other modeling languages incorporate d(variable) into the constraints

Which ones? Do you have examples?

p.s. since this isn't a question with a nice concrete answer, this question might be better suited to our community forum: https://discourse.julialang.org/c/domain/opt/13

Upvotes: 1

Related Questions