AW: Solver verwendet falsche Zahlen
03.09.2021 13:26:29
peterk
Hallo
Ich weiss nicht was Du falsch gemacht hast, aber Deine Werte werden vom Solver "verwurschtelt". Z.B P14/Q14 Solver trägt folgende Werte ein K14>=5 und K14
Sub Optimize()
SolverReset
SolverOptions Precision:=0.0001
SolverOK MaxMinVal:=1 'Max 1 / Min 2 / Target 3
SolverOK SetCell:=Range("L18") 'target
SolverOK Engine:=1 '1 GRG Nonlinear / 2 Simplex LP / 3 EA
SolverOK ByChange:=Range("K8:K17") 'Variable
'Weight 1 = / Integer / 5 Binary
SolverAdd CellRef:=Range("K8"), relation:=1, FormulaText:="$Q$8" 'Equities
SolverAdd CellRef:=Range("K8"), relation:=3, FormulaText:="$P$8"
SolverAdd CellRef:=Range("K9"), relation:=1, FormulaText:="$Q$9" 'Govies
SolverAdd CellRef:=Range("K9"), relation:=3, FormulaText:="$P$9"
SolverAdd CellRef:=Range("K10"), relation:=1, FormulaText:="$Q$10" 'PE
SolverAdd CellRef:=Range("K10"), relation:=3, FormulaText:="$P$10"
SolverAdd CellRef:=Range("K11"), relation:=1, FormulaText:="$Q$11" 'RE
SolverAdd CellRef:=Range("K11"), relation:=3, FormulaText:="$P$11"
SolverAdd CellRef:=Range("K12"), relation:=1, FormulaText:="$Q$12" 'Liquid Alternatives
SolverAdd CellRef:=Range("K12"), relation:=3, FormulaText:="$P$12"
SolverAdd CellRef:=Range("K13"), relation:=1, FormulaText:="$Q$13" 'Commodities
SolverAdd CellRef:=Range("K13"), relation:=3, FormulaText:="$P$13"
SolverAdd CellRef:=Range("K14"), relation:=1, FormulaText:="$Q$14" 'IG
SolverAdd CellRef:=Range("K14"), relation:=3, FormulaText:="$P$14"
SolverAdd CellRef:=Range("K15"), relation:=1, FormulaText:="$Q$15" 'HY/PD&DL
SolverAdd CellRef:=Range("K15"), relation:=3, FormulaText:="$P$15"
SolverAdd CellRef:=Range("K16"), relation:=1, FormulaText:="$Q$16" 'Inflation Linker
SolverAdd CellRef:=Range("K16"), relation:=3, FormulaText:="$P$16"
SolverAdd CellRef:=Range("K17"), relation:=1, FormulaText:="$Q$17" 'Global Infra
SolverAdd CellRef:=Range("K17"), relation:=3, FormulaText:="$P$17"
'Global Restr.
SolverAdd CellRef:=Range("K33"), relation:=2, FormulaText:="$L$33"
SolverAdd CellRef:=Range("K34"), relation:=1, FormulaText:="$L$34"
'SolverAdd CellRef:=Range("K35"), relation:=3, FormulaText:="$L$35" 'only Min Var Opti
SolverAdd CellRef:=Range("K36"), relation:=1, FormulaText:="$L$36"
SolverAdd CellRef:=Range("K37"), relation:=1, FormulaText:="$L$37"
SolverAdd CellRef:=Range("K38"), relation:=1, FormulaText:="$L$38"
SolverAdd CellRef:=Range("K41"), relation:=1, FormulaText:="$L$41"
SolverSolve
'userfinish=true -> MC Simulation
End Sub
Peter