Commit 849048d9 authored by john's avatar john
Browse files

fixup 20200915

parent c1a2e13f
File added
require(mize)
?mize
citation("mize")
require(funconstrain)
?funconstrain
exrosen <- ex_rosen()
exrosen
exrosenf <- exrosen$fn
exrosenf
knitr::opts_chunk$set(echo = TRUE)
require(funconstrain)
exrosen <- ex_rosen()
exrosenf <- exrosen$fn
exroseng <- exrosen$gr
x0 <- exrosen$x0
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
ersol <- opm(x0, exrosenf, exroseng, method=meths)
print(x0)
for (n in seq(2,12, by=2)) {
cat("ex_rosen try for n=",n,"\n")
x0 <- exrosen$x0
print(x0)
erfg <- opm(x0, exrosenf, exroseng, method=meths)
print(summary(erfg, par.select=1:2))
}
for (n in seq(2,12, by=2)) {
cat("ex_rosen try for n=",n,"\n")
x0 <- exrosen$x0
print(x0)
erfg <- opm(x0, exrosenf, exroseng, method=meths)
print(summary(erfg, par.select=1:2))
}
## for (n in seq(2,12, by=2)) {
n <- 4
cat("ex_rosen try for n=",n,"\n")
x0 <- exrosen$x0
print(x0)
## for (n in seq(2,12, by=2)) {
n <- 4
cat("ex_rosen try for n=",n,"\n")
x0 <- exrosen$x0(n)
print(x0)
for (n in seq(2,12, by=2)) {
cat("ex_rosen try for n=",n,"\n")
x0 <- exrosen$x0(n)
print(x0)
erfg <- opm(x0, exrosenf, exroseng, method=meths)
print(summary(erfg, par.select=1:2))
}
require(funconstrain)
helval <- helical()
hvf <- helval$fn
hvg <- helval$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
n <- 3
cat("Helical valley: n=",n,"\n")
x0 <- helval$x0()
x0 <- helval$x0(3)
helval
x0 <- helval$x0
print(x0)
hvfg <- opm(x0, hvf, hvg, method=meths)
print(summary(hvfg, par.select=1:2))
hvfg
require(funconstrain)
pbs <- powell_bs()
pbsf <- pbs$fn
pbsg <- pbs$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
cat("Powell Badly Scaled function (n=2)\n")
x0 <- pbs$x0
print(x0)
pbsfg <- opm(x0, pbsf, pbsg, method=meths)
print(summary(pbsfg, par.select=1:2))
pbsfgs <- opm(x0, pbsf, pbsg, method=meths, control=list(parscale=c(1000,1)))
print(summary(pbsfgs, par.select=1:2))
pbsfgs2 <- opm(x0, pbsf, pbsg, method=meths, control=list(parscale=c(1, 1000)))
print(summary(pbsfgs2, par.select=1:2))
## then roughly as results
pbsfgs3 <- opm(x0, pbsf, pbsg, method=meths, control=list(parscale=c(1E-5, 10)))
print(summary(pbsfgs3, par.select=1:2))
pbsfg
## and a different version of pbsfgs2
pbsfgs4 <- opm(x0, pbsf, pbsg, method=meths, control=list(parscale=c(1E-3, 1)))
print(summary(pbsfgs4, par.select=1:2))
pbsfgs <- opm(x0, pbsf, pbsg, method=meths, control=list(parscale=c(1000,1)))
pbgfgs2
pbsfgs2
pbsfgs4
require(funconstrain)
fr <- freud_roth()
frf <- fr$fn
frg <- fr$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
n <- 3
cat("Freudenstein and Roth: n=",2,"\n")
x0 <- fr$x0
print(x0)
frfg <- opm(x0, hvf, hvg, method=meths)
print(summary(frfg, par.select=1:2))
cat("Freudenstein and Roth: n=",2,"\n")
x0 <- fr$x0
print(x0)
frfg <- opm(x0, hvf, hvg, method=meths)
frfg <- opm(x0, frf, frg, method=meths)
print(summary(frfg, par.select=1:2))
require(funconstrain)
br <- brown_bs() ## Gotta love that name!
brf <- br$fn
brg <- br$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
cat("Brown Badly Scaled: n=",2,"\n")
x0 <- br$x0
brfg <- opm(x0, brf, brg, method=meths)
print(summary(brfg, par.select=1:2))
require(funconstrain)
bl <- beale()
blg <- bl$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
cat("Beale: n=",2,"\n")
x0 <- bl$x0
print(x0)
blfg <- opm(x0, blf, blg, method=meths)
print(summary(blfg, par.select=1:2))
bl <- beale()
blf <- bl$fn
blg <- bl$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
cat("Beale: n=",2,"\n")
x0 <- bl$x0
print(x0)
blfg <- opm(x0, blf, blg, method=meths)
print(summary(blfg, par.select=1:2))
require(funconstrain)
js <- jenn_samp()
jsf <- js$fn
jsg <- js$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
cat("Jennrich and Sampson: n=",2,"\n")
x0 <- js$x0
print(x0)
jsfg <- opm(x0, jsf, jsg, method=meths)
print(summary(jsfg, par.select=1:2))
require(funconstrain)
ba <- bard()
baf <- ba$fn
bag <- ba$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
cat("Bard: n=",3,"\n")
x0 <- ba$x0
print(x0)
bafg <- opm(x0, baf, bag, method=meths)
print(summary(bafg, par.select=1:2))
require(funconstrain)
ga <- gauss()
gaf <- ga$fn
gag <- ga$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
cat("Gauss: n=",3,"\n")
x0 <- ga$x0
print(x0)
gafg <- opm(x0, gaf, gag, method=meths)
print(summary(gafg, par.select=1:2))
require(funconstrain)
me <- meyer()
mef <- me$fn
meg <- me$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
x0 <- me$x0
cat("Meyer: n=",length(x0),"\n")
print(x0)
print(summary(mefg, par.select=1:2))
mefg <- opm(x0, mef, meg, method=meths)
print(summary(mefg, par.select=1:2))
require(funconstrain)
gu <- gulf(m = 99)
guf <- gu$fn
gug <- gu$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
x0 <- gu$x0
cat("Gulf: n=",length(x0),"\n")
print(x0)
gufg <- opm(x0, guf, gug, method=meths)
print(summary(gufg, par.select=1:2))
require(funconstrain)
b3 <- box_3d(m = 20)
b3f <- b3$fn
b3g <- b3$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
x0 <- b3$x0
cat("Box 3D: n=",length(x0),"\n")
print(x0)
b3fg <- opm(x0, b3f, b3g, method=meths)
print(summary(b3fg, par.select=1:2))
require(funconstrain)
ps <- powell_s()
psf <- ps$fn
psg <- ps$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
x0 <- ps$x0
cat("Powell Singular: n=",length(x0),"\n")
print(x0)
psfg <- opm(x0, psf, psg, method=meths)
print(summary(psfg, par.select=1:2))
require(funconstrain)
wo <- wood()
wof <- wo$fn
wog <- wo$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
x0 <- wo$x0
cat("Wood 4 parameter: n=",length(x0),"\n")
print(x0)
wofg <- opm(x0, wof, wog, method=meths)
print(summary(wofg, par.select=1:2))
require(funconstrain)
ko <- kow_osb()
kof <- ko$fn
kog <- ko$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
x0 <- ko$x0
cat("Powell Singular: n=",length(x0),"\n")
print(x0)
kofg <- opm(x0, kof, kog, method=meths)
print(summary(kofg, par.select=1:2))
require(funconstrain)
o1 <- osborne_1()
o1f <- o1$fn
o1g <- o1$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
x0 <- o1$x0
cat("Osborne 1: n=",length(x0),"\n")
print(x0)
o1fg <- opm(x0, o1f, o1g, method=meths)
print(summary(o1fg, par.select=1:2))
require(funconstrain)
be6 <- biggs_exp6()
be6f <- be6$fn
be6g <- be6$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
x0 <- be6$x0
cat("Powell Singular: n=",length(x0),"\n")
print(x0)
be6fg <- opm(x0, be6f, be6g, method=meths)
print(summary(be6fg, par.select=1:2))
be6 <- biggs_exp6(m = 13)
be6f <- be6$fn
be6g <- be6$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
x0 <- be6$x0
cat("Powell Singular: n=",length(x0),"\n")
print(x0)
be6fg <- opm(x0, be6f, be6g, method=meths)
require(funconstrain)
o2 <- powell_s()
o2f <- o2$fn
o2g <- o2$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
x0 <- o2$x0
cat("Osborne 2: n=",length(x0),"\n")
print(x0)
o2fg <- opm(x0, o2f, o2g, method=meths)
print(summary(o2fg, par.select=1:2))
?Rvmmin
?optimx
?optimr
?opm
require(funconstrain)
pen1 <- penalty_1()
pen1f <- pen1$fn
pen1g <- pen1$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
for (n in seq(2,12, by=2)) {
x0 <- pen1$x0(n)
cat("Penalty 1: n=",length(x0),"\n")
print(x0)
pen1fg <- opm(x0, pen1f, pen1g, method=meths)
print(summary(pen1fg, par.select=1:2))
}
for (n in seq(6,6, by=2)) {
x0 <- pen1$x0(n)
cat("Penalty 1: n=",length(x0),"\n")
print(x0)
pen1fg <- opm(x0, pen1f, pen1g, method=meths)
print(summary(pen1fg, par.select=1:2))
}
require(funconstrain)
xpo <- ex_powell()
xpof <- xpo$fn
xpog <- xpo$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
x0 <- xpo$x0
cat("Powell Singular: n=",length(x0),"\n")
print(x0)
require(optimx)
x0 <- xpo$x0(12)
cat("Powell Singular: n=",length(x0),"\n")
print(x0)
xpofg <- opm(x0, xpof, xpog, method=meths)
print(summary(xpofg, par.select=1:2))
require(funconstrain)
pen1 <- penalty_1()
pen1f <- pen1$fn
pen1g <- pen1$gr
meths <- c("BFGS", "Rvmmin", "ucminf")
require(optimx)
## for (n in seq(6,6, by=2)) {
x0 <- pen1$x0(n)
n<-6
## for (n in seq(6,6, by=2)) {
x0 <- pen1$x0(n)
cat("Penalty 1: n=",length(x0),"\n")
print(x0)
pen1fg <- opm(x0, pen1f, pen1g, method=meths)
x0
pen1f(x0)
pen1g(x0)
t1 <- optimr(x0, pen1f, pen1g, method="Rvmmin", control=list(trace=1))
t1 <- optimr(x0, pen1f, pen1g, method="BFGS", control=list(trace=1))
t1 <- optimr(x0, pen1f, pen1g, method="ucminf", control=list(trace=1))
tt <- opm(x0, pen1f, pen1g, method=meths, control=list(trace=1))
tt <- opm(x0, pen1f, pen1g, method=meths, control=list(trace=1, kkt=FALSE))
tt
## n<-6
for (n in seq(2,12, by=2)) {
x0 <- pen1$x0(n)
cat("Penalty 1: n=",length(x0),"\n")
print(x0)
pen1fg <- opm(x0, pen1f, pen1g, method=meths, control=list(kkt=FALSE))
print(summary(pen1fg, par.select=1:2))
}
require(optimx)
?opm
?Rvmmin
This diff is collapsed.
This diff is collapsed.
R Consortium
Submit a Proposal
Primary Contact (Required) John C. Nash
Company/Affiliation (Required) Retired Professor, Telfer School of Management, University of Ottawa
Contact Email (Required) nashjc@uottawa.ca
Contact Phone (Required) 613 831 1656
Title of Project (Required) histoRicalg -- Preserving and Transfering Algorithmic Knowledge
Funding Requested (Required) $10000
Short Description of Project (Required)
histoRicalg aims to preserve knowledge concerning algorithms used in R, particularly the older
methods expressed in programming languages that are now less used. Specifically, we wish
- To establish a "Working Group on Algorithms Used in R"
to develop a list of target issues and to provide for ongoing
assessment of R's needs for numerical infrastructure.
- To select a small team of older and younger workers, likely one of each, to perform a
prototype exercise in documenting one or more target methods, developing a reference implementation
in R, and reporting on the process. could carry forward the actual work
- From the above, to recommend future steps to preserve knowledge in the R family.
Additional Comments (Required)
The ideas in the proposal have been discussed with a number of experienced R users and developers.
The author of the proposal has been involved in mathematical software for half a century and some
of his contributions are in base R as well as packages. A full resume can be provided on request.
WG-Procedures
2018-6-27 JN
Procedures for the
Working Group on Algorithms Used in R
1) Membership
John Nash (JN), "owner" of https://gitlab.com/nashjc/histoRicalg accepts
requests on Gitlab. Members are those listed as "Contributors" to the project.
If JN has any reservation, he will poll the active WG members.
Voting: Voting (i.e., "active") members are those who have added their initials,
name and brief bio to the file WG-Voting-Members.
Removal of members: Should this be necessary -- hopefully never --
it will be by vote of 3/4 or more of voting members.
2) Meetings
The active members may decide by consensus how meetings will be held. Note
that there is a mail list rconsortium-project-histoRicalg@lists.r-consortium.org.
It is not necessary to be a WG member to subscribe to this. Conversely, so
WG members can be alerted to developments, they need to subscribe.
Voting will depend on how "meetings" are held. JN will announce the channel
and timing based as much as possible on consensus of the group.
Existing channels:
- by editing a file in the repository or wiki (which is a git repository)
- Slack: We have reserved https://historicalg.slack.com/ thanks to Chris
Park. "Meetings" on slack are fairly simple text chats.
Suggested possibilies are Google Hangouts or Zoom or Skype.
3) Money
R Consortium has granted $4000 for 2018-19. In the proposal
https://gitlab.com/nashjc/histoRicalg/blob/master/historicalg.pdf
there are suggestions of expenditures for communications/meetings and for
stipends to junior workers for specific tasks.
Main principles:
- Members should not be out of pocket for working on histoRicalg
- Money should be spent as if out of own pockets
- Work we ASK to be done should be rewarded, if only modestly.
Process:
- Action items will be "discussed" for a reasonable period of time in a "meeting".
- Money can be allocated by at least 2/3 vote of those involved in discussion as
long as at least 3 positive votes. Preferably, "none opposed" will be preferred.
- Invoices go to ap@r-consortium.org (JN180620. This corrects previous lack
of information.)
4) Issues
Any member may suggest an issue to be considered. It is to be hoped that there
will be comments and discussion.
Periodic review of the list of issues should be conducted by the WG to decide
the priority order. Frequency suggested: Quarterly (dates to be decided).
ReadMe.WG -- the Readme file for the Working Group
This directory is to record deliberations and actions of the
Working Group on Algorithms Used in R
WG-Draft-Procedures
2018-6-6 JN
This is an attempt to suggest some working procedures for the
Working Group on Algorithms Used in R
You may add comments. Please use initials and date to preface them, e.g.,
JN180606 I would like to add ...
1) Membership
Interim procedure: JN ("owner" of https://gitlab.com/nashjc/histoRicalg) accepts
requests on Gitlab. Members are those listed as "Contributors" to the project.
Voting: Voting (i.e., "active") members are those who have added their initials,
name and brief bio to the file WG-Voting-Members.
Removal: (Hopefully never, but JN has experienced one such unfortunate
situation on a similar project where a member was very disruptive)
- by vote of 3/4 or more of voting members
+CP
+KOH
+AA
2) Voting will depend on how "meetings" are held.
a) Slack: We have reserved https://historicalg.slack.com/ thanks to Chris
Park. "Meetings" on slack are fairly simple text chats. I've several years'
experience with them. Rather different from voice meetings, but it is fairly
easy to capture the discussion into a text file so minute-taking is kept
simple. BUT -- needs everyone online at same time.
OD180613: Invites will need to be sent before the rest can join Slack.
CP180615: I just sent out the invite link via the mailing list.
b) Text files in this space e.g., the present file. Participants add
comments, but we need them to use initials and a timestamp if we are to
keep the timeline and discussion coherent. Can possibly be disrupted if
someone edits a lot without attribution, though we could use the git log
to track (it would be extra work). I have done this with a wiki quite
successfully in developing a submission to a government agency by a
committee that was geographically dispersed across N America (Scottsdale,
Vancouver, Ottawa, Halifax).
c) other ideas?
AA180612: Would it be valuable for one or two of the first meetings to
AA180612: use some form of internet-based web conferencing? Is that an
AA180612: appropriate use of the budget if we cannot find a free
AA180612: provider?
OD180613: Google Hangouts is popular with students and is free with the
OD180613: exception of requiring a Google Account one alternative is
OD180613: Zoom which is free and needs no registration but for groups >3 they
OD180613: use a 40-minute meeting time limit, then we need to restart.
CP180615: As John mentioned above, this might be a bit tricky due to the
CP180615: time difference? What about Slack?
+CP
+KOH
+AA
3) Money
R Consortium has granted $4000 for 2018-19. In the proposal
https://gitlab.com/nashjc/histoRicalg/blob/master/historicalg.pdf
there are suggestions of expenditures for communications/meetings and for
stipends to junior workers for specific tasks.
Main principles:
- Members should not be out of pocket for working on histoRicalg
- Money should be spent as if out of own pockets
- Work we ASK to be done should be rewarded, if only modestly.
Suggested process:
- Action items "discussed" for a reasonable period of time in a "meeting".
- Money can be allocated by at least 2/3 vote of those involved in discussion as
long as at least 3 positive votes.
- Ideally we will have consensus and not need any vote, so "Opposed:" having
no vote will be preferred.
- Invoices go to ap@r-consortium.org (JN180620. This corrects previous lack
of information.)
OD180613: This is a distant issue but I am hoping to have Dr. Nash here to
OD180613: Halifax as a Visiting Scholar.
+CP
+KOH
+AA
4) Issues
Any member may suggest an issue to be considered. It is to be hoped that there
will be comments and discussion.
Periodic review of the list of issues should be conducted by the WG to decide
the priority order. Frequency suggested: Quarterly (dates?)
OD180613: One issue I have is regarding the IP of the algorithms and supporting
OD180613: documents, seems like the ACM algos are IP-free, there is a process for
OD180613: requesting use from the ACM for content like the original publication
OD180613: would that be something worth looking into?
OD180613: I'm interested to see what format will be agreed upon for documenting
OD180613: each of the algorithms. I've created several directories in
OD180613: /nummeths (with the exception of RayleighQuotent which is the
OD180613: work of Dr. John Nash). The most developed is the one for QuandI the
OD180613: others were tests to see what is involved. Getting .bib content is the
OD180613: trickiest as far as an automated script would be concerned. I like the