Solveur-display alerts ne fonctionne pas; boolean customisé?

Bonjour,

J'ai besoin de votre aide, j'ai une longue macro (5h) qui fait appelle à des solveurs. Certaines fenêtres générées par le solveur apparaissent de temps en temps ("nombre maximum de solutions réalisables a été atteintes" etc) lorsque le solveur n'a pas trouvé de solution selon mes contraintes.; et je dois faire une manipulation à savoir cliquer sur ok de la fenêtre pour continuer la macro. Comment puis-je forcer via vba la non appartition de ces fenetres? Application.DisplayAlerts = False ne fonctionne pas, en recherchant, cela correspond à boolean, comment puis-je faire un boolean customisé? ou dois-je modifier un parametre dans mon solveur? Merci beaucoup par avance pour votre aide

Voici le code du solveur total et apres celui d'un solveur en détails

' Calcul_solveur_total Macro

Application.ScreenUpdating = False

Dim start As Single
start = Timer
Application.EnableEvents = False
Application.DisplayAlerts = False

Worksheets("4_Analyse_1").Activate

Call Solveur_1
Call Solveur_2
Call Solveur_3
Call Solveur_4
Call Solveur_5
Call Solveur_6

Worksheets("4_Analyse_2").Activate

Call Solveur_1
Call Solveur_2
Call Solveur_3
Call Solveur_4
Call Solveur_5
Call Solveur_6

Worksheets("4_Analyse_3").Activate

Call Solveur_1
Call Solveur_2
Call Solveur_3
Call Solveur_4
Call Solveur_5
Call Solveur_6

Worksheets("4_Analyse_4").Activate

Call Solveur_1
Call Solveur_2
Call Solveur_3
Call Solveur_4
Call Solveur_5
Call Solveur_6

Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True

MsgBox "dur?e du traitement: " & Timer - start & " secondes"

End Sub

'details d'un solveur

' Solveur_6 Macro
'

SolverReset

'1
SolverReset

If Range("uk4") > 0 Then
SolverOk SetCell:="$um$2", MaxMinVal:=1, ByChange:="$um$4:$un$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$uk$3", Relation:=3, FormulaText:="$MI$1"
        SolverAdd CellRef:="$ul$3", Relation:=3, FormulaText:="$MJ$1"
        SolverAdd CellRef:="$um$3", Relation:=3, FormulaText:="$MK$1"
        SolverAdd CellRef:="$um$4", Relation:=3, FormulaText:="$un$4"
        SolverAdd CellRef:="$um$4:$un$4", Relation:=1, FormulaText:="$uk$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1

SolverReset

    If Range("um4") > 0 Then
SolverOk SetCell:="$ur$3", MaxMinVal:=1, ByChange:="$up$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$uq$2", Relation:=3, FormulaText:="$MI$2"
        SolverAdd CellRef:="$up$4", Relation:=3, FormulaText:="$um$4"
        SolverAdd CellRef:="$up$4", Relation:=1, FormulaText:="$uk$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1
End If

SolverReset

    If Range("um4") > 0 Then
SolverOk SetCell:="$ur$2", MaxMinVal:=1, ByChange:="$ur$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$ur$2", Relation:=3, FormulaText:="$MJ$2"
        SolverAdd CellRef:="$ur$4", Relation:=1, FormulaText:="$un$4"
        SolverAdd CellRef:="$ur$4", Relation:=3, FormulaText:="$ul$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1
    End If
End If

'2

SolverReset

If Range("uu4") > 0 Then
SolverOk SetCell:="$uw$2", MaxMinVal:=1, ByChange:="$uw$4:$ux$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$uu$3", Relation:=3, FormulaText:="$MI$1"
        SolverAdd CellRef:="$uv$3", Relation:=3, FormulaText:="$MJ$1"
        SolverAdd CellRef:="$uw$3", Relation:=3, FormulaText:="$MK$1"
        SolverAdd CellRef:="$uw$4", Relation:=3, FormulaText:="$ux$4"
        SolverAdd CellRef:="$uw$4:$ux$4", Relation:=1, FormulaText:="$uu$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1

SolverReset

    If Range("uw4") > 0 Then
SolverOk SetCell:="$vb$3", MaxMinVal:=1, ByChange:="$uz$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$va$2", Relation:=3, FormulaText:="$MI$2"
        SolverAdd CellRef:="$uz$4", Relation:=3, FormulaText:="$uw$4"
        SolverAdd CellRef:="$uz$4", Relation:=1, FormulaText:="$uu$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1
End If

SolverReset

    If Range("uw4") > 0 Then
SolverOk SetCell:="$vb$2", MaxMinVal:=1, ByChange:="$vb$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$vb$2", Relation:=3, FormulaText:="$MJ$2"
        SolverAdd CellRef:="$vb$4", Relation:=1, FormulaText:="$ux$4"
        SolverAdd CellRef:="$vb$4", Relation:=3, FormulaText:="$uv$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1
    End If
End If

'3

SolverReset

If Range("ve4") > 0 Then
SolverOk SetCell:="$vg$2", MaxMinVal:=1, ByChange:="$vg$4:$vh$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$ve$3", Relation:=3, FormulaText:="$MI$1"
        SolverAdd CellRef:="$vf$3", Relation:=3, FormulaText:="$MJ$1"
        SolverAdd CellRef:="$vg$3", Relation:=3, FormulaText:="$MK$1"
        SolverAdd CellRef:="$vg$4", Relation:=3, FormulaText:="$vh$4"
        SolverAdd CellRef:="$vg$4:$vh$4", Relation:=1, FormulaText:="$ve$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1

SolverReset

    If Range("vg4") > 0 Then
SolverOk SetCell:="$vl$3", MaxMinVal:=1, ByChange:="$vj$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$vk$2", Relation:=3, FormulaText:="$MI$2"
        SolverAdd CellRef:="$vj$4", Relation:=3, FormulaText:="$vg$4"
        SolverAdd CellRef:="$vj$4", Relation:=1, FormulaText:="$ve$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1
End If

SolverReset

    If Range("vg4") > 0 Then
SolverOk SetCell:="$vl$2", MaxMinVal:=1, ByChange:="$vl$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$vl$2", Relation:=3, FormulaText:="$MJ$2"
        SolverAdd CellRef:="$vl$4", Relation:=1, FormulaText:="$vh$4"
        SolverAdd CellRef:="$vl$4", Relation:=3, FormulaText:="$vf$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1
    End If
End If

'4

SolverReset

If Range("vo4") > 0 Then
SolverOk SetCell:="$vq$2", MaxMinVal:=1, ByChange:="$vq$4:$vr$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$vo$3", Relation:=3, FormulaText:="$MI$1"
        SolverAdd CellRef:="$vp$3", Relation:=3, FormulaText:="$MJ$1"
        SolverAdd CellRef:="$vq$3", Relation:=3, FormulaText:="$MK$1"
        SolverAdd CellRef:="$vq$4", Relation:=3, FormulaText:="$vr$4"
        SolverAdd CellRef:="$vq$4:$vr$4", Relation:=1, FormulaText:="$vo$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1

SolverReset

    If Range("vq4") > 0 Then
SolverOk SetCell:="$vv$3", MaxMinVal:=1, ByChange:="$vt$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$vu$2", Relation:=3, FormulaText:="$MI$2"
        SolverAdd CellRef:="$vt$4", Relation:=3, FormulaText:="$vq$4"
        SolverAdd CellRef:="$vt$4", Relation:=1, FormulaText:="$vo$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1
End If

SolverReset

    If Range("vq4") > 0 Then
SolverOk SetCell:="$vv$2", MaxMinVal:=1, ByChange:="$vv$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$vv$2", Relation:=3, FormulaText:="$MJ$2"
        SolverAdd CellRef:="$vv$4", Relation:=1, FormulaText:="$vr$4"
        SolverAdd CellRef:="$vv$4", Relation:=3, FormulaText:="$vp$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1
    End If
End If

'5

SolverReset

If Range("vy4") > 0 Then
SolverOk SetCell:="$wa$2", MaxMinVal:=1, ByChange:="$wa$4:$wb$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$vy$3", Relation:=3, FormulaText:="$MI$1"
        SolverAdd CellRef:="$vz$3", Relation:=3, FormulaText:="$MJ$1"
        SolverAdd CellRef:="$wa$3", Relation:=3, FormulaText:="$MK$1"
        SolverAdd CellRef:="$wa$4", Relation:=3, FormulaText:="$wb$4"
        SolverAdd CellRef:="$wa$4:$wb$4", Relation:=1, FormulaText:="$vy$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1

SolverReset

    If Range("wa4") > 0 Then
SolverOk SetCell:="$wf$3", MaxMinVal:=1, ByChange:="$wd$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$we$2", Relation:=3, FormulaText:="$MI$2"
        SolverAdd CellRef:="$wd$4", Relation:=3, FormulaText:="$wa$4"
        SolverAdd CellRef:="$wd$4", Relation:=1, FormulaText:="$vy$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1
End If

SolverReset

    If Range("wa4") > 0 Then
SolverOk SetCell:="$wf$2", MaxMinVal:=1, ByChange:="$wf$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$wf$2", Relation:=3, FormulaText:="$MJ$2"
        SolverAdd CellRef:="$wf$4", Relation:=1, FormulaText:="$wb$4"
        SolverAdd CellRef:="$wf$4", Relation:=3, FormulaText:="$vz$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1
    End If
End If

'6

SolverReset

If Range("wi4") > 0 Then
SolverOk SetCell:="$wk$2", MaxMinVal:=1, ByChange:="$wk$4:$wl$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$wi$3", Relation:=3, FormulaText:="$MI$1"
        SolverAdd CellRef:="$wj$3", Relation:=3, FormulaText:="$MJ$1"
        SolverAdd CellRef:="$wk$3", Relation:=3, FormulaText:="$MK$1"
        SolverAdd CellRef:="$wk$4", Relation:=3, FormulaText:="$wl$4"
        SolverAdd CellRef:="$wk$4:$wl$4", Relation:=1, FormulaText:="$wi$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1

SolverReset

    If Range("wk4") > 0 Then
SolverOk SetCell:="$wp$3", MaxMinVal:=1, ByChange:="$wn$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$wo$2", Relation:=3, FormulaText:="$MI$2"
        SolverAdd CellRef:="$wn$4", Relation:=3, FormulaText:="$wk$4"
        SolverAdd CellRef:="$wn$4", Relation:=1, FormulaText:="$wi$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1
End If

SolverReset

    If Range("wk4") > 0 Then
SolverOk SetCell:="$wp$2", MaxMinVal:=1, ByChange:="$wp$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$wp$2", Relation:=3, FormulaText:="$MJ$2"
        SolverAdd CellRef:="$wp$4", Relation:=1, FormulaText:="$wl$4"
        SolverAdd CellRef:="$wp$4", Relation:=3, FormulaText:="$wj$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1
    End If
End If

'7

SolverReset

If Range("ws4") > 0 Then
SolverOk SetCell:="$wu$2", MaxMinVal:=1, ByChange:="$wu$4:$wv$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$ws$3", Relation:=3, FormulaText:="$MI$1"
        SolverAdd CellRef:="$wt$3", Relation:=3, FormulaText:="$MJ$1"
        SolverAdd CellRef:="$wu$3", Relation:=3, FormulaText:="$MK$1"
        SolverAdd CellRef:="$wu$4", Relation:=3, FormulaText:="$wv$4"
        SolverAdd CellRef:="$wu$4:$wv$4", Relation:=1, FormulaText:="$ws$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1

SolverReset

    If Range("wu4") > 0 Then
SolverOk SetCell:="$wz$3", MaxMinVal:=1, ByChange:="$wx$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$wy$2", Relation:=3, FormulaText:="$MI$2"
        SolverAdd CellRef:="$wx$4", Relation:=3, FormulaText:="$wu$4"
        SolverAdd CellRef:="$wx$4", Relation:=1, FormulaText:="$ws$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1
End If

SolverReset

    If Range("wu4") > 0 Then
SolverOk SetCell:="$wz$2", MaxMinVal:=1, ByChange:="$wz$4", _
    Engine:=3, EngineDesc:="Evolutionary"
        SolverAdd CellRef:="$wz$2", Relation:=3, FormulaText:="$MJ$2"
        SolverAdd CellRef:="$wz$4", Relation:=1, FormulaText:="$wv$4"
        SolverAdd CellRef:="$wz$4", Relation:=3, FormulaText:="$wt$4"
Solversolve (True)
Solversolve UserFinish:=True
Solverfinish Keepfinal = 1
    End If
End If

End Sub

Bonjour,

De mon côté, je n'ai pas trouvé d'instruction VBA concernant les boites de dialogue du Solveur lorsque l'optimisation excède le nombre d'itération ou la durée maximale paramétrée. Si ça vous pose réellement problème, le plus simple est de ne pas mettre de limite sur ces paramètres pour laisser l'optimisation du Solveur s'effectuer jusqu'au bout...

dommage, espérons que quelqu'un connaisse la réponse. le pb que j'ai c'est que je sais que pour certains problèmes, il n y a pas de solutions possibles, le solveur risque de calculer indéfiniment, et de ne pas passer à l'étape suivante.

dommage, espérons que quelqu'un connaisse la réponse. le pb que j'ai c'est que je sais que pour certains problèmes, il n y a pas de solutions possibles, le solveur risque de calculer indéfiniment, et de ne pas passer à l'étape suivante.

Je ne connais pas le contenu de votre scénario, mais il est peut-être possible d'ajouter des contraintes, de modifier les formules ou d'anticiper via VBA les scénarii qui n'ont pas de solution possible pour éviter de lancer le Solveur dans ces cas précis.

Pedro, merci encore, toutefois, je continue à chercher sur des forums anglosaxons.

Ce que j'ai trouvé c'est le nom de l'erreur, correspondant à mon pb.

3 = Stop chosen when the maximum iteration limit was reached.

4 = The Objective Cell values do not converge.

5 = Solver could not find a feasible solution.

pensez vous toujours que cela est impossible avec le numero d'erreur? je continue de chercher

'voici la réponse et ca fonctionne

'créer une macro

Sub pasdepopup()

'

' pasdepopup Macro

'

Const xContinue As Boolean = False

End Sub

'

'et ajuster le code du solveur

If Range("MN4") > 0 Then

SolverOk SetCell:="$MP$2", MaxMinVal:=1, ByChange:="$MP$4:$MQ$4", _

Engine:=3, EngineDesc:="Evolutionary"

SolverAdd CellRef:="$MN$3", Relation:=3, FormulaText:="$MI$1"

SolverAdd CellRef:="$MO$3", Relation:=3, FormulaText:="$MJ$1"

SolverAdd CellRef:="$MP$3", Relation:=3, FormulaText:="$MK$1"

SolverAdd CellRef:="$MP$4", Relation:=3, FormulaText:="$MQ$4"

SolverAdd CellRef:="$MP$4:$MQ$4", Relation:=1, FormulaText:="$MN$4"

SolverSolve (True)

solveroptions stepthru = False

result = SolverSolve(userfinish:=True, showref:="pasdepopup")

Solverfinish Keepfinal = 1

SolverReset

If Range("MP4") > 0 Then

SolverOk SetCell:="$MU$3", MaxMinVal:=1, ByChange:="$MS$4", _

Engine:=3, EngineDesc:="Evolutionary"

SolverAdd CellRef:="$MT$2", Relation:=3, FormulaText:="$MI$2"

SolverAdd CellRef:="$MS$4", Relation:=3, FormulaText:="$MP$4"

SolverAdd CellRef:="$MS$4", Relation:=1, FormulaText:="$MN$4"

SolverSolve (True)

solveroptions stepthru = False

result = SolverSolve(userfinish:=True, showref:="pasdepopup")

Solverfinish Keepfinal = 1

End If

Rechercher des sujets similaires à "solveur display alerts fonctionne pas boolean customise"