~showard314/ubuntu/karmic/r-base/remove_start_comments

« back to all changes in this revision

Viewing changes to src/library/stats/man/optim.Rd

  • Committer: Bazaar Package Importer
  • Author(s): Dirk Eddelbuettel
  • Date: 2009-01-19 12:40:24 UTC
  • mfrom: (5.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090119124024-abxsf4e0y7713w9m
Tags: 2.8.1-2
debian/control: Add another Build-Depends: exclusion for the 
'kfreebsd-i386 kfreebsd-amd64 hurd-i386' architecture to openjdk-6-jdk.
Thanks to Petr Salinger for the heads-up.               (Closes: 512324)

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
}
41
41
\details{
42
42
  Note that arguments after \code{\dots} must be matched exactly.
43
 
  
 
43
 
44
44
  By default this function performs minimization, but it will maximize
45
45
  if \code{control$fnscale} is negative.
46
46
 
133
133
      for the \code{"Nelder-Mead"} method. \code{alpha} is the reflection
134
134
      factor (default 1.0), \code{beta} the contraction factor (0.5) and
135
135
      \code{gamma} the expansion factor (2.0).}
136
 
    \item{\code{REPORT}}{The frequency of reports for the \code{"BFGS"}
137
 
      and \code{"L-BFGS-B"} methods if \code{control$trace} is positive.
138
 
      Defaults to every 10 iterations.}
 
136
    \item{\code{REPORT}}{The frequency of reports for the \code{"BFGS"},
 
137
      \code{"L-BFGS-B"} and \code{"SANN"} methods if \code{control$trace}
 
138
      is positive. Defaults to every 10 iterations for \code{"BFGS"} and
 
139
      \code{"L-BFGS-B"}, or every 100 temperatures for \code{"SANN"}.}
139
140
    \item{\code{type}}{for the conjugate-gradients method. Takes value
140
141
      \code{1} for the Fletcher--Reeves update, \code{2} for
141
142
      Polak--Ribiere and \code{3} for Beale--Sorenson.}
157
158
  }
158
159
 
159
160
  Any names given to \code{par} will be copied to the vectors passed to
160
 
  \code{fn} and \code{gr}.
 
161
  \code{fn} and \code{gr}.  Note that no other attributes of \code{par}
 
162
  are copied over.
161
163
}
162
164
\value{
163
165
  A list with components:
267
269
res <- optim(50, fw, method="SANN",
268
270
             control=list(maxit=20000, temp=20, parscale=20))
269
271
res
270
 
## Now improve locally
 
272
## Now improve locally {typically only by a small bit}:
271
273
(r2 <- optim(res$par, fw, method="BFGS"))
272
274
points(r2$par, r2$value, pch = 8, col = "red", cex = 2)
273
275
 
293
295
sq <- c(1,2:NROW(eurodistmat),1)  # Initial sequence
294
296
distance(sq)
295
297
 
296
 
set.seed(2222) # chosen to get a good soln quickly
 
298
set.seed(123) # chosen to get a good soln relatively quickly
297
299
res <- optim(sq, distance, genseq, method="SANN",
298
 
             control = list(maxit=6000, temp=2000, trace=TRUE))
 
300
             control = list(maxit=30000, temp=2000, trace=TRUE, REPORT=500))
299
301
res  # Near optimum distance around 12842
300
302
 
301
303
loc <- cmdscale(eurodist)