Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Fortran Programming Language

Fortran source of non-linear unconstrained optimization


     Sorry,
do somebody know about free Fortran source routines for non-linear
unconstrained optimization of multivariable functions using quasi-
newton methods (conjugate gradients, some Fletcher&Powell methods etc
- i.e. any method where analytical 1st derivatives of the function are
available, but 2nd derivatives are not available) ?

Yours
Mikhail Kuzminsky
Zelinsky Institute of Organic Chemistry
Moscow

On Apr 9, 2:08 pm, "Mikhail Kuzminsky" <k@free.net> wrote:

>      Sorry,
> do somebody know about free Fortran source routines for non-linear
> unconstrained optimization of multivariable functions using quasi-
> newton methods (conjugate gradients, some Fletcher&Powell methods etc
> - i.e. any method where analytical 1st derivatives of the function are
> available, but 2nd derivatives are not available) ?

> Yours
> Mikhail Kuzminsky
> Zelinsky Institute of Organic Chemistry
> Moscow

There is a code translated by Alan Miller to Fortran 90 at
http://users.bigpond.net.au/amiller/tn.zip , described as
"Stephen Nash's truncated-Newton code for the minimization of
continuous functions. It can use differences instead of derivatives,
and bounds may be imposed on the parameters." One needs to write a
subroutine of the form

  subroutine sfun(x,f,g)
    real (dp), intent(in)   :: x(:)
    real (dp), intent(out)  :: f, g(:) ! function value and gradient
at x(:)
  end subroutine sfun

There are several other optimization codes at Mr. Miller's site -- you
can search "minmiz" or "optimiz" to find them.

Two other places to look for optimization codes are

NEOS Optimization Software
http://www-fp.mcs.anl.gov/otc/Guide/SoftwareGuide/index.html

Fortran:Source_Code:Optimization section of the Open Directory
http://dmoz.org/Computers/Programming/Languages/Fortran/Source_Code/O...

Mikhail Kuzminsky wrote:
>      Sorry,
> do somebody know about free Fortran source routines for non-linear
> unconstrained optimization of multivariable functions using quasi-
> newton methods (conjugate gradients, some Fletcher&Powell methods etc
> - i.e. any method where analytical 1st derivatives of the function are
> available, but 2nd derivatives are not available) ?

> Yours
> Mikhail Kuzminsky
> Zelinsky Institute of Organic Chemistry
> Moscow

Check out minpack.  It will do exactly what you are asking for.
On Apr 9, 4:32 pm, baf <w@nowhere.com> wrote:

> Mikhail Kuzminsky wrote:
> >      Sorry,
> > do somebody know about free Fortran source routines for non-linear
> > unconstrained optimization of multivariable functions using quasi-
> > newton methods (conjugate gradients, some Fletcher&Powell methods etc
> > - i.e. any method where analytical 1st derivatives of the function are
> > available, but 2nd derivatives are not available) ?

> > Yours
> > Mikhail Kuzminsky
> > Zelinsky Institute of Organic Chemistry
> > Moscow

> Check out minpack.  It will do exactly what you are asking for.

The Minpack README says

"Minpack includes software for solving nonlinear equations and
nonlinear least squares problems."

I think these are more specific problems than optimization of a non-
linear function.

Optimization is finding the root (solving) an equation.  In this case,
the "equation" that you are finding the root of is the first derivative
of the original equation.  However, it is true that you  you would need
the second derivatives of the function, which I now noticed that the OP
said were not available.  Therefore in this case, you are correct that
minpack would not be appropriate for the problem posed by the OP.
There is a Minpack routine:
http://www.netlib.org/minpack/hybrj1.f
or better yet, with all needed routines at:
http://bucky.stanford.edu/pubprogs/nlineq/minpack/Hybrj1.txt

This will solve non-linear equation(s) (find root(s)).

Documentation with example code  for this is at:
http://www.tu-berlin.de/zrz/software/numerik/minpack/hybrj1.txt
or
http://www.math.utah.edu/software/minpack/minpack/hybrj1.html

I recommend running Mike Metcalf's Convert on this code which
will also help structure it better; see:
ftp://ftp.numerical.rl.ac.uk/pub/MandR/convert.f90

Skip Knoble

On 9 Apr 2007 11:08:50 -0700, "Mikhail Kuzminsky" <k@free.net> wrote:

-|     Sorry,
-|do somebody know about free Fortran source routines for non-linear
-|unconstrained optimization of multivariable functions using quasi-
-|newton methods (conjugate gradients, some Fletcher&Powell methods etc
-|- i.e. any method where analytical 1st derivatives of the function are
-|available, but 2nd derivatives are not available) ?
-|
-|Yours
-|Mikhail Kuzminsky
-|Zelinsky Institute of Organic Chemistry
-|Moscow

On Apr 9, 8:08 pm, "Mikhail Kuzminsky" <k@free.net> wrote:

>      Sorry,
> do somebody know about free Fortran source routines for non-linear
> unconstrained optimization of multivariable functions using quasi-
> newton methods (conjugate gradients, some Fletcher&Powell methods etc
> - i.e. any method where analytical 1st derivatives of the function are
> available, but 2nd derivatives are not available) ?

> Yours
> Mikhail Kuzminsky
> Zelinsky Institute of Organic Chemistry
> Moscow

check out NEOS
http://www-fp.mcs.anl.gov/otc/Guide/SoftwareGuide/
and GAMS
http://gams.nist.gov/serve.cgi

for optimization software.

On Apr 9, 8:00 pm, baf <w@nowhere.com> wrote:

Many optimization problems concern non-differentiable objective
functions or functions where some arguments must be integers, for
which this statement in incorrect.

For differentiable objective functions, the gradient is zero at local
minima AND maxima. An optimization code specifies whether it searches
for the minimum or maximum. If the code searches for a minimum and one
wants to find a maximum, one changes the sign in the objective
function.

On Apr 10, 8:18 am, Herman D. Knoble <SkipKnobleL@SPAMpsu.DOT.edu>
wrote:

> There is a Minpack routine:http://www.netlib.org/minpack/hybrj1.f
> or better yet, with all needed routines at:http://bucky.stanford.edu/pubprogs/nlineq/minpack/Hybrj1.txt

> This will solve non-linear equation(s) (find root(s)).

> Documentation with example code  for this is at:http://www.tu-berlin.de/zrz/software/numerik/minpack/hybrj1.txt
> orhttp://www.math.utah.edu/software/minpack/minpack/hybrj1.html

I am not sure that Minpack is the best solution to the OP's problem --
see my replies to baf.

> I recommend running Mike Metcalf's Convert on this code which
> will also help structure it better; see:ftp://ftp.numerical.rl.ac.uk/pub/MandR/convert.f90

John Burkardt has converted MINPACK to free source form at
http://people.scs.fsu.edu/~burkardt/f_src/minpack/minpack.html . I
think some of the other codes mentioned there are more relevant to the
problem.
Hi Mikhail, at 09 Apr 07 you wrote to all:

>      Sorry,
> do somebody know about free Fortran source routines for non-linear
> unconstrained optimization of multivariable functions using quasi-
> newton methods (conjugate gradients, some Fletcher&Powell methods etc
> - i.e. any method where analytical 1st derivatives of the function are
> available, but 2nd derivatives are not available) ?

Maybe you may also use a genetic algorithm. There is the free PIKAIA code  
written in FORTRAN 77:

http://www.hao.ucar.edu/Public/models/pikaia/pikaia.html

I have never tested it, but i know peoble using this or a similar code  
with success.

cu
   Ingo

On Apr 10, 2:56 am, ingo.th@gmx.de (Ingo Thies) wrote:

> Hi Mikhail, at 09 Apr 07 you wrote to all:

> >      Sorry,
> > do somebody know about free Fortran source routines for non-linear
> > unconstrained optimization of multivariable functions using quasi-
> > newton methods (conjugate gradients, some Fletcher&Powell methods etc
> > - i.e. any method where analytical 1st derivatives of the function are
> > available, but 2nd derivatives are not available) ?

> Maybe you may also use a genetic algorithm. There is the free PIKAIA code
> written in FORTRAN 77:

> http://www.hao.ucar.edu/Public/models/pikaia/pikaia.html

There is a F90 version by Alan Miller at http://users.bigpond.net.au/amiller/
, but he describes it as "Another genetic algorithm for global
optimization without derivatives." The OP said he *can* calculate the
gradient analytically, and if so, this information should be used by
the optimizer.

A global optimizer not using derivatives will be slow (require more
function evaluations) but could be a useful check on the more
traditional optimization algorithms, which will converge to local
minima.

Btw a good newsgroup for questions on optimization algorithms is
sci.math.num-analysis.

In article <1176142130.603877.80@q75g2000hsh.googlegroups.com>,
 "Mikhail Kuzminsky" <k@free.net> wrote:

>      Sorry,
> do somebody know about free Fortran source routines for non-linear
> unconstrained optimization of multivariable functions using quasi-
> newton methods (conjugate gradients, some Fletcher&Powell methods etc
> - i.e. any method where analytical 1st derivatives of the function are
> available, but 2nd derivatives are not available) ?

Two codes that I use are LBFGS() by Norcedal and CG_DESCENT() by
Hager.  I found both codes on the web with google searches.  Both
were originally f77 style fixed-form, and I converted them to f90
free-form using one of the common tools, put them into modules, and
other related changes.

$.02 -Ron Shepard

On Apr 10, 12:02 pm, Ron Shepard <ron-shep@NOSPAM.comcast.net>
wrote:

> In article <1176142130.603877.80@q75g2000hsh.googlegroups.com>,
>  "Mikhail Kuzminsky" <k@free.net> wrote:

> >      Sorry,
> > do somebody know about free Fortran source routines for non-linear
> > unconstrained optimization of multivariable functions using quasi-
> > newton methods (conjugate gradients, some Fletcher&Powell methods etc
> > - i.e. any method where analytical 1st derivatives of the function are
> > available, but 2nd derivatives are not available) ?

> Two codes that I use are LBFGS() by Norcedal and CG_DESCENT() by
> Hager.  I found both codes on the web with google searches.  Both
> were originally f77 style fixed-form, and I converted them to f90
> free-form using one of the common tools, put them into modules, and
> other related changes.

Excuse me for being "forward", but would you be willing to post these
codes somewhere and/or email them to beliavsky at aol dot com?
In article <1176218415.197655.113@n59g2000hsh.googlegroups.com>,

I would prefer not to do this because they are not my codes.  Both
authors are still active and maintain their codes, and I have sent
my changes back to them in both cases.  I think it is best if you
get the codes from the original authors, or through netlib or
however they have chosen to distribute them.

It can be frustrating for an author to distribute a code, some dufus
changes it and distributes it separately, and then the original
author gets blamed for the mistakes of the dufus.

$.02 -Ron Shepard

On Apr 9, 4:37 pm, "Beliavsky" <beliav@aol.com> wrote:

There exists Minpack-2 ftp://info.mcs.anl.gov/pub/MINPACK-2/ , for
which the README says

"This directory contains MINPACK-2 software for
the solution of systems of nonlinear equations,
nonlinear least squares problems, and minimization problems.

The initial software development work concentrated on the
software for the solution of medium-scale problems on vector
and shared-memory architectures. A Levenberg-Marquardt method
for nonlinear least squares and a trust region Newton method
for minimization problems are currently available.
The BLAS and LAPACK routines have been used wherever possible
to enhance performance on a variety of architectures.
Current work centers on software for large-scale problems.
A variable-storage variable metric method
and a trust region Newton method are currently available.
Future work will focus on software for distributed memory
architectures."

"Herman D. Knoble" <SkipKnobleL@SPAMpsu.DOT.edu> wrote in message
news:3gvm13lq9410ukf0t1hi7u4s43tr2vdt3h@4ax.com...

> There is a Minpack routine:
> http://www.netlib.org/minpack/hybrj1.f
> or better yet, with all needed routines at:
> http://bucky.stanford.edu/pubprogs/nlineq/minpack/Hybrj1.txt

> This will solve non-linear equation(s) (find root(s)).

> Documentation with example code  for this is at:
> http://www.tu-berlin.de/zrz/software/numerik/minpack/hybrj1.txt
> or
> http://www.math.utah.edu/software/minpack/minpack/hybrj1.html

> I recommend running Mike Metcalf's Convert on this code which
> will also help structure it better; see:
> ftp://ftp.numerical.rl.ac.uk/pub/MandR/convert.f90

I'd been looking for this converter.  You have to paste it into the url to
get the source.  It compiles for me with a warning on this line:

IF(index(STAMNT(LK(L3)+1:LENST), 'FUNCTION')/= .0 .OR. &
index(STAMNT(LK(L3)+1:LENST), 'function') /= 0) GO TO 97

- Comparing floating point quantities for inequality may give misleading
results.

Otherwise, it builds.  Will the above be trouble?
--
WW

On Apr 10, 4:47 pm, "Wade Ward" <inva@invalid.net> wrote:

<snip>

> >ftp://ftp.numerical.rl.ac.uk/pub/MandR/convert.f90

> I'd been looking for this converter.  You have to paste it into the url to
> get the source.  It compiles for me with a warning on this line:

> IF(index(STAMNT(LK(L3)+1:LENST), 'FUNCTION')/= .0 .OR. &
> index(STAMNT(LK(L3)+1:LENST), 'function') /= 0) GO TO 97

> - Comparing floating point quantities for inequality may give misleading
> results.

> Otherwise, it builds.  Will the above be trouble?
> --
> WW

The INDEX function returns an integer. I think the ".0" should be
replaced by "0". It certainly makes sense, looking at the code, which
is duplicated for 'FUNCTION' and 'function'.
In article <1176239129.760421.82@30g2000cwc.googlegroups.com>,

 "Beliavsky" <beliav@aol.com> wrote:
> The INDEX function returns an integer. I think the ".0" should be
> replaced by "0". It certainly makes sense, looking at the code, which
> is duplicated for 'FUNCTION' and 'function'.

Why does it test for only two cases, upper and lower case?  There
are 8 characters, so there are 2^8=256 possibilities.  The correct
approach, of course, is to fold the case and then do a single
comparison, or otherwise do a single case-independent comparison.

$.02 -Ron Shepard

"Beliavsky" <beliav@aol.com> wrote in message

news:1176239129.760421.82270@30g2000cwc.googlegroups.com...

I think that we're looking for the logical scalar zero there, and that
causes the warning to disappear, so I would agree with removing the period
before the zero.
--
ww

"Ron Shepard" <ron-shep@NOSPAM.comcast.net> wrote in message

news:ron-shepard-2EC84A.23303510042007@comcast.dca.giganews.com...

> Why does it test for only two cases, upper and lower case?  There
> are 8 characters, so there are 2^8=256 possibilities.  The correct
> approach, of course, is to fold the case and then do a single
> comparison, or otherwise do a single case-independent comparison.

Because the program was written to handle Fortran 77 source form, which is
written in upper case (Section 3.1.1). As a help to those who, using an
*extension*, wrote code in lower case, the second alternative was
subsequently added (and documented). If you know somebody who actually has
Fortran 77 code such as FuNcTiOn RuBbIsH and requires it to be converted,
please let me know and, for a suitable fee, I will make a version along the
lines you suggest.

Regards,

Mike Metcalf

In article <W%3Th.30305$Rg2.20621@trndny02>,
 "Michael Metcalf" <michaelmetc@compuserve.com> wrote:

> "Ron Shepard" <ron-shep@NOSPAM.comcast.net> wrote in message
> news:ron-shepard-2EC84A.23303510042007@comcast.dca.giganews.com...

> > Why does it test for only two cases, upper and lower case?  There
> > are 8 characters, so there are 2^8=256 possibilities.  The correct
> > approach, of course, is to fold the case and then do a single
> > comparison, or otherwise do a single case-independent comparison.

> Because the program was written to handle Fortran 77 source form, which is
> written in upper case (Section 3.1.1). As a help to those who, using an
> *extension*, wrote code in lower case, the second alternative was
> subsequently added (and documented).

As you probably know from past discussions here in clf, I don't
agree with the above.  I think that treating upper and lower case as
distinct (as some f77 compilers did) is indeed an extension, but the
machine-dependent mapping of upper or lower case characters to the
fortran character set is not an extension.

> If you know somebody who actually has
> Fortran 77 code such as FuNcTiOn RuBbIsH and requires it to be converted,
> please let me know and, for a suitable fee, I will make a version along the
> lines you suggest.

My point was that writing a single routine to perform general
case-independent comparisons, or folding the case and doing a single
comparison, are better approaches than having the multiple tests
scattered throughout the code, particularly if those tests are
incomplete.  My 2^8 comment was meant as a joke, but there is a good
general programming principle involved here.

$.02 -Ron Shepard

"Ron Shepard" <ron-shep@NOSPAM.comcast.net> wrote in message

news:ron-shepard-938958.11091611042007@comcast.dca.giganews.com...

Perhaps you could provide me with chapter and verse on that.

>> If you know somebody who actually has
>> Fortran 77 code such as FuNcTiOn RuBbIsH and requires it to be converted,
>> please let me know and, for a suitable fee, I will make a version along
>> the
>> lines you suggest.

> My point was that writing a single routine to perform general
> case-independent comparisons, or folding the case and doing a single
> comparison, are better approaches than having the multiple tests
> scattered throughout the code, particularly if those tests are
> incomplete.  My 2^8 comment was meant as a joke, but there is a good
> general programming principle involved here.

Well, I agree. But the program wasn't written like that. As stated, it
started life dealing only with standard-conforming code. *Later*, it was
adapted to deal with lower case in the way shown. That was simply the
quickest way to solve 99.9999% of the problem at the time. No-one's ever
complained.

Regards,

Mike Metcalf

Michael Metcalf wrote:
> "Ron Shepard" <ron-shep@NOSPAM.comcast.net> wrote in message
> news:ron-shepard-938958.11091611042007@comcast.dca.giganews.com...
>> As you probably know from past discussions here in clf, I don't
>> agree with the above.  I think that treating upper and lower case as
>> distinct (as some f77 compilers did) is indeed an extension, but the
>> machine-dependent mapping of upper or lower case characters to the
>> fortran character set is not an extension.

> Perhaps you could provide me with chapter and verse on that.

Fortran 77 Standard, 1.3.2, "Exclusions":
"This standard does not specify: ... The method of transcription of
programs or their input or output data to or from a data processing
medium...."

I think this falls under the "the file on disk is a representation of
the source, not the source itself" idea that Richard Maine usually
points out in conversations about tabs in source files.  It may be
weasel-wording to claim that the processor considers an "a" in the
representation of the program on disk to be a transcription of an "A" in
the program itself (except within character constants), but it does seem
to be a valid bit of weasel-wording.  :)

- Brooks

--
The "bmoses-nospam" address is valid; no unmunging needed.

Mikhail Kuzminsky wrote:

> do somebody know about free Fortran source routines for non-linear
> unconstrained optimization of multivariable functions using quasi-
> newton methods (conjugate gradients, some Fletcher&Powell methods etc
> - i.e. any method where analytical 1st derivatives of the function are
> available, but 2nd derivatives are not available) ?

Others have pointed to a fish or two, here's to show you how to fish.
Start your expedition at,

        http://gams.nist.gov

by stepping through a problem classification tree that will identify
solver[s] for your specific requirements. Note that *gams* is a general
guide for the netlib software, whereas

        http://plato.asu.edu/guide.html

is optimization specific and lists non netlib resources as well. If
you're looking for some heavy hitters then "tensolve" and "varpro" (both
on netlib) are probably your prime choices.

---
sdx - modeling, simulation.
http://www.sdynamix.com

In article <461D28A0.6010@cits1.stanford.edu>,
 Brooks Moses <bmoses-nos@cits1.stanford.edu> wrote:

I don't think "weasel-wording" is the point.  All of the mappings
from various media (card images, tape files, floppy files, disk
files, network files, various file formats, etc.), using various
fonts and machine-dependent character sets, lines less than 72
characters, etc. to the abstract fortran form specified in the
standard is itself outside of the fortran standard.  That is what
"transcription" means in 1.3.2.  Even the mapping of an upper case
"A" in the machine character set to the abstract upper case "A" in
the fortran standard is part of this transcription -- an obvious one
perhaps, but it is a transcription nonetheless.

Said a different way, if your text editor happens to switch upper
and lower case when it displays text, it does not suddenly make your
fortran program illegal.  If your data transfer program switches
between ascii and ebcdic, it does not suddenly make your fortran
program illegal.  And so on.  These things are outside of the
standard, simple as that.

Regarding character case, if a fortran compiler treats upper and
lower case as distinct, then that extended character set is an
extension of the f77 standard.  I know some f77 compilers that did
this.  But if a compiler uses a many-to-one mapping of upper and
lower case characters to the fortran character set, then this is
part of the transcription process that is specifically not covered
by the standard.  Most f77 compilers did this kind of many-to-one
mapping.  It would also be standard conforming to map only the upper
case characters and report errors for lower-case characters, just as
it would be standard conforming to map only the lower-case
characters and report errors for upper case.  I don't now of any
fortran compilers that did this (maybe an IBM mainframe compiler?),
but that is again part of the transcription process that is not
specified by the standard itself.

I used a compiler once that required the 8th bit to always be set in
each character.  The text editor and printer on that machine could
not tell the difference between characters with that bit set and
those without that bit set.  If you imported code (from tape or over
the net) that did not have that bit set, then the compiler would
generate errors for code that "appeared" to be correct.  However, as
far as I was concerned, the compiler itself was standard conforming
(well, in this respect at least), and the transcription problem was
a quality-of-implementation issue.  There was a "force8" utility
that would fix the source code so that it would compile.

This transcription issue has been discussed dozens of times here
over the past 14 years since I've been following clf.  It has been a
while, I didn't think any of this was even controversial any more.

$.02 -Ron Shepard

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc