Puzzling behavior with constrained optimization #252
-
Hi. I'm trying to solve a constrained optimization problem but I face a puzzling behavior that I don't understand. Any help would be welcome and sorry if I made an obvious mistake (I'm a beginner with Jaxopt). To simplify, let's say that I'd like to solve:
If I do the following (cf. this Colab notebook with all the following code snippets), I get the expected result (i.e. [45, 55, 45, 55]).
Problem 1However, if I remove the fourth constraint (which a linear combination of the three other constraints and should then be superfluous), I get an incorrect result (
Problem 2Moreover, if I also want to enforce a positivity constraint on
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Good catch. I see two unrelated problems here. Problem 1Currently, I see one easy hot fix : switch to Ideally, one would want to control hyper-parameters But currently you need to re-implement I also noticed that setting your own step size by setting argument Problem 2Initially the function The hot-fix would be to stop the feasability check as done below: def projection_polyhedron_no_feasability_check(x, hyperparams):
return projection_polyhedron(x, hyperparams, check_feasible=False)
pg = ProjectedGradient(
fun=objective_fun,
projection=projection_polyhedron_no_feasability_check
)
pg.run(w_init, hyperparams_proj=hyperparams_proj).params Once again, in a ideal situation we would like to pass those hyper-parameters directly to the projection method ourselves. |
Beta Was this translation helpful? Give feedback.
Good catch. I see two unrelated problems here.
Problem 1
Currently,
projection_affine_set
relies onEqualityConstrainedQP
which is known to be instable in some circumstances - specially infloat32
with large magnitude onw_init
as it is the case here: the value of the objective is above1e4
initially.I see one easy hot fix : switch to
float64
by addingjax.config.update("jax_enable_x64", True)
at the beginning of the program.Ideally, one would want to control hyper-parameters
tol
andrefine_regularization=1e-3
in call to EqualityConstrainedQP solver withinprojection_affine_set
: see hereBut currently you need to re-implement
projection_affine_set
yourself to add those modifications.I…