library(mosaicCalc)
## Loading required package: mosaic
## Registered S3 method overwritten by 'mosaic':
## method from
## fortify.SpatialPolygonsDataFrame ggplot2
##
## The 'mosaic' package masks several functions from core packages in order to add
## additional features. The original behavior of these functions should not be affected by this.
##
## Attaching package: 'mosaic'
## The following objects are masked from 'package:dplyr':
##
## count, do, tally
## The following object is masked from 'package:Matrix':
##
## mean
## The following object is masked from 'package:ggplot2':
##
## stat
## The following objects are masked from 'package:stats':
##
## binom.test, cor, cor.test, cov, fivenum, IQR, median, prop.test,
## quantile, sd, t.test, var
## The following objects are masked from 'package:base':
##
## max, mean, min, prod, range, sample, sum
## Loading required package: mosaicCore
##
## Attaching package: 'mosaicCore'
## The following objects are masked from 'package:dplyr':
##
## count, tally
## The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
## which was just loaded, will retire in October 2023.
## Please refer to R-spatial evolution reports for details, especially
## https://r-spatial.org/r/2023/05/15/evolution4.html.
## It may be desirable to make the sf package available;
## package maintainers should consider adding sf to Suggests:.
## The sp package is now running under evolution status 2
## (status 2 uses the sf package in place of rgdal)
##
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
##
## D
library(mosaic)
Optimasi merupakan suatu proses untuk mencari kondisi yang optimum, dalam arti paling menguntungkan. Optimasi bisa berupa maksimasi atau minimasi. Jika berkaitan dengan masalah keuntungan, maka keadaan optimum adalah keadaan yang memberikan keuntungan maksimum (maksimasi). Jika berkaitan dengan masalah pengeluaran atau pengorbanan, maka keadaan optimum adalah keadaan yang memberikan pengeluaran/pengorbanan minimum (minimasi).
Hal-hal penting dalam studi optimasi meliputi:
1 - fungsi objektif dan decision variables
2 - kendala (constraints)
Secara umum, fungsi yang akan dimaksimumkan atau diminimumkan disebut fungsi objektif (objective function), sedangkan harga-harga yang berpengaruh dan bisa dipilih disebut variabel (perubah) atau decision variable.
Secara analitik, nilai maksimum atau minimum dari suatu persamaan: y = f(x) dapat diperoleh pada harga x yang memenuhi:
y’ = f(x) = dy/dx = df/dx = 0
Untuk fungsi yang sulit untuk diturunkan atau mempunyai turunan yang sulit dicari akarnya, proses optimasi dapat dilakukan secara numerik.
Ilustrasi secara Grafik
Contoh maksimum dan minimum:
Mencari nilai maksimum lokal dari f(x)= sin (5x) + cos (2x) + sin (3*x)
Gunakan metode analitik dan grafis untuk menunjukkan fungsi tersebut memiliki nilai minimum x.
f <- function(x) sin (5*x) + cos (2*x) + sin (3*x)
curve(f, from = -2, to = 0.25* pi)
Nilai maksimum lokal dari f(x)= sin (5x) + cos (2x) + sin (3*x) adalah (-1, 0,5).
Beberapa istilah:
• Maksimum lokal, maksimum global
Nilai maksimum global merupakan yang terbesar di antara nilai-nilai maksimum lokal.
• Minimum lokal, minimum global
Nilai minimum global merupakan yang terkecil di antara nilai-nilai minimum lokal.