Email             : nikitaindriyni.com
RPubs            : https://https://rpubs.com/nikitaindriyani/


1 Carilah definisi Optimasi, Optimisasi, atau Optimalisasi? Mana yang benar?

Jawaban

1.1 Optimasi

Optimasi adalah salah satu disiplin ilmu dalam matematika yang fokus untuk mendapatkan nilai minimum atau maksimum secara sistematis dari suatu fungsi.

1.2 Optimisasi

Optimisasi ialah suatu proses untuk mencapai hasil yang ideal atau optimal. Dalam disiplin matematika optimisasi merujuk pada studi permasalahan yang mencoba untuk mencari nilai minimal atau maximal dari suatu fungsi riil.

1.3 Optimalisasi

optimalisasi adalah pencarian nilai terbaik dari yang tersedia dari beberapa fungsi yang diberikan pada suatu konteks

Dari penjelasan diatas memiliki tujuan yang sama yaitu mencari nilai terbaik

2 Jelaskan apa yang dimaksud dengan optimasi terbatas dan optimasi tanpa kendala, berikan contohnya!

Jawaban

2.1 Optimasi Terbatas

Optimasi terbatas adalah salah satu alat dasar dalam ekonomi dan dalam kehidupan nyata. Konsumen memaksimalkan utilitas mereka tunduk pada banyak kendala, dan satu kendala yang signifikan adalah kendala anggaran mereka.

2.1.1 Example

Memaksimalkan utilitas subyek u=f(x,y)=xy pada kendala g(x,y)=x+4y=240. Harga per unit x adalah 1, harga y adalah 4, dan anggaran yang tersedia untuk membeli x dan y adalah 240. Pecahkan masalah dengan menggunakan pendekatan geometris!

2.2 Optimasi tanpa kendala

Optimasi yang tidak dibatasi melibatkan menemukan maksimum atau minimal fungsi yang dapat dibedakan dari beberapa variabel di atas satu set yang bagus. Untuk memenuhi kompleksitas masalah, sistem aljabar komputer dapat digunakan untuk melakukan perhitungan yang diperlukan.

2.2.1 Example

minimize the outer area of a cylinder subject to a fixed volume. Objective function F(x) = 2??r2 + 2??rh, x = [r h]

2.2.2 Example

Tentukan ekstrim mutlak dari fungsi f(x)=x5???2x+10 pada selang [1,6]

3 Metode atau algoritma yang sering digunakan pada Optimasi, berdasarkan:

3.1 Optimasi Satu Dimensi

f <- function (x, a) (x - a)^2
xmin <- optimize(f, c(0, 1), tol = 0.0001, a = 1/3)
xmin
## $minimum
## [1] 0.3333333
## 
## $objective
## [1] 0
f  <- function(x) ifelse(x > -1, ifelse(x < 4, exp(-1/abs(x - 1)), 10), 10)
fp <- function(x) { print(x); f(x) }

plot(f, -2,5, ylim = 0:1, col = 2)

optimize(fp, c(-4, 20))   # doesn't see the minimum
## [1] 5.167184
## [1] 10.83282
## [1] 14.33437
## [1] 16.49845
## [1] 17.83592
## [1] 18.66253
## [1] 19.1734
## [1] 19.48913
## [1] 19.68427
## [1] 19.80487
## [1] 19.8794
## [1] 19.92547
## [1] 19.95393
## [1] 19.97153
## [1] 19.9824
## [1] 19.98913
## [1] 19.99328
## [1] 19.99585
## [1] 19.99743
## [1] 19.99841
## [1] 19.99902
## [1] 19.99939
## [1] 19.99963
## [1] 19.99977
## [1] 19.99986
## [1] 19.99991
## [1] 19.99995
## [1] 19.99995
## $minimum
## [1] 19.99995
## 
## $objective
## [1] 10
optimize(fp, c(-7, 20))   # ok
## [1] 3.313082
## [1] 9.686918
## [1] -0.6261646
## [1] 1.244956
## [1] 1.250965
## [1] 0.771827
## [1] 0.2378417
## [1] 1.000451
## [1] 0.9906964
## [1] 0.9955736
## [1] 0.9980122
## [1] 0.9992315
## [1] 0.9998411
## [1] 0.9996083
## [1] 0.9994644
## [1] 0.9993754
## [1] 0.9993204
## [1] 0.9992797
## [1] 0.9992797
## $minimum
## [1] 0.9992797
## 
## $objective
## [1] 0

3.2 Optimasi Multidimensi

b<-4.7e-09
a<-(-2e-05)
M<-100
beta<-0.15
min<-function(x)
{
    x1=x[1]
    x2=x[2]
    x3=x[3]
    E=a*x1+b*x1^2+a*x2+b*x2^2+a*x3+b*x3^2
    V=(M-x1)+(M-x1-x2)+(M-x1-x2-x3)
    return (E+beta*V)
}

3.3 Model Optimasi Sederhana

# Import lpSolve package
library(lpSolve)

# Set coefficients of the objective function
f.obj <- c(5, 9)
 
# Set matrix corresponding to coefficients of constraints by rows
# Do not consider the non-negative constraint; it is automatically assumed
f.con <- matrix(c(1, 2,
                  0, 1,
                  3, 1), nrow = 3, byrow = TRUE)

# Set unequality signs
f.dir <- c("<=",
           "<=",
           "<=")

# Set right hand side coefficients
f.rhs <- c(16,
           19,
           8)

# Final value (z)
lp("max", f.obj, f.con, f.dir, f.rhs)
## Success: the objective function is 72
# Variables final values
lp("max", f.obj, f.con, f.dir, f.rhs)$solution
## [1] 0 8
# Sensitivities
lp("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$sens.coef.from
## [1] -1.000000e+30  1.666667e+00
lp("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$sens.coef.to
## [1] 27 10
lp("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$sens.coef.to
## [1] 27 10
# Dual Values (first dual of the constraints and then dual of the variables)
# Duals of the constraints and variables are mixed
lp("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$duals
## [1] 4.4 0.0 0.2 0.0 0.0
# Duals lower and upper limits
lp("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$duals.from
## [1]  2.666667e+00 -1.000000e+30  8.000000e+00 -1.000000e+30 -1.000000e+30
lp("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$duals.to
## [1] 1.6e+01 1.0e+30 4.8e+01 1.0e+30 1.0e+30

3.4 Pemograman Linier

library(lpSolve)
objective.in <- c(25, 20)
const.mat <- matrix(c(20, 12, 1/15, 1/15), nrow=2,
byrow=TRUE)
const.rhs <- c(1800, 8)
const.dir <- c("<=", "<=")
optimum <- lp(direction="max", objective.in, const.mat,
const.dir, const.rhs)
optimum$solution
## [1] 45 75
optimum$objval
## [1] 2625

3.5 Pemrograman Kuadrat

library(linprog)  # install.packages("linprog")
#> Loading required package: lpSolve

# example of Steinhauser, Langbehn and Peters (1992)
cvec <- c(1800, 600, 600)  # gross margins
names(cvec) <- c("Cows", "Bulls", "Pigs")
bvec <- c(40, 90, 2500)  # endowment
names(bvec) <- c("Land", "Stable", "Labor")
Amat <- rbind(c(0.7, 0.35, 0),
              c( 1.5, 1, 3),
              c( 50, 12.5, 20))
# run solver
res <- solveLP(cvec, bvec, Amat, maximum = TRUE)
print(res)
## 
## 
## Results of Linear Programming / Linear Optimization
## 
## Objective function (Maximum): 93600 
## 
## Iterations in phase 1: 0
## Iterations in phase 2: 2
## Solution
##       opt
## Cows   44
## Bulls  24
## Pigs    0
## 
## Basic Variables
##         opt
## Cows   44.0
## Bulls  24.0
## S Land  0.8
## 
## Constraints
##        actual dir bvec free  dual dual.reg
## Land     39.2  <=   40  0.8   0.0      0.8
## Stable   90.0  <=   90  0.0 240.0     15.0
## Labor  2500.0  <= 2500  0.0  28.8   1375.0
## 
## All Variables (including slack variables)
##           opt cvec min.c    max.c   marg marg.reg
## Cows     44.0 1800   900 2400.000     NA       NA
## Bulls    24.0  600   450 1200.000     NA       NA
## Pigs      0.0  600  -Inf 1296.000 -696.0     6.25
## S Land    0.8    0    NA  731.092    0.0       NA
## S Stable  0.0    0  -Inf  240.000 -240.0    15.00
## S Labor   0.0    0  -Inf   28.800  -28.8  1375.00

3.6 Pemograman NonLinier

f <- function(x)(print(x) - 1/3)^2
xmin <- optimize(f,
interval = c(0, 1),
tol = 0.0001)
## [1] 0.381966
## [1] 0.618034
## [1] 0.236068
## [1] 0.3333333
## [1] 0.3333
## [1] 0.3333667
## [1] 0.3333333

4 Contoh sederhana mengenai penerapan Optimasi Sains Data dalam kehidupan sehari-hari!

Optimasi diperlukan dalam berbagai bidang, diantaranya bidang ekonomi. Misalnya, penerapan sederhananya adalah optimasi digunakan untuk memaksimalkan keuntungan yang akan diraih atau meminimumkan biaya yang akan dikeluarkan oleh perusahaan.