
#================================================== =======#
# ALM Kuantitatif, Ekonometrika & Derivatif Keuangan
# ML/DL menggunakan R, Python, Tensorflow oleh Sang-Heon Lee
#
# https://kiandlee.blogspot.com
#———————————————————–#
# Masalah Pencocokan CF Aset/Kewajiban sederhana
#================================================== =======#
grafik.mati() # hapus semua grafik
rm(daftar = l ()) # hapus semua file dari ruang kerja Anda
perpustakaan (ROI)
perpustakaan (ROI.plugin.neos)
# Suku Bunga Kotor
Rx = 1.01 # Xi: batas kredit
Ry = 1.02 # Yi: CP 90d
Rz = 1.003 # Zi : kelebihan dana
# variabel keputusan
# –> x1,2,3,4,5, y1,2,3, z1,2,3,4,5, v
# Matriks sisi kiri
v.LHS – C(
1,0,0,0,0, 1,0,0, –1,0,0,0,0, 0,
–Rx,1,0,0,0, 0,1,0, Rz,–1,0,0,0, 0,
0,–Rx,1,0,0, 0,0,1, 0,Rz,–1,0,0, 0,
0,0,–Rx,1,0, –ry,0,0, 0,0,Rz,–1,0, 0,
0,0,0,–Rx,1, 0,–ry,0, 0,0,0,Rz,–1, 0,
0,0,0,0,–Rx, 0,0,–ry, 0,0,0,0,Rz, –1
)
m.LHS – matriks (v.LHS, nrow = 6, byrow = BENAR)
# v (variabel keputusan ke-14) adalah fungsi tujuan
lp_obj – L_objektif(c(rep(0,13),1))
# LHS * X = RHS
lp_con – Batas_L(
L = m.LHS,
kepadamu = reputasi(“==”, 6),
rhs = C(150,100,–200,200,–50,–300))
# Batas bawah & atas untuk variabel keputusan
lp_bound – V_terikat(
pada = 1:14, ui = 1:14, lb = reputasi(0,14),
ub = c(perwakilan(100,5), rep(Inf,9)))
# Atur Masalah
lp – OP (tujuan = lp_obj,
kendala = lp_con,
batas = lp_bound, maksimum = BENAR)
# Menyelesaikan masalah
memilih – ROI_memecahkan(
lp, pemecah = “Neo”,
metode = “Mosek”,
surel = “Alamat email anda”)
# Cetak
kucing(“nHasil untuk Pencocokan CF A/L sederhana nn”,
“Nilai Fungsi Tujuan = “,
bulat(opt$objval,4), “n”,
“Variabel Keputusan Xi =”,
bulat(opt$solusi[1:5],4), “n”,
“Variabel Keputusan Yi = “,
bulat(opt$solusi[6:9],4), “n”,
“Variabel Keputusan Zi = “,
bulat(opt$solusi[10:14],4))