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 17 and Version 18 of OfficialTolArchiveNetworkNonLinGloOpt


Ignore:
Timestamp:
Jan 4, 2011, 2:25:38 PM (14 years ago)
Author:
Víctor de Buen Remiro
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OfficialTolArchiveNetworkNonLinGloOpt

    v17 v18  
    241241
    242242
    243 [[Image(source:/tolp/OfficialTolArchiveNetwork/NonLinGloOpt/doc/opt_methods.png)]]
    244 
    245243== Tutorial ==
    246244
     
    335333}}}
    336334 
    337 === Definición del problema y sus características ===
     335=== Creación y lanzamiento de la optimización ===
    338336
    339337{{{
     
    342340#Require NonLinGloOpt;
    343341
    344 //Defining the problem
    345 NonLinGloOpt::@Problem problem = [[
    346 //Optimization method. If not specified the system will choose one
    347 //by calling method select_automatic_algorithm
    348 //In this case we want to use MMA (Method of Moving Asymptotes)
    349 // http://ab-initio.mit.edu/wiki/index.php/NLopt_Algorithms#MMA_.28Method_of_Moving_Asymptotes.29
    350   Real id_algorithm = NonLinGloOpt::Algorithm::LD_MMA; 
    351   //We want to minimize the target function
    352   Real sign = -1;
    353   //We want just a local minimum
    354   Real neededGlobal = False;
    355   //The problem is almost twice differentiable
    356   Real id_analyticalClass =
    357     NonLinGloOpt::AnalyticalClass::TWICE_DIFFERENTIABLE;
    358   //The gradient of all functions is known
    359   Real id_useGradient = True;
    360   //Target given as simple Code
    361   Anything target = my_function;
    362   //Lower bounds
    363   Matrix lower_bounds = Col(-1/0,  0); // -x2 <= 0
    364   //No upper bounds. You can skip next line
    365   Matrix upper_bounds = Col( 1/0, 1/0);
    366   //There are two non linear constraining inequations
    367   Set inequations = [[
    368    [[ineq1, ineq1::constraint]], //Inequation given by class method
    369    [[ineq2, ineq2::constraint]]  //Inequation given by class method
    370   ]];
    371   //Initial values
    372   Matrix x0 = Col(1.234, 5.678);
    373   //Stopping criteria of relative tolerance for both x and y
    374   Real relativeTolerance = 1E-4; //
    375   //Stopping criteria of maximum running time
    376   Real maxTime = 60;
    377   //Functions will be traced every "verboseEach" evaluations
    378   Real verboseEach = 1
     342NonLinGloOpt::@PipeLine pipe_line = [[
     343  //Defining the problem
     344  Set problems = [[ NonLinGloOpt::@Problem problem = [[
     345    //We want to minimize the target function
     346    Real sign = -1;
     347    //We want just a local minimum
     348    Real neededGlobal = False;
     349    //The problem is almost twice differentiable
     350    Real id_analyticalClass =
     351      NonLinGloOpt::AnalyticalClass::TWICE_DIFFERENTIABLE;
     352    //The gradient of all functions is known
     353    Real id_useGradient = True;
     354    //Problem dimension
     355    Real n = 2;
     356    //Target given as simple Code
     357    Anything target = my_function;
     358    //Lower bounds
     359    Matrix lower_bounds = Col(-10,  0); //x1>=-10, x2 >= 0
     360    //Upper bounds
     361    Matrix upper_bounds = Col( 10, 10); //x1<= 10, x2 <=10
     362    //There are two non linear constraining inequations
     363    Set inequations = [[
     364     [[ineq1, ineq1::constraint]], //Inequation given by class method
     365     [[ineq2, ineq2::constraint]]  //Inequation given by class method
     366    ]]
     367  ]] ]];
     368  //Initial point
     369  Matrix x0 = Col(1.234, 5.678),
     370  Real verboseEach = 100
    379371]];
    380372
    381 }}}
    382 
    383 === Creación y lanzamiento de la optimización ===
    384 
    385 {{{
    386 #!cpp
    387 
    388 //Creating the optimizer instance
    389 NonLinGloOpt::@Opt opt = problem::create_optimizer(?);
    390 
    391 //Running the optimization
    392 Real opt::optimize_problem(problem);
     373Real pipe_line::optimize(?);
    393374
    394375}}}