Skip to content

Résolution des problèmes d'optimisation avec contraintes, en utilisant la méthode de pénalité quadratique.#6

Open
bouayoubegrine wants to merge 3 commits intodpo-mth8408:mainfrom
bouayoubegrine:TP4
Open

Résolution des problèmes d'optimisation avec contraintes, en utilisant la méthode de pénalité quadratique.#6
bouayoubegrine wants to merge 3 commits intodpo-mth8408:mainfrom
bouayoubegrine:TP4

Conversation

@bouayoubegrine
Copy link

  • Résolution des problèmes d'optimisation avec contraintes, en utilisant la méthode de pénalité quadratique.

@@ -0,0 +1,125 @@
#| echo: false
#| output: falseusing Pkg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???

@github-actions
Copy link

Status:
Success--Here-is-the-PDF

# modifier la fonction fournie en laboratoire

function c!(cx,x)
return [10 * (x[2] - x[1]^2)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il faut placer ce vecteur dans cx.

################
##### Initialiser cx en x
cx = zeros(eltype(x), nlp.meta.ncon)# Initialiser la violation des contraintes
nlp.c!(cx, x)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???

function kkt_residual(nlp,x,y)
J = jac(nlp, x)
gradient = grad(nlp, x)
gradient = gradient - J'*y
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

La réalisabilité primale fait aussi partie des conditions de KKT.

println("Problème ", i, " résolu avec newton modifiée")
quad_penalty(nlp; x =nlp.meta.x0, ϵa = 1e-6, ϵr = 1e-6,σ = 2.0, max_iter =100, method = "Modified_Newton")
println("Problème ", i, " résolu avec newton inexact")
quad_penalty(nlp; x =nlp.meta.x0, ϵa = 1e-6, ϵr = 1e-6,σ = 2.0, max_iter =100, method = "Inexact_Newton")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sur certains problèmes, ton "résidu de KKT" est tout petit, mais ||c(x)|| n'est pas petit et tu t'arrêtes quand-même. Sur un des problèmes, tu génères des NaN. Tu n'as pas examiné tes résultats à la loupe.


# En-têtes de colonnes
col_names = ["nom", "nvar", "ncon", "‖r_KKT‖ (initial)",
"‖r_KKT‖ (final)", "‖y‖ (final)", "rho", "iterations", "status finale"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On ne voit pas toutes les colonnes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants