⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gui_xmldoc.html.svn-base

📁 OPT++
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
Application Interface Code</a> section.  The "Problem Setup" panel foran application-based problem is shown below.<IMG src="../images/maui_application.png" ALIGN=center><BR>For both the subroutine and the application interfaces, you arerequired to provide information about the variables and theconstraints on the tabbed panels on the lower half of the "ProblemSetup" panel.  You must enter the number of variables and constraintswhere requested.  To add a variable/constraint, click on the "Add"button; to edit, double click on the label of the variable/constraintyou wish to edit; to remove a variable/constraint, highlight its labeland click on the "Remove" button.  For each variable, you must providea label.  If you are using the application interface, this label mustbe the same as the corresponding keyword in the templated applicationinput deck.  You may provide an initial value or retain the default ofzero.  You may also provide bounds on the variable if there are any.The linear constraints are linear constraints on the control(optimization) variables only.  Linear constraints and bounds on statevariables are treated as nonlinear constraints.  The label for thelinear constraints can be anything you like, though we recommend thatit be descriptive of the phenomenon it is describing.  You will alsoneed to add the list of variables and corresponding coefficients inthe linear expression (only for those variables with non-zerocoefficients).  Choose the comparison operator and provide theright-hand side if it is non-zero.  The nonlinear constraint editorlooks very similar to the "Problem Setup" panel, so we will notdiscuss it here.  Below is a figure that shows the variable and linearconstraint editors with example entries.<IMG src="../images/maui_arrays.png" ALIGN=center><BR>Now that your problem description is complete, it is now time tochoose an algorithm.\section algorithm Setting up the AlgorithmTo set up the algorithm you will use to solve your optimizationproblem, click on the "Optimization Algorithm" Panel.  As you can seein the figure below, there is a choice of algorithms.  There is anonlinear interior-point method (the default), a parallel directsearch method, and the classic Newton and CG methods.  There are a fewbasic algorithmic parameters that are associated with all algorithms.The meaning of these parameters is fairly straightforward.  Inaddition, most of the algorithms have some algorithm-specificparameters.  All parameters are set to default values that should befairly reasonable for many problems.  Where appropriate, the helpmessages provide some guidance for how to set these parameters if youchoose to change their values.<IMG src="../images/maui_nips.png">In addition the basic parameters, there are some advanced algorithmicparameters that are associated with all of the algorithms, as shownbelow.  These are more complex parameters whose meanings are not asstraightforward as those of the basic parameters.  They are eachassigned default values, and guidance for setting their values isprovided in the help messages where appropriate.<IMG src="../images/maui_advanced.png" ALIGN=center> <br>Once you have set up the problem, chosen the algorithm, and set anydesired parameters, you are ready to save the information from the GUIto an XML file, {filename}.xml, and solve the optimization problem byexecuting the following command:   \verbatim      opt++.e {filename}.xml   \endverbatim   OR   \verbatim      mpirun -np {number of procs} opt++.e {name of XML file}, <br>      if you are using MPI.   \endverbatim\section code Code You Need to Provide<a name="subroutine"><em> Subroutine Interface </em></a>The subroutine interface is quite similar to the problem set-updefined in the <a href="SetUp.html"> Setting up and Solving anOptimization Problem</a> section.  There are a few exceptions,however.  First, you do not need to provide a main routine.  Next, theinitialization of the optimization variables does not need to be donein the initialization subroutine.  Both of these are now done for you,based on the information you provide in the GUI/XML interface.Finally, the initialization and function subroutines must be containedin a dynamically loadable library.  Documented code and detailedinstructions on building the library can be found in the following twoexamples.<ul>  <li> \ref subroutine1  <li> \ref subroutine2</ul><a name="application"><em> Application Interface </em></a>For the application interface, the code varies according to theapplication.  What you need to provide is an executable (compiled orscript) whose final result will be a file named "fvalue.out"("convalue.out" in the case of a nonlinear constraint) that contains asingle number...the function value.  OPT++ does not care aboutanything else that happens in between.  The most important thing is toensure that the directory structure is correct and that the files arelocated in the right place.First you must create a directory to hold all of the modelinformation.  In our case, we will create the directory "TooMuchFun"in our home directory.  We will then create a subdirectory,"makecopies".  (The subdirectory must be named "makecopies".)<ul>   <li> mkdir TooMuchFun <br>   <li> cd TooMuchFun <br>   <li> mkdir makecopies</ul>In the application directory, you must place any user-created filesthat are needed by the application.  This includes things like meshfiles and any executables that are not in your path or for which youhave not listed the full path in the OPT++ input.  In our case, wewill put rosen.e in the TooMuchFun directory.  This is our applicationexecutable, we did not include the path in the OPT++ input, and itcannot be accessed given our current path.  We also recomment puttingthe XML input file for OPT++ in this directory, but it is notnecessary.In the "makecopies", you must place the templated input deck and anyother application files that will be modified by the applicationduring the execution of the application.  In this case, ourapplication input deck is named "rosen.in", so we will place"rosen.in.Tmplt" in "makecopies".  (The templated input file must havea file extension of ".Tmplt".)  This templated input deck has keywordsplaced in the locations where the values of the optimization variablesshould appear.  For this very simple case, our templated input decklooks like the following:   \verbatim   var1 = OPT_x1    var2 = OPT_x2   \endverbatimOPT_x1 and OPT_x2 are the keywords associated with the optimizationvariables.The most common mistakes are to forget a file, to misname it, or toput it in the wrong location.  So if you have trouble getting thingsto work and you can't find the problem elsewhere, be sure that yourapplication directories are set up correctly.\section xml Creating an XML Input File Without the GUIIf you would like to create an XML input file for OPT++ but cannot orchoose not to use the GUI, we describe the form of that file here.Please be aware that you still have build OPT++ as described in<a href="InstallDoc.html#gui"> Configuring for use with the new (beta)GUI/XML Interface</a> section of the <a href="InstallDoc.html">Installation Documentation</a>.  Also, should you decide to use theGUI at some later time, we currently cannot guarantee it will readfiles you construct in this way.  (It is on the to-do list...)  Youcan find many examples in the OPT++/tests/xml directory.  Note thatthose examples were created using the GUI, so they have someadditional things, like comments, that are not required by OPT++.  Weshow the XML files for the examples in the \ref code section.<ul>  <li> \ref xml1  <li> \ref xml2  <li> \ref xml3</ul><p> Previous Section:  \ref SetUp | Next Section:  \ref Classification| Back to the <a href="index.html"> Main Page</a> </p>Last revised <em> July 25, 2006</em>*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -