close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Changes between Version 7 and Version 8 of OfficialTolArchiveNetworkNonLinGloOpt


Ignore:
Timestamp:
Dec 1, 2010, 1:35:58 PM (14 years ago)
Author:
Víctor de Buen Remiro
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OfficialTolArchiveNetworkNonLinGloOpt

    v7 v8  
    1818   Si una variable no tuviera cota inferior entonces sería [[LatexEquation( l_{i} = -\infty  )]] y si no tuviera cota superior entonces sería [[LatexEquation( u_{i} = \infty  )]]
    1919   A la región [[BR]] [[BR]]
    20    [[LatexEquation(\underset{i=1}{\overset{n}{\prod}}\left[l_{i},u_{i}\right] )]][[BR]] [[BR]]
     20   [[LatexEquation(\underset{i=1}{\overset{n}{\prod}}\left[l_{i},u_{i}\right] \subset\mathbb{R}^{n})]][[BR]] [[BR]]
    2121   se le llamará hiperrectángulo de búsqueda y en el caso de optimización global
    2222   deberá ser siempre acotado. [[BR]] [[BR]]
     
    150150}}}
    151151 
     152=== Definición del problema y sus características ===
     153
     154{{{
     155#!cpp
     156//Don't forget require the package if it has still no been loaded
     157#Require NonLinGloOpt;
     158
     159//Defining the problem
     160NonLinGloOpt::@Problem problem = [[
     161//Optimization method. If not specified the system will choose one
     162//by calling method select_automatic_algorithm
     163//In this case we want to use MMA (Method of Moving Asymptotes)
     164// http://ab-initio.mit.edu/wiki/index.php/NLopt_Algorithms#MMA_.28Method_of_Moving_Asymptotes.29
     165  Real id_algorithm = NonLinGloOpt::Algorithm::LD_MMA; 
     166  //We want to minimize the target function
     167  Real sign = -1;
     168  //We want just a local minimum
     169  Real neededGlobal = False;
     170  //The problem is almost twice differentiable
     171  Real id_analyticalClass =
     172    NonLinGloOpt::AnalyticalClass::TWICE_DIFFERENTIABLE;
     173  //The gradient of all functions is known
     174  Real id_useGradient = True;
     175  //Target given as simple Code
     176  Anything target = my_function;
     177  //Lower bounds
     178  Matrix lower_bounds = Col(-10,  0); //x1>=-10, x2 >= 0
     179  //Upper bounds
     180  Matrix upper_bounds = Col( 10, 10); //x1<= 10, x2 <=10
     181  //There are two non linear constraining inequations
     182  Set inequations = [[
     183   [[ineq1, ineq1::constraint]], //Inequation given by class method
     184   [[ineq2, ineq2::constraint]]  //Inequation given by class method
     185  ]];
     186  //Initial values
     187  Matrix x0 = Col(1.234, 5.678);
     188  //Stopping criteria of relative tolerance for both x and y
     189  Real relativeTolerance = 1E-4; //
     190  //Stopping criteria of maximum running time
     191  Real maxTime = 60;
     192  //Funcitons will be traced each this number of evaluations
     193  Real verboseEach = 1
     194]];
     195
     196}}}
     197
     198=== Creación y lanzamiento de la optimización ===
     199
     200{{{
     201#!cpp
     202#Require NonLinGloOpt;
     203
     204//Creating the optimizer instance
     205NonLinGloOpt::@Opt opt = problem::create_optimizer(?);
     206
     207//Running the optimization
     208Real opt::optimize_problem(problem);
     209
     210}}}
     211
    152212
    153213== Guía del programador y del usuario avanzado ==
     
    188248
    189249 
    190 
    191