Boa tarde,
1 -Como faço para aumentar o limite default do solver no vba para um número maior que 8000 subproblemas?
Já tentei isso aqui: (Nada resolveu)
SolverOptions MaxTime:=180 'Max of 180 Seconds!
SolverOptions Precision:=0.001
MaxSubproblems = 10000000
Iterations = 10000000
MaxIntegerSols = 10000000
MaxTimeNoImp = 180
2 - Como eu faço para que ao rodar o passo final do solver - SolverSolve True - , ele termine de rodar sem que apareça aquela mensagem perguntando se eu quero continuar, parar ou salvar o cenário?
Minha macro é para otimizar uma margem bruta em uma planilha de precificação de seguros, de modo que eu aumente a produção e diminua o sinistro:
Sub PARAMETROS_SOLVER_PSS()
Dim NUMERO As Double
Dim DESC_MAX, AGRV_MAX As String
Dim ultimalinha, primeiroregistro, primeiralinha, x As Integer
Dim a As Variant
DESC_MAX = "$C$6"
AGRV_MAX = "$C$7"
Sheets("SIMULADOR").Select
ultimalinha = Cells(Rows.Count, 22).End(xlUp).Row
Range("V40").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
SolverReset 'Limpa todas as configurações do Solver
[b] SolverOptions MaxTime:=180
SolverOptions Precision:=0.001
MaxSubproblems = 10000000
Iterations = 10000000
MaxIntegerSols = 10000000
MaxTimeNoImp = 180[/b]
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''MAXIMIZAR A MARGEM DA PROJEÇÃO'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
SolverOk SetCell:="$F$33", MaxMinVal:=1, ValueOf:=0, ByChange:="$V$40:$V$62" _
, Engine:=3, EngineDesc:="Evolutionary"
SolverAdd CellRef:="$G$30", Relation:=3, FormulaText:=0
SolverAdd CellRef:="$G$32", Relation:=1, FormulaText:=0
SolverAdd CellRef:="$G$33", Relation:=3, FormulaText:=0
SolverAdd CellRef:="$V$40", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$41", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$42", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$43", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$44", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$45", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$46", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$47", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$48", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$49", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$50", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$51", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$52", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$53", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$54", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$55", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$56", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$57", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$58", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$59", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$60", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$61", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$62", Relation:=1, FormulaText:=AGRV_MAX
SolverAdd CellRef:="$V$40", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$41", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$42", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$43", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$44", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$45", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$46", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$47", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$48", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$49", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$50", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$51", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$52", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$53", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$54", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$55", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$56", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$57", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$58", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$59", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$60", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$61", Relation:=3, FormulaText:=DESC_MAX
SolverAdd CellRef:="$V$62", Relation:=3, FormulaText:=DESC_MAX
[b] Application.DisplayAlerts = False
SolverSolve True
'SolverSolve UserFinish:=True
'iSolution = SolverSolve(True)[/b]
Sheets("SIMULADOR").Select
End Sub