-
Hi, I have encountered a scenario where I am working with n-dimensional variables and associated constraints, where each i-th constraint applies solely to the i-th coordinate of the optimization variable. Here's a simplified example to illustrate my point: import casadi as cas
import numpy as np
opti = cas.Opti()
n = 10
x = opti.variable(n)
y = np.linspace(1,2,n)
# Constrain function
g = x**2-y**2
opti.subject_to(x >= 0.0)
for i in range(n):
opti.subject_to(g[i] == 0)
opti.solver("ipopt")
sol = opti.solve() In this example, all constraints are fulfilled along their dimensions. However, I am interested in cases where the constraints might not be fully satisfied for all points of the n-dimensional space. In such scenarios, it would be advantageous to obtain the "partially converged" points, i.e., the solution where constraints are met to some extent. Could you please advise if there is a built-in feature or strategy within CasADi that facilitates obtaining partially converged solutions in such cases? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It sounds like you want to be introducing slack variables with an L1 penalty in the objective.
|
Beta Was this translation helpful? Give feedback.
It sounds like you want to be introducing slack variables with an L1 penalty in the objective.