source: trunk/optimizer/examples/simple.tcl @ 898

Last change on this file since 898 was 898, checked in by mmc, 16 years ago

Optimization part is getting better. Fleshed out the plug-in for
PGApack, and integrated a first cut that includes the data handling.

File size: 2.0 KB
Line 
1# ----------------------------------------------------------------------
2#  EXAMPLE:  Rappture optimization
3#
4#  This script shows the core of the Rappture optimization loop.
5#  It represents a simple skeleton of the much more complicated
6#  Rappture GUI, but it drives enough of the optimization process
7#  to drive development and testing.
8#
9#  Run this as:  tclsh simple.tcl ?-tool path/to/tool.xml?
10#
11# ======================================================================
12#  AUTHOR:  Michael McLennan, Purdue University
13#  Copyright (c) 2008  Purdue Research Foundation
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 Itcl
19package require Rappture
20package require RapptureGUI
21package require RapptureOptimizer
22
23# ----------------------------------------------------------------------
24#  Create a Tool object based on the tool.xml file...
25# ----------------------------------------------------------------------
26Rappture::getopts argv params {
27    value -tool tool.xml
28}
29
30# open the XML file containing the tool parameters
31if {![file exists $params(-tool)]} {
32    puts stderr "can't find tool \"$params(-tool)\""
33    exit 1
34}
35set xmlobj [Rappture::library $params(-tool)]
36
37set installdir [file dirname $params(-tool)]
38if {"." == $installdir} {
39    set installdir [pwd]
40}
41
42set tool [Rappture::Tool ::#auto $xmlobj $installdir]
43
44# ----------------------------------------------------------------------
45#  Create an optimization context and configure the parameters used
46#  for optimization...
47# ----------------------------------------------------------------------
48Rappture::optimizer optim -tool $tool -using pgapack
49
50optim add number input.number(temperature) -min 200 -max 400
51optim add number input.number(Ef) -min 0 -max 1.1
52optim configure -popsize 500 -maxruns 5
53
54set status [optim perform -updatecommand {puts "checking"}]
55
56puts "done: $status"
Note: See TracBrowser for help on using the repository browser.