Skip to content

Parametric sensitivities? #126

Answered by peterdsharpe
benberry3d asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Ben,

A good question! It's possible, but it's a bit convoluted and requires some hacking into some CasADi details where the documentation can be quite sparse. Here's an example that parametrically computes sensitivities for the sensitivities w.r.t. a parameter on the constrained Rosenbrock Problem

import aerosandbox as asb
import aerosandbox.numpy as np

a = 1
b = 100

opti = asb.Opti()  # set up an optimization environment

# Define optimization variables
x = opti.variable(init_guess=0)
y = opti.variable(init_guess=0)

r = opti.parameter(1)

# Define constraints
opti.subject_to(x ** 2 + y ** 2 <= r)

# Define objective
f = (a - x) ** 2 + b * (y - x ** 2) ** 2
opti.minimize(f)

# Optimize

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@benberry3d
Comment options

Answer selected by benberry3d
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