source: trunk/packages/optimizer/examples/rosenbrock.tcl @ 6716

Last change on this file since 6716 was 3177, checked in by mmc, 12 years ago

Updated all of the copyright notices to reference the transfer to
the new HUBzero Foundation, LLC.

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1# ----------------------------------------------------------------------
2#  EXAMPLE: Optimization of the Rosenbrock function
3#
4#  This tool is a good example for optimization.  It implements the
5#  Rosenbrock function:
6#
7#    f(x1,x2) = 100(x2 - x1**2)**2 + (1-x1)**2
8#
9#  This has a minimum at (x1,x2) = (1,1).
10#
11# ======================================================================
12#  AUTHOR:  Michael McLennan, Purdue University
13#  Copyright (c) 2004-2012  HUBzero Foundation, LLC
14#
15#  See the file "license.terms" for information on usage and
16#  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
17# ======================================================================
18package require Rappture
19
20# open the XML file containing the run parameters
21set driver [Rappture::library [lindex $argv 0]]
22
23set x1 [$driver get input.(x1).current]
24set x2 [$driver get input.(x2).current]
25
26set f [expr {100*($x2-$x1*$x1)*($x2-$x1*$x1) + (1-$x1)*(1-$x1)}]
27
28$driver put output.number(f).about.label "Rosenbrock function"
29$driver put output.number(f).about.description \
30    "f(x1,x2) = 100(x2 - x1**2)**2 + (1-x1)**2"
31$driver put output.number(f).current $f
32
33# save the updated XML describing the run...
34Rappture::result $driver
35exit 0
Note: See TracBrowser for help on using the repository browser.