Changeset 376


Ignore:
Timestamp:
08/05/10 16:47:50 (6 years ago)
Author:
altafang
Message:

Organizing the constraints tests into separate directories

Location:
branches/alta/mystic-0.2a1
Files:
9 added
3 edited
13 moved

Legend:

Unmodified
Added
Removed
  • branches/alta/mystic-0.2a1/augmented_lagrangian_constraints.py

    r373 r376  
    250250        x = solver.Solution() 
    251251 
    252         #XXX When a user sets maxiter and maxfun, that is actually the maxiter  
    253         # and maxfun *each* SUMT iteration. The total iterations could actually 
    254         # be much more. Adjust for that, or just write a warning in the  
    255         # documentation? 
     252        # When a user sets maxiter and maxfun, that is actually the maxiter  
     253        # and maxfun *each* SUMT iteration. However, it is difficult to check  
     254        # total maxfun and maxiter each SUMT iteration because then what  
     255        # would the inner maxiter and maxfun be? Better to just leave maxiter  
     256        # and maxfun as limits for each inner optimization... 
    256257        total_iterations += solver.generations 
    257258        total_energy_history += solver.energy_history 
  • branches/alta/mystic-0.2a1/constrained_tests/test_constraints_mech_design.py

    r360 r376  
    2525Comparison of different software: 
    2626 
    27 Again, expected: (1.125, 0.625, 58.290, 43.693), f=7198 
    28  
    2927Mystic results: 
    3028--------------- 
    31 Penalty method, with penalty=1e6: 
    32     DifferentialEvolution, penalty: 
    33     soln= [  1.125        0.625       58.37151357  42.91702352] 
    34     f value = 7178.27575655 
    35     Time elapsed= 15.0106379986 
    36     Constraints satisfied? True 
    37  
    38     DifferentialEvolution2, penalty: 
    39     soln= [  1.125        0.625       58.37151357  42.91702354] 
    40     f value = 7178.27575755 
    41     Time elapsed= 14.9718539715 
    42     Constraints satisfied? True 
    43  
    44     NelderMead, penalty: 
    45     soln= [  1.125        0.625       50.03412086  97.57104948] 
    46     f value = 7847.70126182 
    47     Time elapsed= 0.76296710968 
    48     Constraints satisfied? True 
    49  
    50     Powelldirectional, penalty: 
    51     soln= [  1.125        0.625       58.37151357  42.91702357] 
    52     f value = 7178.27575886 
    53     Time elapsed= 3.08916687965 
    54     Constraints satisfied? True 
    55  
    56     BFGS, penalty: 
    57     soln= [  1.34557843   1.27226119  59.09936969  53.98159996] 
    58     f value = 13005.5250723 
    59     Time elapsed= 0.159216880798 
    60     Constraints satisfied? True 
    61  
    62     NCG, penalty: 
    63     soln= [   1.27032014    1.65777684   48.03515965  101.04926928] 
    64     f value = 12693.3502272 
    65     Time elapsed= 1.65720391273 
    66     Constraints satisfied? False 
    67  
    68     CG, penalty: 
    69     soln= [   1.12505189    1.17561523   54.25138573  107.57753739] 
    70     f value = 12032.5868672 
    71     Time elapsed= 0.224512815475 
    72     Constraints satisfied? True 
    73  
    74 Augmented Lagrangian method: 
    75     Note: results below are with non-default rg, rh due to this problem having 
    76     large function values. 
    77      
    78     Diffev, auglag: 
    79     soln= [  1.125        0.625       58.29018567  43.69246167] 
    80     f value = 7198.00229999 
    81     Time elapsed= 315.373667955 
    82     True 
    83  
    84     Diffev2, auglag: 
    85     soln= [  1.125        0.625       58.29015258  43.69267472] 
    86     f value = 7198.00571951 
    87     Time elapsed= 250.608822107 
    88     True 
    89  
    90     NelderMead, auglag: 
    91     soln= [  1.12539147   0.625       58.29557452  43.67355902] 
    92     f value = 7199.91438019 
    93     Time elapsed= 12.3814969063 
    94     True 
    95  
    96     PowellDirectional, auglag: 
    97     soln= [  1.125        0.625       58.28263221  43.77778598] 
    98     f value = 7200.42694867 
    99     Time elapsed= 70.8250758648 
    100     True 
    101  
    102     BFGS, auglag: 
    103     soln= [  1.13929512   0.6250201   47.65228491  49.18558259] 
    104     f value = 5614.85177789 
    105     Time elapsed= 0.646522045135 
    106     False 
    107  
    108     NCG, auglag: 
    109     soln= [  1.17081815   0.74488168  48.14483527  48.6160188 ] 
    110     f value = 6296.06882163 
    111     Time elapsed= 28.1646289825 
    112     False 
    113  
    114     CG, auglag: 
    115     soln= [  1.12502104   0.69798627  48.14299071  48.61562258] 
    116     f value = 5919.11213151 
    117     Time elapsed= 0.31470990181 
    118     False 
    119  
    120 For the code that generated these results, see the code in this script. 
    121 None of the time results are particularly rigorous, but are included just to 
    122 get a general idea. 
     29None of the times listed are particularly rigorous, but are included just to 
     30get a general idea. Penalty method used penalty=1e7. Termination conditions  
     31were the default for the solver. Note that while verify_constraints_satisfied 
     32says the constraints are satisfied, it is with tol=1e-6, so some of the  
     33constraints may not actually be strictly satisfied (tol=1e-6 is pretty lenient, 
     34as it is the sum of squared errors <= 1e-6). 
     35 
     36DifferentialEvolution, penalty: 
     37soln= [  1.125        0.625       58.29836344  43.61450809] 
     38f value = 7196.02292104 
     39Time elapsed= 6.968075037 
     40True 
     41 
     42DifferentialEvolution2, penalty: 
     43soln= [  1.125        0.625       58.29836493  43.61449852] 
     44f value = 7196.02276745 
     45Time elapsed= 6.39398908615 
     46True 
     47 
     48NelderMead, penalty: 
     49soln= [  1.1250001    0.71579527  58.28008846  43.74569592] 
     50f value = 7746.8703903 
     51Time elapsed= 0.736877918243 
     52True 
     53 
     54Powelldirectional, penalty: 
     55soln= [  1.125        0.625       58.29439508  43.64290028] 
     56f value = 7196.56057668 
     57Time elapsed= 3.49020886421 
     58True 
     59 
     60BFGS, penalty: 
     61soln= [   1.25     0.625   50.     120.   ] 
     62f value = 9589.925 
     63Time elapsed= 0.288455963135 
     64True 
     65 
     66NCG, penalty: 
     67^C 
     68soln= [ NaN  NaN  NaN  NaN] 
     69f value = nan 
     70Time elapsed= 43.6070699692 
     71False 
     72 
     73CG, penalty: 
     74soln= [   1.25     0.625   50.     120.   ] 
     75f value = 9589.925 
     76Time elapsed= 0.00531411170959 
     77True 
     78 
     79Diffev, auglag: 
     80soln= [  1.12500503   0.62500011  58.29013632  43.69342076] 
     81f value = 7198.05944809 
     82Time elapsed= 43.1847889423 
     83True 
     84 
     85Diffev2, auglag: 
     86soln= [  1.125        0.625       58.28943222  43.69711476] 
     87f value = 7198.07127457 
     88Time elapsed= 41.6524450779 
     89True 
     90 
     91NelderMead, auglag: 
     92soln= [  1.12557137   0.625       58.35821875  43.27438764] 
     93f value = 7194.41567298 
     94Time elapsed= 8.42519307137 
     95True 
     96 
     97PowellDirectional, auglag: 
     98soln= [  1.125        0.625       58.2737825   43.81915823] 
     99f value = 7200.64105846 
     100Time elapsed= 19.0831940174 
     101True 
     102 
     103BFGS, auglag: 
     104soln= [   1.25     0.625   50.     120.   ] 
     105f value = 9589.925 
     106Time elapsed= 0.0480899810791 
     107True 
     108 
     109NCG, auglag: 
     110^C 
     111soln= [ NaN  NaN  NaN  NaN] 
     112f value = nan 
     113Time elapsed= 16.3369438648 
     114False 
     115 
     116CG, auglag: 
     117soln= [   1.25     0.625   50.     120.   ] 
     118f value = 9589.925 
     119Time elapsed= 0.0273869037628 
     120True 
     121 
    123122 
    124123OpenOpt code and results: 
     
    167166# Random seed 
    168167from mystic.tools import random_seed 
    169 seed = 789#123 
     168seed = 123 
    170169random_seed(seed) 
    171170 
     
    180179ndim = 4 
    181180x0 = [1.25, 0.625, 50., 120.] # Source: Kannan and Kramer 
    182 npop = 30 # for differential evolution 
     181npop = 50 # for differential evolution 
    183182 
    184183lb = [1.125, 0.625, 40., 40.] 
     
    194193    time_before = time.time() 
    195194 
    196     from constraint_tools import wrap_constraints_to_cost 
     195    from mystic.constraint_tools import wrap_constraints_to_cost 
    197196    constrained_cost = wrap_constraints_to_cost(constraints_string, ndim, costfunc)#,\ 
    198197                       # penalty=1e6) 
    199     from differential_evolution import DifferentialEvolutionSolver 
     198    from mystic.differential_evolution import DifferentialEvolutionSolver 
    200199    from mystic.termination import VTR 
    201200    solver = DifferentialEvolutionSolver(ndim, npop) 
     
    210209    print "Time elapsed=", time_elapsed 
    211210 
    212     from constraint_tools import verify_constraints_satisfied 
    213     print verify_constraints_satisfied(constraints_string, soln) 
     211    from mystic.constraint_tools import verify_constraints_satisfied 
     212    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    214213 
    215214#------------------------------------------------------------- 
     
    225224    time_before = time.time() 
    226225 
    227     from differential_evolution import DifferentialEvolutionSolver 
    228     from mystic.termination import VTR 
     226    from mystic.differential_evolution import DifferentialEvolutionSolver 
     227    from mystic.termination import VTR 
     228    from mystic.termination import ChangeOverGeneration as COG 
    229229    solver = DifferentialEvolutionSolver(ndim, npop) 
    230230    solver.SetStrictRanges(lb, ub) 
    231231    solver.SetInitialPoints(x0) 
    232232    solver.enable_signal_handler() 
    233     term = VTR() 
    234     solver.Solve(costfunc, term, constraints=constraints_string, \ 
    235                 constraints_method='penalty', penalty=1e7) 
    236     soln = solver.Solution() 
    237  
    238     time_elapsed = time.time() - time_before 
    239     print "soln=", soln 
    240     print "f value =", costfunc(soln) 
    241     print "Time elapsed=", time_elapsed 
    242  
    243     from constraint_tools import verify_constraints_satisfied 
    244     print verify_constraints_satisfied(constraints_string, soln) 
     233    #term = VTR()  
     234    term = COG() 
     235    # here, Best1Bin seems better than Rand1Bin 
     236    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     237                constraints_method='penalty', penalty=1e7)  
     238    soln = solver.Solution() 
     239 
     240    time_elapsed = time.time() - time_before 
     241    print "soln=", soln 
     242    print "f value =", costfunc(soln) 
     243    print "Time elapsed=", time_elapsed 
     244 
     245    from mystic.constraint_tools import verify_constraints_satisfied 
     246    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    245247 
    246248def test_diffev2_penalty(): 
     
    254256    time_before = time.time() 
    255257 
    256     from differential_evolution import DifferentialEvolutionSolver2 
    257     from mystic.termination import VTR 
     258    from mystic.differential_evolution import DifferentialEvolutionSolver2 
     259    from mystic.termination import VTR 
     260    from mystic.termination import ChangeOverGeneration as COG 
    258261    solver = DifferentialEvolutionSolver2(ndim, npop) 
    259262    solver.SetStrictRanges(lb, ub) 
    260263    solver.SetInitialPoints(x0) 
    261264    solver.enable_signal_handler() 
    262     term = VTR() 
    263     solver.Solve(costfunc, term, constraints=constraints_string, \ 
    264                 constraints_method='penalty', penalty=1e6) 
    265     soln = solver.Solution() 
    266  
    267     time_elapsed = time.time() - time_before 
    268     print "soln=", soln 
    269     print "f value =", costfunc(soln) 
    270     print "Time elapsed=", time_elapsed 
    271  
    272     from constraint_tools import verify_constraints_satisfied 
    273     print verify_constraints_satisfied(constraints_string, soln) 
     265    #term = VTR() 
     266    term = COG() 
     267    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     268                constraints_method='penalty', penalty=1e7) 
     269    soln = solver.Solution() 
     270 
     271    time_elapsed = time.time() - time_before 
     272    print "soln=", soln 
     273    print "f value =", costfunc(soln) 
     274    print "Time elapsed=", time_elapsed 
     275 
     276    from mystic.constraint_tools import verify_constraints_satisfied 
     277    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    274278 
    275279def test_neldermead_penalty(): 
     
    283287    time_before = time.time() 
    284288 
    285     from scipy_optimize import NelderMeadSimplexSolver 
     289    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    286290    from mystic.termination import VTR 
    287291    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    292296    solver.SetInitialPoints(x0) 
    293297    solver.enable_signal_handler() 
    294     term = VTR() 
    295     #term = CRT(1e-9) 
     298    #term = VTR() 
     299    term = CRT() 
    296300    #term = COG(1e-9) 
    297301    #term = NCOG() 
    298302    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    299                 constraints_method='penalty', penalty=1e6) 
    300     soln = solver.Solution() 
    301  
    302     time_elapsed = time.time() - time_before 
    303     print "soln=", soln 
    304     print "f value =", costfunc(soln) 
    305     print "Time elapsed=", time_elapsed 
    306  
    307     from constraint_tools import verify_constraints_satisfied 
    308     print verify_constraints_satisfied(constraints_string, soln) 
     303                constraints_method='penalty', penalty=1e7) 
     304    soln = solver.Solution() 
     305 
     306    time_elapsed = time.time() - time_before 
     307    print "soln=", soln 
     308    print "f value =", costfunc(soln) 
     309    print "Time elapsed=", time_elapsed 
     310 
     311    from mystic.constraint_tools import verify_constraints_satisfied 
     312    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    309313 
    310314 
     
    319323    time_before = time.time() 
    320324 
    321     from scipy_optimize import PowellDirectionalSolver 
    322     from mystic.termination import VTR 
     325    from mystic.scipy_optimize import PowellDirectionalSolver 
     326    from mystic.termination import VTR 
     327    from mystic.termination import NormalizedChangeOverGeneration as NCOG 
    323328    solver = PowellDirectionalSolver(ndim) 
    324329    solver.SetStrictRanges(lb, ub) 
    325330    solver.SetInitialPoints(x0) 
    326331    solver.enable_signal_handler() 
    327     term = VTR() 
    328     solver.Solve(costfunc, term, constraints=constraints_string, \ 
    329                 constraints_method='penalty', penalty=1e6) 
    330     soln = solver.Solution() 
    331  
    332     time_elapsed = time.time() - time_before 
    333     print "soln=", soln 
    334     print "f value =", costfunc(soln) 
    335     print "Time elapsed=", time_elapsed 
    336  
    337     from constraint_tools import verify_constraints_satisfied 
    338     print verify_constraints_satisfied(constraints_string, soln) 
     332    #term = VTR() 
     333    term = NCOG() 
     334    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     335                constraints_method='penalty', penalty=1e7) 
     336    soln = solver.Solution() 
     337 
     338    time_elapsed = time.time() - time_before 
     339    print "soln=", soln 
     340    print "f value =", costfunc(soln) 
     341    print "Time elapsed=", time_elapsed 
     342 
     343    from mystic.constraint_tools import verify_constraints_satisfied 
     344    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    339345 
    340346def test_bfgs_penalty(): 
     
    348354    time_before = time.time() 
    349355 
    350     from scipy_bfgs import BFGSSolver 
    351     from mystic.termination import VTR 
     356    from mystic.scipy_bfgs import BFGSSolver 
     357    from mystic.termination import VTR 
     358    from mystic.termination import GradientTermination 
    352359    solver = BFGSSolver(ndim) 
    353360    solver.SetStrictRanges(lb, ub) 
    354361    solver.SetInitialPoints(x0) 
    355362    solver.enable_signal_handler() 
    356     term = VTR() 
    357     solver.Solve(costfunc, term, constraints=constraints_string, \ 
    358                 constraints_method='penalty', penalty=1e6) 
    359     soln = solver.Solution() 
    360  
    361     time_elapsed = time.time() - time_before 
    362     print "soln=", soln 
    363     print "f value =", costfunc(soln) 
    364     print "Time elapsed=", time_elapsed 
    365  
    366     from constraint_tools import verify_constraints_satisfied 
    367     print verify_constraints_satisfied(constraints_string, soln) 
     363    #term = VTR() 
     364    term = GradientTermination() 
     365    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     366                constraints_method='penalty', penalty=1e7) 
     367    soln = solver.Solution() 
     368 
     369    time_elapsed = time.time() - time_before 
     370    print "soln=", soln 
     371    print "f value =", costfunc(soln) 
     372    print "Time elapsed=", time_elapsed 
     373 
     374    from mystic.constraint_tools import verify_constraints_satisfied 
     375    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    368376 
    369377def test_ncg_penalty(): 
     
    377385    time_before = time.time() 
    378386 
    379     from scipy_ncg import NCGSolver 
    380     from mystic.termination import VTR 
     387    from mystic.scipy_ncg import NCGSolver 
     388    from mystic.termination import VTR 
     389    from mystic.termination import SolutionImprovement 
    381390    solver = NCGSolver(ndim) 
    382391    solver.SetStrictRanges(lb, ub) 
    383392    solver.SetInitialPoints(x0) 
    384393    solver.enable_signal_handler() 
    385     term = VTR() 
    386     solver.Solve(costfunc, term, constraints=constraints_string, \ 
    387                 constraints_method='penalty', penalty=1e6) 
    388     soln = solver.Solution() 
    389  
    390     time_elapsed = time.time() - time_before 
    391     print "soln=", soln 
    392     print "f value =", costfunc(soln) 
    393     print "Time elapsed=", time_elapsed 
    394  
    395     from constraint_tools import verify_constraints_satisfied 
    396     print verify_constraints_satisfied(constraints_string, soln) 
     394    #term = VTR() 
     395    term = SolutionImprovement() 
     396    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     397                constraints_method='penalty', penalty=1e7) 
     398    soln = solver.Solution() 
     399 
     400    time_elapsed = time.time() - time_before 
     401    print "soln=", soln 
     402    print "f value =", costfunc(soln) 
     403    print "Time elapsed=", time_elapsed 
     404 
     405    from mystic.constraint_tools import verify_constraints_satisfied 
     406    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    397407 
    398408def test_cg_penalty(): 
     
    406416    time_before = time.time() 
    407417 
    408     from scipy_cg import CGSolver 
     418    from mystic.scipy_cg import CGSolver 
    409419    from mystic.termination import VTR 
    410420    from mystic.termination import GradientTermination 
     
    413423    solver.SetInitialPoints(x0) 
    414424    solver.enable_signal_handler() 
    415     term = VTR() 
    416     #term = GradientTermination() 
    417     solver.Solve(costfunc, term, constraints=constraints_string, \ 
    418                 constraints_method='penalty', penalty=1e6) 
    419     soln = solver.Solution() 
    420  
    421     time_elapsed = time.time() - time_before 
    422     print "soln=", soln 
    423     print "f value =", costfunc(soln) 
    424     print "Time elapsed=", time_elapsed 
    425  
    426     from constraint_tools import verify_constraints_satisfied 
    427     print verify_constraints_satisfied(constraints_string, soln) 
     425    #term = VTR() 
     426    term = GradientTermination() 
     427    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     428                constraints_method='penalty', penalty=1e7) 
     429    soln = solver.Solution() 
     430 
     431    time_elapsed = time.time() - time_before 
     432    print "soln=", soln 
     433    print "f value =", costfunc(soln) 
     434    print "Time elapsed=", time_elapsed 
     435 
     436    from mystic.constraint_tools import verify_constraints_satisfied 
     437    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    428438 
    429439#--------------------------------------------------------------------- 
     
    439449    time_before = time.time() 
    440450 
    441     from differential_evolution import DifferentialEvolutionSolver 
    442     from mystic.termination import VTR 
     451    from mystic.differential_evolution import DifferentialEvolutionSolver 
     452    from mystic.termination import VTR 
     453    from mystic.termination import ChangeOverGeneration as COG 
    443454    solver = DifferentialEvolutionSolver(ndim, npop) 
    444455    solver.SetStrictRanges(lb, ub) 
    445456    solver.SetInitialPoints(x0) 
    446457    solver.enable_signal_handler() 
    447     term = VTR() 
    448     solver.Solve(costfunc, term, constraints=constraints_string, \ 
    449                 constraints_method='auglag', disp=True, rg=1e3, rh=1e3) 
    450     soln = solver.Solution() 
    451  
    452     time_elapsed = time.time() - time_before 
    453     print "soln=", soln 
    454     print "f value =", costfunc(soln) 
    455     print "Time elapsed=", time_elapsed 
    456  
    457     from constraint_tools import verify_constraints_satisfied 
    458     print verify_constraints_satisfied(constraints_string, soln) 
     458    #term = VTR() 
     459    term = COG() 
     460    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     461                constraints_method='auglag',rg=1e3, rh=1e3) 
     462    soln = solver.Solution() 
     463 
     464    time_elapsed = time.time() - time_before 
     465    print "soln=", soln 
     466    print "f value =", costfunc(soln) 
     467    print "Time elapsed=", time_elapsed 
     468 
     469    from mystic.constraint_tools import verify_constraints_satisfied 
     470    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    459471 
    460472def test_diffev2_auglag(): 
     
    468480    time_before = time.time() 
    469481 
    470     from differential_evolution import DifferentialEvolutionSolver2 
    471     from mystic.termination import VTR 
     482    from mystic.differential_evolution import DifferentialEvolutionSolver2 
     483    from mystic.termination import VTR 
     484    from mystic.termination import ChangeOverGeneration as COG 
    472485    solver = DifferentialEvolutionSolver2(ndim, npop) 
    473486    solver.SetStrictRanges(lb, ub) 
    474487    solver.SetInitialPoints(x0) 
    475488    solver.enable_signal_handler() 
    476     term = VTR() 
     489    #term = VTR() 
     490    term = COG() 
    477491    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    478492                constraints_method='auglag', rg=1e3, rh=1e3) 
     
    484498    print "Time elapsed=", time_elapsed 
    485499 
    486     from constraint_tools import verify_constraints_satisfied 
    487     print verify_constraints_satisfied(constraints_string, soln) 
     500    from mystic.constraint_tools import verify_constraints_satisfied 
     501    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    488502 
    489503def test_neldermead_auglag(): 
     
    497511    time_before = time.time() 
    498512 
    499     from scipy_optimize import NelderMeadSimplexSolver 
     513    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    500514    from mystic.termination import VTR 
    501515    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    504518    solver.SetInitialPoints(x0) 
    505519    solver.enable_signal_handler() 
    506     term = VTR() 
    507     #term = CRT() 
     520    #term = VTR() 
     521    term = CRT() 
    508522    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    509523                constraints_method='auglag', rg=1e3, rh=1e3) 
     
    515529    print "Time elapsed=", time_elapsed 
    516530 
    517     from constraint_tools import verify_constraints_satisfied 
    518     print verify_constraints_satisfied(constraints_string, soln) 
     531    from mystic.constraint_tools import verify_constraints_satisfied 
     532    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    519533 
    520534def test_powelldirectional_auglag(): 
     
    528542    time_before = time.time() 
    529543 
    530     from scipy_optimize import PowellDirectionalSolver 
     544    from mystic.scipy_optimize import PowellDirectionalSolver 
    531545    from mystic.termination import VTR 
    532546    from mystic.termination import NormalizedChangeOverGeneration as NCOG 
     
    535549    solver.SetInitialPoints(x0) 
    536550    solver.enable_signal_handler() 
    537     term = VTR() 
    538     #term = NCOG(1e-8) 
     551    #term = VTR() 
     552    term = NCOG() 
    539553    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    540554                constraints_method='auglag', rg=1e3, rh=1e3) 
     
    546560    print "Time elapsed=", time_elapsed 
    547561 
    548     from constraint_tools import verify_constraints_satisfied 
    549     print verify_constraints_satisfied(constraints_string, soln) 
     562    from mystic.constraint_tools import verify_constraints_satisfied 
     563    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    550564 
    551565def test_bfgs_auglag(): 
     
    559573    time_before = time.time() 
    560574 
    561     from scipy_bfgs import BFGSSolver 
    562     from mystic.termination import VTR 
    563     from termination import GradientTermination 
     575    from mystic.scipy_bfgs import BFGSSolver 
     576    from mystic.termination import VTR 
     577    from mystic.termination import GradientTermination 
    564578    from mystic.termination import ChangeOverGeneration as COG 
    565579    solver = BFGSSolver(ndim) 
     
    567581    solver.SetInitialPoints(x0) 
    568582    solver.enable_signal_handler() 
    569     term = VTR() 
    570     #term = GradientTermination() 
     583    #term = VTR() 
     584    term = GradientTermination() 
    571585    #term = COG() 
    572586    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     
    579593    print "Time elapsed=", time_elapsed 
    580594 
    581     from constraint_tools import verify_constraints_satisfied 
    582     print verify_constraints_satisfied(constraints_string, soln) 
     595    from mystic.constraint_tools import verify_constraints_satisfied 
     596    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    583597 
    584598def test_ncg_auglag(): 
     
    592606    time_before = time.time() 
    593607 
    594     from scipy_ncg import NCGSolver 
    595     from mystic.termination import VTR 
     608    from mystic.scipy_ncg import NCGSolver 
     609    from mystic.termination import VTR 
     610    from mystic.termination import SolutionImprovement 
    596611    solver = NCGSolver(ndim) 
    597612    solver.SetStrictRanges(lb, ub) 
    598613    solver.SetInitialPoints(x0) 
    599614    solver.enable_signal_handler() 
    600     term = VTR() 
     615    #term = VTR() 
     616    term = SolutionImprovement() 
    601617    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    602618                constraints_method='auglag', rg=1e3, rh=1e3) 
     
    608624    print "Time elapsed=", time_elapsed 
    609625 
    610     from constraint_tools import verify_constraints_satisfied 
    611     print verify_constraints_satisfied(constraints_string, soln) 
     626    from mystic.constraint_tools import verify_constraints_satisfied 
     627    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    612628 
    613629def test_cg_auglag(): 
     
    621637    time_before = time.time() 
    622638 
    623     from scipy_cg import CGSolver 
    624     from mystic.termination import VTR 
     639    from mystic.scipy_cg import CGSolver 
     640    from mystic.termination import VTR 
     641    from mystic.termination import GradientTermination 
    625642    solver = CGSolver(ndim) 
    626643    solver.SetStrictRanges(lb, ub) 
    627644    solver.SetInitialPoints(x0) 
    628645    solver.enable_signal_handler() 
    629     term = VTR() 
     646    #term = VTR() 
     647    term = GradientTermination() 
    630648    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    631649                constraints_method='auglag', rg=1e3, rh=1e3) 
     
    637655    print "Time elapsed=", time_elapsed 
    638656 
    639     from constraint_tools import verify_constraints_satisfied 
    640     print verify_constraints_satisfied(constraints_string, soln) 
     657    from mystic.constraint_tools import verify_constraints_satisfied 
     658    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    641659 
    642660if __name__ == '__main__': 
     
    644662    # the function values for this function are quite high, on the order of 
    645663    # 1e3 to 1e4. 
     664    # Default VTR may not be a good termination here, since f(min) ~ 7000 
    646665 
    647666    #test_direct_diffev_penalty() 
  • branches/alta/mystic-0.2a1/constrained_tests/test_constraints_openoptexample.py

    r367 r376  
    119119 
    120120""" 
    121 from constraint_tools import verify_constraints_satisfied 
     121from mystic.constraint_tools import verify_constraints_satisfied 
    122122import time 
    123123 
     
    160160    time_before = time.time() 
    161161 
    162     from differential_evolution import DifferentialEvolutionSolver 
     162    from mystic.differential_evolution import DifferentialEvolutionSolver 
    163163    from mystic.termination import VTR 
    164164    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    178178    print "Time elapsed=", time_elapsed 
    179179 
    180     from constraint_tools import verify_constraints_satisfied 
     180    from mystic.constraint_tools import verify_constraints_satisfied 
    181181    print verify_constraints_satisfied(constraints_string, soln,\ 
    182182                                     varnamelist=varnamelist) 
     
    193193    time_before = time.time() 
    194194 
    195     from differential_evolution import DifferentialEvolutionSolver2 
     195    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    196196    from mystic.termination import VTR 
    197197    solver = DifferentialEvolutionSolver2(ndim, npop) 
     
    209209    print "Time elapsed=", time_elapsed 
    210210 
    211     from constraint_tools import verify_constraints_satisfied 
     211    from mystic.constraint_tools import verify_constraints_satisfied 
    212212    print verify_constraints_satisfied(constraints_string, soln,\ 
    213213                                     varnamelist=varnamelist) 
     
    224224    time_before = time.time() 
    225225 
    226     from scipy_optimize import NelderMeadSimplexSolver 
     226    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    227227    from mystic.termination import VTR 
    228228    solver = NelderMeadSimplexSolver(ndim) 
     
    240240    print "Time elapsed=", time_elapsed 
    241241 
    242     from constraint_tools import verify_constraints_satisfied 
     242    from mystic.constraint_tools import verify_constraints_satisfied 
    243243    print verify_constraints_satisfied(constraints_string, soln,\ 
    244244                                     varnamelist=varnamelist) 
     
    255255    time_before = time.time() 
    256256 
    257     from scipy_optimize import PowellDirectionalSolver 
     257    from mystic.scipy_optimize import PowellDirectionalSolver 
    258258    from mystic.termination import VTR 
    259259    solver = PowellDirectionalSolver(ndim) 
     
    272272    print "Time elapsed=", time_elapsed 
    273273 
    274     from constraint_tools import verify_constraints_satisfied 
     274    from mystic.constraint_tools import verify_constraints_satisfied 
    275275    print verify_constraints_satisfied(constraints_string, soln,\ 
    276276                                     varnamelist=varnamelist) 
     
    286286    time_before = time.time() 
    287287 
    288     from scipy_bfgs import BFGSSolver 
    289     from mystic.termination import VTR 
    290     from termination import GradientTermination 
     288    from mystic.scipy_bfgs import BFGSSolver 
     289    from mystic.termination import VTR 
     290    from mystic.termination import GradientTermination 
    291291    solver = BFGSSolver(ndim) 
    292292      
     
    305305    print "Time elapsed=", time_elapsed 
    306306 
    307     from constraint_tools import verify_constraints_satisfied 
     307    from mystic.constraint_tools import verify_constraints_satisfied 
    308308    print verify_constraints_satisfied(constraints_string, soln,\ 
    309309                                     varnamelist=varnamelist) 
     
    319319    time_before = time.time() 
    320320 
    321     from scipy_ncg import NCGSolver 
     321    from mystic.scipy_ncg import NCGSolver 
    322322    from mystic.termination import VTR 
    323323    solver = NCGSolver(ndim) 
     
    336336    print "Time elapsed=", time_elapsed 
    337337 
    338     from constraint_tools import verify_constraints_satisfied 
     338    from mystic.constraint_tools import verify_constraints_satisfied 
    339339    print verify_constraints_satisfied(constraints_string, soln,\ 
    340340                                     varnamelist=varnamelist) 
     
    350350    time_before = time.time() 
    351351 
    352     from scipy_cg import CGSolver 
     352    from mystic.scipy_cg import CGSolver 
    353353    from mystic.termination import VTR 
    354354    solver = CGSolver(ndim) 
     
    367367    print "Time elapsed=", time_elapsed 
    368368 
    369     from constraint_tools import verify_constraints_satisfied 
     369    from mystic.constraint_tools import verify_constraints_satisfied 
    370370    print verify_constraints_satisfied(constraints_string, soln,\ 
    371371                                     varnamelist=varnamelist) 
     
    383383    time_before = time.time() 
    384384 
    385     from differential_evolution import DifferentialEvolutionSolver 
     385    from mystic.differential_evolution import DifferentialEvolutionSolver 
    386386    from mystic.termination import VTR 
    387387    solver = DifferentialEvolutionSolver(ndim, npop) 
     
    401401    print "Time elapsed=", time_elapsed 
    402402 
    403     from constraint_tools import verify_constraints_satisfied 
     403    from mystic.constraint_tools import verify_constraints_satisfied 
    404404    print verify_constraints_satisfied(constraints_string, soln,\ 
    405405                                     varnamelist=varnamelist) 
     
    415415    time_before = time.time() 
    416416 
    417     from differential_evolution import DifferentialEvolutionSolver2 
     417    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    418418    from mystic.termination import VTR 
    419419    solver = DifferentialEvolutionSolver2(ndim, npop) 
     
    432432    print "Time elapsed=", time_elapsed 
    433433 
    434     from constraint_tools import verify_constraints_satisfied 
     434    from mystic.constraint_tools import verify_constraints_satisfied 
    435435    print verify_constraints_satisfied(constraints_string, soln,\ 
    436436                                     varnamelist=varnamelist) 
     
    447447    time_before = time.time() 
    448448 
    449     from scipy_optimize import NelderMeadSimplexSolver 
     449    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    450450    from mystic.termination import VTR 
    451451    solver = NelderMeadSimplexSolver(ndim) 
     
    463463    print "Time elapsed=", time_elapsed 
    464464 
    465     from constraint_tools import verify_constraints_satisfied 
     465    from mystic.constraint_tools import verify_constraints_satisfied 
    466466    print verify_constraints_satisfied(constraints_string, soln,\ 
    467467                                     varnamelist=varnamelist) 
     
    478478    time_before = time.time() 
    479479 
    480     from scipy_optimize import PowellDirectionalSolver 
     480    from mystic.scipy_optimize import PowellDirectionalSolver 
    481481    from mystic.termination import VTR 
    482482    solver = PowellDirectionalSolver(ndim) 
     
    494494    print "Time elapsed=", time_elapsed 
    495495 
    496     from constraint_tools import verify_constraints_satisfied 
     496    from mystic.constraint_tools import verify_constraints_satisfied 
    497497    print verify_constraints_satisfied(constraints_string, soln,\ 
    498498                                     varnamelist=varnamelist) 
     
    508508    time_before = time.time() 
    509509 
    510     from scipy_bfgs import BFGSSolver 
     510    from mystic.scipy_bfgs import BFGSSolver 
    511511    from mystic.termination import VTR 
    512512    solver = BFGSSolver(ndim) 
     
    525525    print "Time elapsed=", time_elapsed 
    526526 
    527     from constraint_tools import verify_constraints_satisfied 
     527    from mystic.constraint_tools import verify_constraints_satisfied 
    528528    print verify_constraints_satisfied(constraints_string, soln,\ 
    529529                                     varnamelist=varnamelist) 
     
    539539    time_before = time.time() 
    540540 
    541     from scipy_ncg import NCGSolver 
     541    from mystic.scipy_ncg import NCGSolver 
    542542    from mystic.termination import VTR 
    543543    solver = NCGSolver(ndim) 
     
    555555    print "Time elapsed=", time_elapsed 
    556556 
    557     from constraint_tools import verify_constraints_satisfied 
     557    from mystic.constraint_tools import verify_constraints_satisfied 
    558558    print verify_constraints_satisfied(constraints_string, soln,\ 
    559559                                     varnamelist=varnamelist) 
     
    569569    time_before = time.time() 
    570570 
    571     from scipy_cg import CGSolver 
     571    from mystic.scipy_cg import CGSolver 
    572572    from mystic.termination import VTR 
    573573    solver = CGSolver(ndim) 
     
    587587    print "Time elapsed=", time_elapsed 
    588588 
    589     from constraint_tools import verify_constraints_satisfied 
     589    from mystic.constraint_tools import verify_constraints_satisfied 
    590590    print verify_constraints_satisfied(constraints_string, soln,\ 
    591591                                     varnamelist=varnamelist) 
  • branches/alta/mystic-0.2a1/constrained_tests/test_constraints_range.py

    r373 r376  
    3535 
    3636import numpy 
    37 from constraint_tools import verify_constraints_satisfied 
     37from mystic.constraint_tools import verify_constraints_satisfied 
    3838import time 
    3939 
     
    7979    time_before = time.time() 
    8080 
    81     from differential_evolution import DifferentialEvolutionSolver 
     81    from mystic.differential_evolution import DifferentialEvolutionSolver 
    8282    from mystic.termination import VTR 
    8383    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    100100    print "Time elapsed=", time_elapsed 
    101101 
    102     from constraint_tools import verify_constraints_satisfied 
     102    from mystic.constraint_tools import verify_constraints_satisfied 
    103103    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    104104 
     
    114114    time_before = time.time() 
    115115 
    116     from differential_evolution import DifferentialEvolutionSolver2 
     116    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    117117    from mystic.termination import VTR 
    118118    from mystic.termination import ChangeOverGeneration as COG 
     
    135135    print "Time elapsed=", time_elapsed 
    136136 
    137     from constraint_tools import verify_constraints_satisfied 
     137    from mystic.constraint_tools import verify_constraints_satisfied 
    138138    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    139139 
     
    149149    time_before = time.time() 
    150150 
    151     from scipy_optimize import NelderMeadSimplexSolver 
     151    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    152152    from mystic.termination import VTR 
    153153    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    169169    print "Time elapsed=", time_elapsed 
    170170 
    171     from constraint_tools import verify_constraints_satisfied 
     171    from mystic.constraint_tools import verify_constraints_satisfied 
    172172    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    173173 
     
    183183    time_before = time.time() 
    184184 
    185     from scipy_optimize import PowellDirectionalSolver 
     185    from mystic.scipy_optimize import PowellDirectionalSolver 
    186186    from mystic.termination import VTR 
    187187    solver = PowellDirectionalSolver(ndim) 
     
    200200    print "Time elapsed=", time_elapsed 
    201201 
    202     from constraint_tools import verify_constraints_satisfied 
     202    from mystic.constraint_tools import verify_constraints_satisfied 
    203203    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    204204 
     
    213213    time_before = time.time() 
    214214 
    215     from scipy_bfgs import BFGSSolver 
     215    from mystic.scipy_bfgs import BFGSSolver 
    216216    from mystic.termination import VTR 
    217217    solver = BFGSSolver(ndim) 
     
    230230    print "Time elapsed=", time_elapsed 
    231231 
    232     from constraint_tools import verify_constraints_satisfied 
     232    from mystic.constraint_tools import verify_constraints_satisfied 
    233233    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    234234 
     
    243243    time_before = time.time() 
    244244 
    245     from scipy_ncg import NCGSolver 
    246     from mystic.termination import VTR 
    247     from termination import SolutionImprovement 
    248     from termination import ChangeOverGeneration as COG 
     245    from mystic.scipy_ncg import NCGSolver 
     246    from mystic.termination import VTR 
     247    from mystic.termination import SolutionImprovement 
     248    from mystic.termination import ChangeOverGeneration as COG 
    249249    solver = NCGSolver(ndim) 
    250250       
     
    264264    print "Time elapsed=", time_elapsed 
    265265 
    266     from constraint_tools import verify_constraints_satisfied 
     266    from mystic.constraint_tools import verify_constraints_satisfied 
    267267    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    268268 
     
    277277    time_before = time.time() 
    278278 
    279     from scipy_cg import CGSolver 
     279    from mystic.scipy_cg import CGSolver 
    280280    from mystic.termination import VTR 
    281281    solver = CGSolver(ndim) 
     
    294294    print "Time elapsed=", time_elapsed 
    295295 
    296     from constraint_tools import verify_constraints_satisfied 
     296    from mystic.constraint_tools import verify_constraints_satisfied 
    297297    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    298298 
     
    329329    print "Time elapsed=", time_elapsed 
    330330 
    331     from constraint_tools import verify_constraints_satisfied 
     331    from mystic.constraint_tools import verify_constraints_satisfied 
    332332    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    333333 
     
    361361    print "Time elapsed=", time_elapsed 
    362362 
    363     from constraint_tools import verify_constraints_satisfied 
     363    from mystic.constraint_tools import verify_constraints_satisfied 
    364364    print verify_constraints_satisfied(constraints_string, soln)#, disp=False) 
    365365 
     
    374374    time_before = time.time() 
    375375 
    376     from scipy_optimize import NelderMeadSimplexSolver 
    377     from mystic.termination import VTR 
    378     from termination import CandidateRelativeTolerance as CRT 
    379     from termination import ChangeOverGeneration as COG 
     376    from mystic.scipy_optimize import NelderMeadSimplexSolver 
     377    from mystic.termination import VTR 
     378    from mystic.termination import CandidateRelativeTolerance as CRT 
     379    from mystic.termination import ChangeOverGeneration as COG 
    380380    solver = NelderMeadSimplexSolver(ndim) 
    381381       
     
    394394    print "Time elapsed=", time_elapsed 
    395395 
    396     from constraint_tools import verify_constraints_satisfied 
     396    from mystic.constraint_tools import verify_constraints_satisfied 
    397397    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    398398 
     
    408408    time_before = time.time() 
    409409 
    410     from scipy_optimize import PowellDirectionalSolver 
     410    from mystic.scipy_optimize import PowellDirectionalSolver 
    411411    from mystic.termination import VTR 
    412412    from mystic.termination import NormalizedChangeOverGeneration as NCOG 
     
    426426    print "Time elapsed=", time_elapsed 
    427427 
    428     from constraint_tools import verify_constraints_satisfied 
     428    from mystic.constraint_tools import verify_constraints_satisfied 
    429429    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    430430 
     
    439439    time_before = time.time() 
    440440 
    441     from scipy_bfgs import BFGSSolver 
     441    from mystic.scipy_bfgs import BFGSSolver 
    442442    from mystic.termination import VTR 
    443443    solver = BFGSSolver(ndim) 
     
    456456    print "Time elapsed=", time_elapsed 
    457457 
    458     from constraint_tools import verify_constraints_satisfied 
     458    from mystic.constraint_tools import verify_constraints_satisfied 
    459459    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    460460 
     
    469469    time_before = time.time() 
    470470 
    471     from scipy_ncg import NCGSolver 
     471    from mystic.scipy_ncg import NCGSolver 
    472472    from mystic.termination import VTR 
    473473    solver = NCGSolver(ndim) 
     
    485485    print "Time elapsed=", time_elapsed 
    486486 
    487     from constraint_tools import verify_constraints_satisfied 
     487    from mystic.constraint_tools import verify_constraints_satisfied 
    488488    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    489489 
     
    498498    time_before = time.time() 
    499499 
    500     from scipy_cg import CGSolver 
     500    from mystic.scipy_cg import CGSolver 
    501501    from mystic.termination import VTR 
    502502    solver = CGSolver(ndim) 
     
    515515    print "Time elapsed=", time_elapsed 
    516516 
    517     from constraint_tools import verify_constraints_satisfied 
     517    from mystic.constraint_tools import verify_constraints_satisfied 
    518518    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    519519 
     
    530530    time_before = time.time() 
    531531 
    532     from differential_evolution import DifferentialEvolutionSolver 
     532    from mystic.differential_evolution import DifferentialEvolutionSolver 
    533533    from mystic.termination import VTR 
    534534    solver = DifferentialEvolutionSolver(ndim, npop) 
     
    546546    print "Time elapsed=", time_elapsed 
    547547 
    548     from constraint_tools import verify_constraints_satisfied 
     548    from mystic.constraint_tools import verify_constraints_satisfied 
    549549    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    550550 
     
    560560    time_before = time.time() 
    561561 
    562     from differential_evolution import DifferentialEvolutionSolver2 
     562    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    563563    from mystic.termination import VTR 
    564564    solver = DifferentialEvolutionSolver2(ndim, npop) 
     
    576576    print "Time elapsed=", time_elapsed 
    577577 
    578     from constraint_tools import verify_constraints_satisfied 
     578    from mystic.constraint_tools import verify_constraints_satisfied 
    579579    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    580580 
     
    590590    time_before = time.time() 
    591591 
    592     from scipy_optimize import NelderMeadSimplexSolver 
     592    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    593593    from mystic.termination import VTR 
    594594    solver = NelderMeadSimplexSolver(ndim) 
     
    606606    print "Time elapsed=", time_elapsed 
    607607 
    608     from constraint_tools import verify_constraints_satisfied 
     608    from mystic.constraint_tools import verify_constraints_satisfied 
    609609    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    610610 
     
    620620    time_before = time.time() 
    621621 
    622     from scipy_optimize import PowellDirectionalSolver 
     622    from mystic.scipy_optimize import PowellDirectionalSolver 
    623623    from mystic.termination import VTR 
    624624    from mystic.termination import NormalizedChangeOverGeneration as NCOG 
     
    639639    print "Time elapsed=", time_elapsed 
    640640 
    641     from constraint_tools import verify_constraints_satisfied 
     641    from mystic.constraint_tools import verify_constraints_satisfied 
    642642    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    643643 
     
    652652    time_before = time.time() 
    653653 
    654     from scipy_bfgs import BFGSSolver 
    655     from mystic.termination import VTR 
    656     from termination import GradientTermination 
     654    from mystic.scipy_bfgs import BFGSSolver 
     655    from mystic.termination import VTR 
     656    from mystic.termination import GradientTermination 
    657657    solver = BFGSSolver(ndim) 
    658658       
     
    671671    print "Time elapsed=", time_elapsed 
    672672 
    673     from constraint_tools import verify_constraints_satisfied 
     673    from mystic.constraint_tools import verify_constraints_satisfied 
    674674    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    675675 
     
    701701    print "Time elapsed=", time_elapsed 
    702702 
    703     from constraint_tools import verify_constraints_satisfied 
     703    from mystic.constraint_tools import verify_constraints_satisfied 
    704704    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    705705 
     
    714714    time_before = time.time() 
    715715 
    716     from scipy_cg import CGSolver 
     716    from mystic.scipy_cg import CGSolver 
    717717    from mystic.termination import VTR 
    718718    solver = CGSolver(ndim) 
     
    731731    print "Time elapsed=", time_elapsed 
    732732 
    733     from constraint_tools import verify_constraints_satisfied 
     733    from mystic.constraint_tools import verify_constraints_satisfied 
    734734    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    735735 
  • branches/alta/mystic-0.2a1/constrained_tests/test_constraints_rosen2d.py

    r364 r376  
    148148 
    149149import numpy 
    150 from constraint_tools import verify_constraints_satisfied 
     150from mystic.constraint_tools import verify_constraints_satisfied 
    151151import time 
    152152 
     
    188188    time_before = time.time() 
    189189 
    190     from differential_evolution import DifferentialEvolutionSolver 
     190    from mystic.differential_evolution import DifferentialEvolutionSolver 
    191191    from mystic.termination import VTR 
    192192    solver = DifferentialEvolutionSolver(ndim, npop) 
     
    204204    print "Time elapsed=", time_elapsed 
    205205 
    206     from constraint_tools import verify_constraints_satisfied 
     206    from mystic.constraint_tools import verify_constraints_satisfied 
    207207    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    208208 
     
    218218    time_before = time.time() 
    219219 
    220     from differential_evolution import DifferentialEvolutionSolver2 
     220    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    221221    from mystic.termination import VTR 
    222222    solver = DifferentialEvolutionSolver2(ndim, npop) 
     
    234234    print "Time elapsed=", time_elapsed 
    235235 
    236     from constraint_tools import verify_constraints_satisfied 
     236    from mystic.constraint_tools import verify_constraints_satisfied 
    237237    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    238238 
     
    248248    time_before = time.time() 
    249249 
    250     from scipy_optimize import NelderMeadSimplexSolver 
     250    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    251251    from mystic.termination import VTR 
    252252    solver = NelderMeadSimplexSolver(ndim) 
     
    264264    print "Time elapsed=", time_elapsed 
    265265 
    266     from constraint_tools import verify_constraints_satisfied 
     266    from mystic.constraint_tools import verify_constraints_satisfied 
    267267    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    268268 
     
    278278    time_before = time.time() 
    279279 
    280     from scipy_optimize import PowellDirectionalSolver 
     280    from mystic.scipy_optimize import PowellDirectionalSolver 
    281281    from mystic.termination import VTR 
    282282    solver = PowellDirectionalSolver(ndim) 
     
    295295    print "Time elapsed=", time_elapsed 
    296296 
    297     from constraint_tools import verify_constraints_satisfied 
     297    from mystic.constraint_tools import verify_constraints_satisfied 
    298298    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    299299 
     
    308308    time_before = time.time() 
    309309 
    310     from scipy_bfgs import BFGSSolver 
     310    from mystic.scipy_bfgs import BFGSSolver 
    311311    from mystic.termination import VTR 
    312312    solver = BFGSSolver(ndim) 
     
    325325    print "Time elapsed=", time_elapsed 
    326326 
    327     from constraint_tools import verify_constraints_satisfied 
     327    from mystic.constraint_tools import verify_constraints_satisfied 
    328328    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    329329 
     
    338338    time_before = time.time() 
    339339 
    340     from scipy_ncg import NCGSolver 
    341     from mystic.termination import VTR 
    342     from termination import SolutionImprovement 
    343     from termination import ChangeOverGeneration as COG 
     340    from mystic.scipy_ncg import NCGSolver 
     341    from mystic.termination import VTR 
     342    from mystic.termination import SolutionImprovement 
     343    from mystic.termination import ChangeOverGeneration as COG 
    344344    solver = NCGSolver(ndim) 
    345345       
     
    359359    print "Time elapsed=", time_elapsed 
    360360 
    361     from constraint_tools import verify_constraints_satisfied 
     361    from mystic.constraint_tools import verify_constraints_satisfied 
    362362    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    363363 
     
    372372    time_before = time.time() 
    373373 
    374     from scipy_cg import CGSolver 
     374    from mystic.scipy_cg import CGSolver 
    375375    from mystic.termination import VTR 
    376376    solver = CGSolver(ndim) 
     
    389389    print "Time elapsed=", time_elapsed 
    390390 
    391     from constraint_tools import verify_constraints_satisfied 
     391    from mystic.constraint_tools import verify_constraints_satisfied 
    392392    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    393393 
     
    404404    time_before = time.time() 
    405405 
    406     from differential_evolution import DifferentialEvolutionSolver 
     406    from mystic.differential_evolution import DifferentialEvolutionSolver 
    407407    from mystic.termination import VTR 
    408408    solver = DifferentialEvolutionSolver(ndim, npop) 
     
    421421    print "Time elapsed=", time_elapsed 
    422422 
    423     from constraint_tools import verify_constraints_satisfied 
     423    from mystic.constraint_tools import verify_constraints_satisfied 
    424424    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    425425 
     
    434434    time_before = time.time() 
    435435 
    436     from differential_evolution import DifferentialEvolutionSolver2 
     436    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    437437    from mystic.termination import VTR 
    438438    solver = DifferentialEvolutionSolver2(ndim, npop) 
     
    451451    print "Time elapsed=", time_elapsed 
    452452 
    453     from constraint_tools import verify_constraints_satisfied 
     453    from mystic.constraint_tools import verify_constraints_satisfied 
    454454    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    455455 
     
    465465    time_before = time.time() 
    466466 
    467     from scipy_optimize import NelderMeadSimplexSolver 
     467    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    468468    from mystic.termination import VTR 
    469469    solver = NelderMeadSimplexSolver(ndim) 
     
    481481    print "Time elapsed=", time_elapsed 
    482482 
    483     from constraint_tools import verify_constraints_satisfied 
     483    from mystic.constraint_tools import verify_constraints_satisfied 
    484484    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    485485 
     
    495495    time_before = time.time() 
    496496 
    497     from scipy_optimize import PowellDirectionalSolver 
     497    from mystic.scipy_optimize import PowellDirectionalSolver 
    498498    from mystic.termination import VTR 
    499499    solver = PowellDirectionalSolver(ndim) 
     
    511511    print "Time elapsed=", time_elapsed 
    512512 
    513     from constraint_tools import verify_constraints_satisfied 
     513    from mystic.constraint_tools import verify_constraints_satisfied 
    514514    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    515515 
     
    524524    time_before = time.time() 
    525525 
    526     from scipy_bfgs import BFGSSolver 
     526    from mystic.scipy_bfgs import BFGSSolver 
    527527    from mystic.termination import VTR 
    528528    solver = BFGSSolver(ndim) 
     
    541541    print "Time elapsed=", time_elapsed 
    542542 
    543     from constraint_tools import verify_constraints_satisfied 
     543    from mystic.constraint_tools import verify_constraints_satisfied 
    544544    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    545545 
     
    554554    time_before = time.time() 
    555555 
    556     from scipy_ncg import NCGSolver 
     556    from mystic.scipy_ncg import NCGSolver 
    557557    from mystic.termination import VTR 
    558558    solver = NCGSolver(ndim) 
     
    570570    print "Time elapsed=", time_elapsed 
    571571 
    572     from constraint_tools import verify_constraints_satisfied 
     572    from mystic.constraint_tools import verify_constraints_satisfied 
    573573    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    574574 
     
    583583    time_before = time.time() 
    584584 
    585     from scipy_cg import CGSolver 
     585    from mystic.scipy_cg import CGSolver 
    586586    from mystic.termination import VTR 
    587587    solver = CGSolver(ndim) 
     
    600600    print "Time elapsed=", time_elapsed 
    601601 
    602     from constraint_tools import verify_constraints_satisfied 
     602    from mystic.constraint_tools import verify_constraints_satisfied 
    603603    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    604604 
     
    615615    time_before = time.time() 
    616616 
    617     from differential_evolution import DifferentialEvolutionSolver 
     617    from mystic.differential_evolution import DifferentialEvolutionSolver 
    618618    from mystic.termination import VTR 
    619619    solver = DifferentialEvolutionSolver(ndim, npop) 
     
    631631    print "Time elapsed=", time_elapsed 
    632632 
    633     from constraint_tools import verify_constraints_satisfied 
     633    from mystic.constraint_tools import verify_constraints_satisfied 
    634634    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    635635 
     
    645645    time_before = time.time() 
    646646 
    647     from differential_evolution import DifferentialEvolutionSolver2 
     647    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    648648    from mystic.termination import VTR 
    649649    solver = DifferentialEvolutionSolver2(ndim, npop) 
     
    661661    print "Time elapsed=", time_elapsed 
    662662 
    663     from constraint_tools import verify_constraints_satisfied 
     663    from mystic.constraint_tools import verify_constraints_satisfied 
    664664    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    665665 
     
    675675    time_before = time.time() 
    676676 
    677     from scipy_optimize import NelderMeadSimplexSolver 
     677    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    678678    from mystic.termination import VTR 
    679679    solver = NelderMeadSimplexSolver(ndim) 
     
    691691    print "Time elapsed=", time_elapsed 
    692692 
    693     from constraint_tools import verify_constraints_satisfied 
     693    from mystic.constraint_tools import verify_constraints_satisfied 
    694694    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    695695 
     
    705705    time_before = time.time() 
    706706 
    707     from scipy_optimize import PowellDirectionalSolver 
     707    from mystic.scipy_optimize import PowellDirectionalSolver 
    708708    from mystic.termination import VTR 
    709709    solver = PowellDirectionalSolver(ndim) 
     
    722722    print "Time elapsed=", time_elapsed 
    723723 
    724     from constraint_tools import verify_constraints_satisfied 
     724    from mystic.constraint_tools import verify_constraints_satisfied 
    725725    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    726726 
     
    735735    time_before = time.time() 
    736736 
    737     from scipy_bfgs import BFGSSolver 
     737    from mystic.scipy_bfgs import BFGSSolver 
    738738    from mystic.termination import VTR 
    739739    solver = BFGSSolver(ndim) 
     
    752752    print "Time elapsed=", time_elapsed 
    753753 
    754     from constraint_tools import verify_constraints_satisfied 
     754    from mystic.constraint_tools import verify_constraints_satisfied 
    755755    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    756756 
     
    765765    time_before = time.time() 
    766766 
    767     from scipy_ncg import NCGSolver 
     767    from mystic.scipy_ncg import NCGSolver 
    768768    from mystic.termination import VTR 
    769769    solver = NCGSolver(ndim) 
     
    782782    print "Time elapsed=", time_elapsed 
    783783 
    784     from constraint_tools import verify_constraints_satisfied 
     784    from mystic.constraint_tools import verify_constraints_satisfied 
    785785    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    786786 
     
    795795    time_before = time.time() 
    796796 
    797     from scipy_cg import CGSolver 
     797    from mystic.scipy_cg import CGSolver 
    798798    from mystic.termination import VTR 
    799799    solver = CGSolver(ndim) 
     
    812812    print "Time elapsed=", time_elapsed 
    813813 
    814     from constraint_tools import verify_constraints_satisfied 
     814    from mystic.constraint_tools import verify_constraints_satisfied 
    815815    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    816816 
     
    833833    test_powelldirectional_auglag() 
    834834    test_bfgs_auglag()  
    835     test_ncg_auglag() # gets stuck without the hack in scipy_ncg. continues to 
     835    test_ncg_auglag() # gets stuck without the hack in mystic.scipy_ncg. continues to 
    836836                      # get stuck with x0=[1., 1.] 
    837837    test_cg_auglag()  
  • branches/alta/mystic-0.2a1/constrained_tests/test_constraints_rosen3d_1.py

    r360 r376  
    88Mystic Results: 
    99--------------- 
     10Below results are for x0=[3., -0.5, 1.] with the mystic.termination conditions  
     11that are default for each solver. The differential evolution results are all  
     12with Rand1Bin and npop=40, which seems to work better. 
    1013 
    1114Differential Evolution, penalty 
    12 soln= [ 1.48865497  2.21994399  4.92815133] 
    13 f value = 1.72852956378 
    14 Time elapsed= 7.12842011452 
     15soln= [ 1.48865565  2.21994417  4.92815476] 
     16f value = 1.72852922752 
     17Time elapsed= 3.19864988327 
    1518True 
    1619 
    1720Differential Evolution2, penalty 
    18 soln= [ 1.48865497  2.21994399  4.92815133] 
    19 f value = 1.72852956392 
    20 Time elapsed= 7.74267101288 
     21soln= [ 1.48865613  2.21994424  4.92815596] 
     22f value = 1.72852883348 
     23Time elapsed= 3.71830892563 
    2124True 
    2225 
    2326NelderMead, penalty 
    24 soln= [  8.69745142e-07   9.99270862e-01   1.15214768e+00] 
    25 f value = 103.213687205 
    26 Time elapsed= 0.27423620224 
     27soln= [ 1.48865958  2.21994303  4.92818437] 
     28f value = 1.72852057093 
     29Time elapsed= 0.113229990005 
    2730True 
    2831 
    2932PowellDirectional, penalty 
    3033soln= [ 1.48865497  2.21994399  4.92815133] 
    31 f value = 1.72852956384 
    32 Time elapsed= 0.890017032623 
     34f value = 1.72852956385 
     35Time elapsed= 0.502039909363 
    3336True 
    3437 
    3538BFGS, penalty 
    36 soln= [ 47.34498284  63.44819316  48.57560494] 
    37 f value = 2056148203.48 
    38 Time elapsed= 0.138121128082 
     39soln= [ 1.48865488  2.21994394  4.9281511 ] 
     40f value = 1.72852952678 
     41Time elapsed= 0.338249206543 
     42True 
     43 
     44NCG gets stuck 
     45 
     46CG gets stuck 
     47 
     48DifferentialEvolution, auglag 
     49soln= [ 1.48869307  2.22006117  4.92867142] 
     50f value = 1.72885561061 
     51Time elapsed= 12.5052418709 
     52True 
     53 
     54DifferentialEvolution2, auglag 
     55soln= [ 1.48796979  2.21789754  4.91907453] 
     56f value = 1.7228661551 
     57Time elapsed= 11.4325180054 
    3958False 
    4059 
    41 NCG, penalty 
    42 soln= [  3.74321743   5.32352946  49.17010029] 
    43 f value = 50964.0581912 
    44 Time elapsed= 0.61452794075 
     60NelderMead, auglag 
     61soln= [ 1.48869652  2.22006837  4.92870857] 
     62f value = 1.72887418176 
     63Time elapsed= 0.618191003799 
     64True 
     65 
     66PowellDirectional, auglag 
     67soln= [ 1.48871851  2.2201335   4.92899276] 
     68f value = 1.7290543256 
     69Time elapsed= 5.98634505272 
     70True 
     71 
     72BFGS, auglag 
     73soln= [ 1.48872051  2.22013952  4.92901947] 
     74f value = 1.72907101056 
     75Time elapsed= 1.1560549736 
     76True 
     77 
     78NCG, auglag 
     79soln= [ 1.31011697  1.7192198   2.95581549] 
     80f value = 0.614242112099 
     81Time elapsed= 1.70558714867 
    4582False 
    4683 
    47 CG gets stuck. 
    48  
    49 DifferentialEvolution, auglag 
    50 soln= [ 1.48869288  2.22005707  4.92865339] 
    51 f value = 1.72884267207 
    52 Time elapsed= 37.709154129 
    53 True 
    54  
    55 DifferentialEvolution2, auglag 
    56 soln= [ 1.48869288  2.22005707  4.92865338] 
    57 f value = 1.72884266439 
    58 Time elapsed= 36.4304840565 
    59 True 
    60  
    61 NelderMead, auglag 
    62 soln= [ 1.48869288  2.22005707  4.92865339] 
    63 f value = 1.72884266999 
    64 Time elapsed= 0.860516786575 
    65 True 
    66  
    67 PowellDirectional, auglag 
    68 soln= [ 1.48882563  2.22045297  4.9304114 ] 
    69 f value = 1.72993912916 
    70 Time elapsed= 6.52501392365 
    71 True 
    72  
    73 BFGS gets stuck. 
    74  
    75 NCG gets stuck. 
    76  
    77 CG gets stuck. 
     84CG gets stuck 
     85 
     86DifferentialEvolution, direct 
     87soln= [ 1.48871731  2.22013004  4.92897792] 
     88f value = 1.72904479216 
     89Time elapsed= 3.22128295898 
     90True 
     91 
     92DifferentialEvolution2, direct 
     93soln= [ 1.48871755  2.22013014  4.92897722] 
     94f value = 1.72904479219 
     95Time elapsed= 3.08842515945 
     96True 
     97 
     98NelderMead, direct 
     99soln= [ 1.48873189  2.22013601  4.92899136] 
     100f value = 1.72904494708 
     101Time elapsed= 0.124616146088 
     102True 
     103 
     104PowellDirectional, direct 
     105soln= [ 1.48871736  2.22013006  4.92897748] 
     106f value = 1.72904479213 
     107Time elapsed= 0.269498109818 
     108True 
     109 
     110BFGS, direct 
     111soln= [ 1.48871735  2.22013005  4.92897744] 
     112f value = 1.72904479213 
     113Time elapsed= 0.069039106369 
     114True 
     115 
     116NCG, direct 
     117^C 
     118soln= [ NaN  NaN  NaN] 
     119f value = nan 
     120Time elapsed= 15.6861510277 
     121False 
     122 
     123CG, direct 
     124soln= [ 0.03920643  1.19800614  2.19841953] 
     125f value = 202.363685381 
     126Time elapsed= 0.0680270195007 
     127True 
    78128""" 
    79129 
    80130import numpy 
    81 from constraint_tools import verify_constraints_satisfied 
     131from mystic.constraint_tools import verify_constraints_satisfied 
    82132import time 
    83133 
    84134# Random seed 
    85135from mystic.tools import random_seed 
    86 seed = 1 
     136seed = 123 
    87137random_seed(seed) 
    88138 
     
    90140from mystic.models import rosen as costfunc 
    91141 
    92 npop=30 
     142npop=40 
    93143MAX_GENERATIONS = 99999 
    94144 
     
    97147"""  
    98148 
    99 x0 = [0.8, 1.2, 0.7] 
    100 #x0 = [1., 2., 5.] 
    101 #x0 = [3., -0.5, 1.] 
     149#x0 = [0.8, 1.2, 0.7] 
     150#x0 = [1., 2., 5.] # close to solution 
     151x0 = [3., -0.5, 1.] 
    102152 
    103153ndim = 3 
     
    117167    time_before = time.time() 
    118168 
    119     from differential_evolution import DifferentialEvolutionSolver 
     169    from mystic.differential_evolution import DifferentialEvolutionSolver 
    120170    from mystic.termination import VTR 
    121171    from mystic.termination import CandidateRelativeTolerance as CRT 
     172    from mystic.termination import ChangeOverGeneration as COG 
    122173    from mystic.strategy import Rand1Bin 
    123174    solver = DifferentialEvolutionSolver(ndim, npop) 
     
    126177    solver.enable_signal_handler() 
    127178    #term = VTR() 
    128     term = CRT() 
     179    #term = CRT() 
     180    term = COG() 
    129181    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    130182                constraints_method='penalty',strategy=Rand1Bin) 
     
    136188    print "Time elapsed=", time_elapsed 
    137189 
    138     from constraint_tools import verify_constraints_satisfied 
     190    from mystic.constraint_tools import verify_constraints_satisfied 
    139191    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    140192 
     
    150202    time_before = time.time() 
    151203 
    152     from differential_evolution import DifferentialEvolutionSolver2 
     204    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    153205    from mystic.termination import VTR 
    154206    from mystic.termination import CandidateRelativeTolerance as CRT 
     207    from mystic.termination import ChangeOverGeneration as COG 
    155208    from mystic.strategy import Rand1Bin 
    156209    solver = DifferentialEvolutionSolver2(ndim, npop) 
     
    159212    solver.enable_signal_handler() 
    160213    #term = VTR() 
    161     term = CRT() 
     214    #term = CRT() 
     215    term = COG() 
    162216    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    163217                constraints_method='penalty', strategy=Rand1Bin) 
     
    169223    print "Time elapsed=", time_elapsed 
    170224 
    171     from constraint_tools import verify_constraints_satisfied 
     225    from mystic.constraint_tools import verify_constraints_satisfied 
    172226    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    173227 
     
    183237    time_before = time.time() 
    184238 
    185     from scipy_optimize import NelderMeadSimplexSolver 
     239    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    186240    from mystic.termination import VTR 
    187241    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    203257    print "Time elapsed=", time_elapsed 
    204258 
    205     from constraint_tools import verify_constraints_satisfied 
     259    from mystic.constraint_tools import verify_constraints_satisfied 
    206260    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    207261 
     
    217271    time_before = time.time() 
    218272 
    219     from scipy_optimize import PowellDirectionalSolver 
    220     from mystic.termination import VTR 
     273    from mystic.scipy_optimize import PowellDirectionalSolver 
     274    from mystic.termination import VTR 
     275    from mystic.termination import NormalizedChangeOverGeneration as NCOG 
    221276    solver = PowellDirectionalSolver(ndim) 
    222277    solver.SetStrictRanges(lb, ub)   
    223278    solver.SetInitialPoints(x0) 
    224279    solver.enable_signal_handler() 
    225     term = VTR() 
     280    #term = VTR() 
     281    term = NCOG() 
    226282    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    227283                constraints_method='penalty') 
     
    234290    print "Time elapsed=", time_elapsed 
    235291 
    236     from constraint_tools import verify_constraints_satisfied 
     292    from mystic.constraint_tools import verify_constraints_satisfied 
    237293    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    238294 
     
    247303    time_before = time.time() 
    248304 
    249     from scipy_bfgs import BFGSSolver 
    250     from mystic.termination import VTR 
     305    from mystic.scipy_bfgs import BFGSSolver 
     306    from mystic.termination import VTR 
     307    from mystic.termination import Gradientmystic.termination 
    251308    solver = BFGSSolver(ndim) 
    252309    solver.SetStrictRanges(lb, ub)       
    253310    solver.SetInitialPoints(x0) 
    254311    solver.enable_signal_handler() 
    255     term = VTR() 
     312    #term = VTR() 
     313    term = Gradientmystic.termination() 
    256314    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    257315                constraints_method='penalty')#, penalty=1e3) 
     
    264322    print "Time elapsed=", time_elapsed 
    265323 
    266     from constraint_tools import verify_constraints_satisfied 
     324    from mystic.constraint_tools import verify_constraints_satisfied 
    267325    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    268326 
     
    277335    time_before = time.time() 
    278336 
    279     from scipy_ncg import NCGSolver 
    280     from mystic.termination import VTR 
    281     from termination import SolutionImprovement 
     337    from mystic.scipy_ncg import NCGSolver 
     338    from mystic.termination import VTR 
     339    from mystic.termination import SolutionImprovement 
    282340    from mystic.termination import ChangeOverGeneration as COG 
    283341    from mystic.termination import NormalizedChangeOverGeneration as NCOG 
     
    286344    solver.SetInitialPoints(x0) 
    287345    solver.enable_signal_handler() 
    288     term = VTR() 
    289     #term = SolutionImprovement() # doesn't help 
     346    #term = VTR() 
     347    term = SolutionImprovement() # doesn't help 
    290348    #term = COG() # doesn't work either 
    291349    #term = NCOG() # doesn't work either 
     
    300358    print "Time elapsed=", time_elapsed 
    301359 
    302     from constraint_tools import verify_constraints_satisfied 
     360    from mystic.constraint_tools import verify_constraints_satisfied 
    303361    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    304362 
     
    313371    time_before = time.time() 
    314372 
    315     from scipy_cg import CGSolver 
    316     from mystic.termination import VTR 
    317     from termination import GradientTermination 
     373    from mystic.scipy_cg import CGSolver 
     374    from mystic.termination import VTR 
     375    from mystic.termination import Gradientmystic.termination 
    318376    solver = CGSolver(ndim) 
    319377    solver.SetStrictRanges(lb, ub)       
    320378    solver.SetInitialPoints(x0) 
    321379    solver.enable_signal_handler() 
    322     term = VTR() 
    323     #term = GradientTermination() 
     380    #term = VTR() 
     381    term = Gradientmystic.termination() 
    324382    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    325383                constraints_method='penalty')#, penalty=1e2) 
     
    332390    print "Time elapsed=", time_elapsed 
    333391 
    334     from constraint_tools import verify_constraints_satisfied 
     392    from mystic.constraint_tools import verify_constraints_satisfied 
    335393    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    336394 
     
    347405    time_before = time.time() 
    348406 
    349     from differential_evolution import DifferentialEvolutionSolver 
    350     from mystic.termination import VTR 
     407    from mystic.differential_evolution import DifferentialEvolutionSolver 
     408    from mystic.termination import VTR 
     409    from mystic.termination import ChangeOverGeneration as COG 
     410    from mystic.strategy import Rand1Bin 
    351411    solver = DifferentialEvolutionSolver(ndim, npop) 
    352412    solver.SetStrictRanges(lb, ub)       
    353413    solver.SetInitialPoints(x0) 
    354414    solver.enable_signal_handler() 
    355     term = VTR() 
    356     solver.Solve(costfunc, term, constraints=constraints_string, \ 
    357                 constraints_method='auglag') 
    358     soln = solver.Solution() 
    359  
    360     time_elapsed = time.time() - time_before 
    361  
    362     print "soln=", soln 
    363     print "f value =", costfunc(soln) 
    364     print "Time elapsed=", time_elapsed 
    365  
    366     from constraint_tools import verify_constraints_satisfied 
     415    #term = VTR() 
     416    term = COG() 
     417    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     418                constraints_method='auglag', strategy=Rand1Bin) 
     419    soln = solver.Solution() 
     420 
     421    time_elapsed = time.time() - time_before 
     422 
     423    print "soln=", soln 
     424    print "f value =", costfunc(soln) 
     425    print "Time elapsed=", time_elapsed 
     426 
     427    from mystic.constraint_tools import verify_constraints_satisfied 
    367428    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    368429 
     
    377438    time_before = time.time() 
    378439 
    379     from differential_evolution import DifferentialEvolutionSolver2 
     440    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    380441    from mystic.termination import VTR 
    381442    from mystic.termination import CandidateRelativeTolerance as CRT 
     443    from mystic.termination import ChangeOverGeneration as COG 
    382444    from mystic.strategy import Rand1Bin 
    383445    solver = DifferentialEvolutionSolver2(ndim, npop) 
     
    385447    solver.SetInitialPoints(x0) 
    386448    solver.enable_signal_handler() 
    387     term = VTR() 
     449    #term = VTR() 
    388450    #term = CRT() 
    389     solver.Solve(costfunc, term, constraints=constraints_string, \ 
    390                 constraints_method='auglag')#, strategy=Rand1Bin) 
    391     soln = solver.Solution() 
    392  
    393     time_elapsed = time.time() - time_before 
    394  
    395     print "soln=", soln 
    396     print "f value =", costfunc(soln) 
    397     print "Time elapsed=", time_elapsed 
    398  
    399     from constraint_tools import verify_constraints_satisfied 
     451    term = COG() 
     452    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     453                constraints_method='auglag', strategy=Rand1Bin) 
     454    soln = solver.Solution() 
     455 
     456    time_elapsed = time.time() - time_before 
     457 
     458    print "soln=", soln 
     459    print "f value =", costfunc(soln) 
     460    print "Time elapsed=", time_elapsed 
     461 
     462    from mystic.constraint_tools import verify_constraints_satisfied 
    400463    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    401464 
     
    411474    time_before = time.time() 
    412475 
    413     from scipy_optimize import NelderMeadSimplexSolver 
     476    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    414477    from mystic.termination import VTR 
    415478    from mystic.termination import ChangeOverGeneration as COG 
    416479    from mystic.termination import NormalizedChangeOverGeneration as NCOG 
     480    from mystic.termination import CandidateRelativeTolerance as CRT 
    417481    solver = NelderMeadSimplexSolver(ndim) 
    418482    solver.SetStrictRanges(lb, ub)       
    419483    solver.SetInitialPoints(x0) 
    420484    solver.enable_signal_handler() 
    421     term = VTR() 
     485    #term = VTR() 
    422486    #term = COG() 
    423487    #term = NCOG() # Works poorly 
     488    term = CRT() 
    424489    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    425490                constraints_method='auglag') # Results improve with larger rh,rg 
     
    431496    print "Time elapsed=", time_elapsed 
    432497 
    433     from constraint_tools import verify_constraints_satisfied 
     498    from mystic.constraint_tools import verify_constraints_satisfied 
    434499    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    435500 
     
    445510    time_before = time.time() 
    446511 
    447     from scipy_optimize import PowellDirectionalSolver 
    448     from mystic.termination import VTR 
     512    from mystic.scipy_optimize import PowellDirectionalSolver 
     513    from mystic.termination import VTR 
     514    from mystic.termination import NormalizedChangeOverGeneration as NCOG 
    449515    solver = PowellDirectionalSolver(ndim) 
    450516    solver.SetStrictRanges(lb, ub)       
    451517    solver.SetInitialPoints(x0) 
    452518    solver.enable_signal_handler() 
    453     term = VTR() 
     519    #term = VTR() 
     520    term = NCOG() 
    454521    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    455522                constraints_method='auglag') 
     
    461528    print "Time elapsed=", time_elapsed 
    462529 
    463     from constraint_tools import verify_constraints_satisfied 
     530    from mystic.constraint_tools import verify_constraints_satisfied 
    464531    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    465532 
     
    474541    time_before = time.time() 
    475542 
    476     from scipy_bfgs import BFGSSolver 
    477     from mystic.termination import VTR 
    478     from termination import GradientTermination 
     543    from mystic.scipy_bfgs import BFGSSolver 
     544    from mystic.termination import VTR 
     545    from mystic.termination import Gradientmystic.termination 
    479546    solver = BFGSSolver(ndim) 
    480547    solver.SetStrictRanges(lb, ub)       
    481548    solver.SetInitialPoints(x0) 
    482549    solver.enable_signal_handler() 
    483     term = VTR() 
    484     #term = GradientTermination() # doesn't seem to help 
     550    #term = VTR() 
     551    term = Gradientmystic.termination() # doesn't seem to help 
    485552    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    486553                constraints_method='auglag') 
     
    493560    print "Time elapsed=", time_elapsed 
    494561 
    495     from constraint_tools import verify_constraints_satisfied 
     562    from mystic.constraint_tools import verify_constraints_satisfied 
    496563    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    497564 
     
    506573    time_before = time.time() 
    507574 
    508     from scipy_ncg import NCGSolver 
    509     from mystic.termination import VTR 
     575    from mystic.scipy_ncg import NCGSolver 
     576    from mystic.termination import VTR 
     577    from mystic.termination import SolutionImprovement 
    510578    solver = NCGSolver(ndim) 
    511579    solver.SetStrictRanges(lb, ub)       
    512580    solver.SetInitialPoints(x0) 
    513581    solver.enable_signal_handler() 
    514     term = VTR() 
     582    #term = VTR() 
     583    term = SolutionImprovement() 
    515584    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    516585                constraints_method='auglag') 
     
    522591    print "Time elapsed=", time_elapsed 
    523592 
    524     from constraint_tools import verify_constraints_satisfied 
     593    from mystic.constraint_tools import verify_constraints_satisfied 
    525594    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    526595 
     
    535604    time_before = time.time() 
    536605 
    537     from scipy_cg import CGSolver 
    538     from mystic.termination import VTR 
     606    from mystic.scipy_cg import CGSolver 
     607    from mystic.termination import VTR 
     608    from mystic.termination import Gradientmystic.termination 
    539609    solver = CGSolver(ndim) 
    540610    solver.SetStrictRanges(lb, ub)       
    541611    solver.SetInitialPoints(x0) 
    542612    solver.enable_signal_handler() 
    543     term = VTR() 
     613    #term = VTR() 
     614    term = Gradientmystic.termination() 
    544615    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    545616                constraints_method='auglag') 
     
    552623    print "Time elapsed=", time_elapsed 
    553624 
    554     from constraint_tools import verify_constraints_satisfied 
     625    from mystic.constraint_tools import verify_constraints_satisfied 
    555626    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    556627 
     
    568639    time_before = time.time() 
    569640 
    570     from differential_evolution import DifferentialEvolutionSolver 
    571     from mystic.termination import VTR 
     641    from mystic.differential_evolution import DifferentialEvolutionSolver 
     642    from mystic.termination import VTR 
     643    from mystic.termination import ChangeOverGeneration as COG 
     644    from mystic.strategy import Rand1Bin 
    572645    solver = DifferentialEvolutionSolver(ndim, npop) 
    573646    solver.SetStrictRanges(lb, ub)       
    574647    solver.SetInitialPoints(x0) 
    575648    solver.enable_signal_handler() 
    576     term = VTR() 
    577     solver.Solve(costfunc, term, constraints=constraints_string, \ 
    578                 constraints_method='direct', suggestedorder=(2, 1, 3)) 
    579     soln = solver.Solution() 
    580  
    581     time_elapsed = time.time() - time_before 
    582  
    583     print "soln=", soln 
    584     print "f value =", costfunc(soln) 
    585     print "Time elapsed=", time_elapsed 
    586  
    587     from constraint_tools import verify_constraints_satisfied 
     649    #term = VTR() 
     650    term = COG() 
     651    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     652                constraints_method='direct', suggestedorder=(2, 1, 3),\ 
     653                strategy=Rand1Bin) 
     654    soln = solver.Solution() 
     655 
     656    time_elapsed = time.time() - time_before 
     657 
     658    print "soln=", soln 
     659    print "f value =", costfunc(soln) 
     660    print "Time elapsed=", time_elapsed 
     661 
     662    from mystic.constraint_tools import verify_constraints_satisfied 
    588663    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    589664 
     
    598673    time_before = time.time() 
    599674 
    600     from differential_evolution import DifferentialEvolutionSolver2 
    601     from mystic.termination import VTR 
     675    from mystic.differential_evolution import DifferentialEvolutionSolver2 
     676    from mystic.termination import VTR 
     677    from mystic.termination import ChangeOverGeneration as COG 
     678    from mystic.strategy import Rand1Bin 
     679    #npop = 50 
    602680    solver = DifferentialEvolutionSolver2(ndim, npop) 
    603681    solver.SetStrictRanges(lb, ub)       
    604682    solver.SetInitialPoints(x0) 
    605683    solver.enable_signal_handler() 
    606     term = VTR() 
    607     solver.Solve(costfunc, term, constraints=constraints_string, \ 
    608                 constraints_method='direct', suggestedorder=(2, 1, 3)) 
    609     soln = solver.Solution() 
    610  
    611     time_elapsed = time.time() - time_before 
    612  
    613     print "soln=", soln 
    614     print "f value =", costfunc(soln) 
    615     print "Time elapsed=", time_elapsed 
    616  
    617     from constraint_tools import verify_constraints_satisfied 
     684    #term = VTR() 
     685    term = COG() 
     686    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     687                constraints_method='direct', suggestedorder=(2, 1, 3),\ 
     688                strategy=Rand1Bin) 
     689    soln = solver.Solution() 
     690 
     691    time_elapsed = time.time() - time_before 
     692 
     693    print "soln=", soln 
     694    print "f value =", costfunc(soln) 
     695    print "Time elapsed=", time_elapsed 
     696 
     697    from mystic.constraint_tools import verify_constraints_satisfied 
    618698    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    619699 
     
    629709    time_before = time.time() 
    630710 
    631     from scipy_optimize import NelderMeadSimplexSolver 
     711    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    632712    from mystic.termination import VTR 
    633713    from mystic.termination import ChangeOverGeneration as COG 
    634714    from mystic.termination import NormalizedChangeOverGeneration as NCOG 
     715    from mystic.termination import CandidateRelativeTolerance as CRT 
    635716    solver = NelderMeadSimplexSolver(ndim) 
    636717    solver.SetStrictRanges(lb, ub)       
    637718    solver.SetInitialPoints(x0) 
    638719    solver.enable_signal_handler() 
    639     term = VTR() 
     720    #term = VTR() 
    640721    #term = COG() 
    641     #term = NCOG()  
     722    #term = NCOG() 
     723    term = CRT() 
    642724    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    643725                constraints_method='direct', suggestedorder=(2, 1, 3))  
     
    649731    print "Time elapsed=", time_elapsed 
    650732 
    651     from constraint_tools import verify_constraints_satisfied 
     733    from mystic.constraint_tools import verify_constraints_satisfied 
    652734    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    653735 
     
    663745    time_before = time.time() 
    664746 
    665     from scipy_optimize import PowellDirectionalSolver 
    666     from mystic.termination import VTR 
     747    from mystic.scipy_optimize import PowellDirectionalSolver 
     748    from mystic.termination import VTR 
     749    from mystic.termination import NormalizedChangeOverGeneration as NCOG 
    667750    solver = PowellDirectionalSolver(ndim) 
    668751    solver.SetStrictRanges(lb, ub)       
    669752    solver.SetInitialPoints(x0) 
    670753    solver.enable_signal_handler() 
    671     term = VTR() 
     754    #term = VTR() 
     755    term = NCOG() 
    672756    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    673757                constraints_method='direct', suggestedorder=(2, 1, 3)) 
     
    679763    print "Time elapsed=", time_elapsed 
    680764 
    681     from constraint_tools import verify_constraints_satisfied 
     765    from mystic.constraint_tools import verify_constraints_satisfied 
    682766    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    683767 
     
    692776    time_before = time.time() 
    693777 
    694     from scipy_bfgs import BFGSSolver 
    695     from mystic.termination import VTR 
    696     from termination import GradientTermination 
     778    from mystic.scipy_bfgs import BFGSSolver 
     779    from mystic.termination import VTR 
     780    from mystic.termination import Gradientmystic.termination 
    697781    solver = BFGSSolver(ndim) 
    698782    solver.SetStrictRanges(lb, ub)       
    699783    solver.SetInitialPoints(x0) 
    700784    solver.enable_signal_handler() 
    701     term = VTR() 
    702     #term = GradientTermination()  
     785    #term = VTR() 
     786    term = Gradientmystic.termination()  
    703787    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    704788                constraints_method='direct', suggestedorder=(2, 1, 3)) 
     
    711795    print "Time elapsed=", time_elapsed 
    712796 
    713     from constraint_tools import verify_constraints_satisfied 
     797    from mystic.constraint_tools import verify_constraints_satisfied 
    714798    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    715799 
     
    724808    time_before = time.time() 
    725809 
    726     from scipy_ncg import NCGSolver 
    727     from mystic.termination import VTR 
     810    from mystic.scipy_ncg import NCGSolver 
     811    from mystic.termination import VTR 
     812    from mystic.termination import SolutionImprovement 
    728813    solver = NCGSolver(ndim) 
    729814    solver.SetStrictRanges(lb, ub)       
    730815    solver.SetInitialPoints(x0) 
    731816    solver.enable_signal_handler() 
    732     term = VTR() 
     817    #term = VTR() 
     818    term = SolutionImprovement() 
    733819    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    734820                constraints_method='direct', suggestedorder=(2, 1, 3)) 
     
    740826    print "Time elapsed=", time_elapsed 
    741827 
    742     from constraint_tools import verify_constraints_satisfied 
     828    from mystic.constraint_tools import verify_constraints_satisfied 
    743829    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    744830 
     
    753839    time_before = time.time() 
    754840 
    755     from scipy_cg import CGSolver 
    756     from mystic.termination import VTR 
     841    from mystic.scipy_cg import CGSolver 
     842    from mystic.termination import VTR 
     843    from mystic.termination import Gradientmystic.termination 
    757844    solver = CGSolver(ndim) 
    758845    solver.SetStrictRanges(lb, ub)       
    759846    solver.SetInitialPoints(x0) 
    760847    solver.enable_signal_handler() 
    761     term = VTR() 
     848    #term = VTR() 
     849    term = Gradientmystic.termination() 
    762850    solver.Solve(costfunc, term, constraints=constraints_string, \ 
    763851                constraints_method='direct', suggestedorder=(2, 1, 3)) 
     
    770858    print "Time elapsed=", time_elapsed 
    771859 
    772     from constraint_tools import verify_constraints_satisfied 
     860    from mystic.constraint_tools import verify_constraints_satisfied 
    773861    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    774862 
     
    776864 
    777865if __name__ == '__main__': 
    778     # below results are with randominitialpoints. all solvers work well with 
    779     # penalty method if x0=[1., 2., 5.] (i.e. close to solution) 
    780     test_diffev_penalty() # bad with x0=[0.8, 1.2, 0.7], fixed with Rand1Bin 
    781     test_diffev2_penalty() # bad with x0=[0.8, 1.2, 0.7], fixed with Rand1Bin 
     866    test_diffev_penalty() # needs Rand1Bin 
     867    test_diffev2_penalty() # needs Rand1Bin 
    782868    test_neldermead_penalty()  
    783869    test_powelldirectional_penalty() 
    784     test_bfgs_penalty() # sometimes works if penalty=1e3, but depends on x0 
    785     test_ncg_penalty() # bad answer 
     870    test_bfgs_penalty() # stuck with x0=[0.8, 1.2, 0.7], ok with [3., -0.5, 1] 
     871    test_ncg_penalty() # gets stuck, NaN 
    786872    test_cg_penalty() # gets stuck 
    787873 
    788     test_diffev_auglag()  
     874    test_diffev_auglag() # bad with x0=[3., -0.5, 1.], fixed with Rand1Bin 
    789875    test_diffev2_auglag() # bad with x0=[3., -0.5, 1.], fixed with Rand1Bin 
    790876    test_neldermead_auglag() 
    791877    test_powelldirectional_auglag() 
    792     test_bfgs_auglag() # gets stuck or gives bad answer 
     878    test_bfgs_auglag() # stuck with x0=[0.8, 1.2, 0.7], ok with [3., -0.5, 1.] 
    793879    test_ncg_auglag() # bad answer. sometimes gets stuck. 
    794880    test_cg_auglag() # gets stuck 
    795881 
    796     test_diffev_direct() # bad 
    797     test_diffev2_direct() # bad 
     882    test_diffev_direct() # needs Rand1Bin 
     883    test_diffev2_direct() # needs Rand1Bin; with x0=[0.8, 1.2, 0.7], also needs 
     884                          # larger npop (> 50) 
    798885    test_neldermead_direct() 
    799886    test_powelldirectional_direct()  
    800     test_bfgs_direct() # bad 
     887    test_bfgs_direct() # stuck with x0=[0.8, 1.2, 0.7], ok with [3., -0.5, 1.] 
    801888    test_ncg_direct() # NaN 
    802889    test_cg_direct() # bad 
  • branches/alta/mystic-0.2a1/constrained_tests/test_constraints_tp24.py

    r373 r376  
    1515 
    1616import numpy 
    17 from constraint_tools import verify_constraints_satisfied 
     17from mystic.constraint_tools import verify_constraints_satisfied 
    1818import time 
    1919 
     
    5454    time_before = time.time() 
    5555 
    56     from differential_evolution import DifferentialEvolutionSolver 
     56    from mystic.differential_evolution import DifferentialEvolutionSolver 
    5757    from mystic.termination import CandidateRelativeTolerance as CRT 
    5858    from mystic.termination import ChangeOverGeneration as COG 
     
    7272    print "Time elapsed=", time_elapsed 
    7373 
    74     from constraint_tools import verify_constraints_satisfied 
     74    from mystic.constraint_tools import verify_constraints_satisfied 
    7575    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    7676 
     
    8686    time_before = time.time() 
    8787 
    88     from differential_evolution import DifferentialEvolutionSolver2 
     88    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    8989    from mystic.termination import ChangeOverGeneration as COG 
    9090    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    104104    print "Time elapsed=", time_elapsed 
    105105 
    106     from constraint_tools import verify_constraints_satisfied 
     106    from mystic.constraint_tools import verify_constraints_satisfied 
    107107    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    108108 
     
    118118    time_before = time.time() 
    119119 
    120     from scipy_optimize import NelderMeadSimplexSolver 
     120    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    121121    from mystic.termination import ChangeOverGeneration as COG 
    122122    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    136136    print "Time elapsed=", time_elapsed 
    137137 
    138     from constraint_tools import verify_constraints_satisfied 
     138    from mystic.constraint_tools import verify_constraints_satisfied 
    139139    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    140140 
     
    150150    time_before = time.time() 
    151151 
    152     from scipy_optimize import PowellDirectionalSolver 
     152    from mystic.scipy_optimize import PowellDirectionalSolver 
    153153    #from mystic.termination import VTR 
    154154    from mystic.termination import ChangeOverGeneration as COG 
     
    169169    print "Time elapsed=", time_elapsed 
    170170 
    171     from constraint_tools import verify_constraints_satisfied 
     171    from mystic.constraint_tools import verify_constraints_satisfied 
    172172    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    173173 
     
    182182    time_before = time.time() 
    183183 
    184     from scipy_bfgs import BFGSSolver 
    185     from mystic.termination import GradientTermination 
     184    from mystic.scipy_bfgs import BFGSSolver 
     185    from mystic.termination import Gradientmystic.termination 
    186186    from mystic.termination import ChangeOverGeneration as COG 
    187187    solver = BFGSSolver(ndim) 
     
    189189    solver.SetInitialPoints(x0) 
    190190    solver.enable_signal_handler() 
    191     #term = GradientTermination() # does work well 
     191    #term = Gradientmystic.termination() # does work well 
    192192    term = COG() # works well 
    193193    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     
    201201    print "Time elapsed=", time_elapsed 
    202202 
    203     from constraint_tools import verify_constraints_satisfied 
     203    from mystic.constraint_tools import verify_constraints_satisfied 
    204204    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    205205 
     
    214214    time_before = time.time() 
    215215 
    216     from scipy_ncg import NCGSolver 
    217     from termination import SolutionImprovement 
    218     from termination import ChangeOverGeneration as COG 
    219     from termination import NormalizedChangeOverGeneration as NCOG 
     216    from mystic.scipy_ncg import NCGSolver 
     217    from mystic.termination import SolutionImprovement 
     218    from mystic.termination import ChangeOverGeneration as COG 
     219    from mystic.termination import NormalizedChangeOverGeneration as NCOG 
    220220    solver = NCGSolver(ndim) 
    221221       
     
    235235    print "Time elapsed=", time_elapsed 
    236236 
    237     from constraint_tools import verify_constraints_satisfied 
     237    from mystic.constraint_tools import verify_constraints_satisfied 
    238238    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    239239 
     
    248248    time_before = time.time() 
    249249 
    250     from scipy_cg import CGSolver 
    251     from termination import ChangeOverGeneration as COG 
    252     from termination import NormalizedChangeOverGeneration as NCOG 
    253     from mystic.termination import GradientTermination 
     250    from mystic.scipy_cg import CGSolver 
     251    from mystic.termination import ChangeOverGeneration as COG 
     252    from mystic.termination import NormalizedChangeOverGeneration as NCOG 
     253    from mystic.termination import Gradientmystic.termination 
    254254    solver = CGSolver(ndim) 
    255255       
     
    267267    print "Time elapsed=", time_elapsed 
    268268 
    269     from constraint_tools import verify_constraints_satisfied 
     269    from mystic.constraint_tools import verify_constraints_satisfied 
    270270    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    271271 
     
    282282    time_before = time.time() 
    283283 
    284     from differential_evolution import DifferentialEvolutionSolver 
     284    from mystic.differential_evolution import DifferentialEvolutionSolver 
    285285    from mystic.termination import VTR 
    286286    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    301301    print "Time elapsed=", time_elapsed 
    302302 
    303     from constraint_tools import verify_constraints_satisfied 
     303    from mystic.constraint_tools import verify_constraints_satisfied 
    304304    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    305305 
     
    314314    time_before = time.time() 
    315315 
    316     from differential_evolution import DifferentialEvolutionSolver2 
     316    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    317317    from mystic.termination import CandidateRelativeTolerance as CRT 
    318318    from mystic.termination import ChangeOverGeneration as COG 
     
    333333    print "Time elapsed=", time_elapsed 
    334334 
    335     from constraint_tools import verify_constraints_satisfied 
     335    from mystic.constraint_tools import verify_constraints_satisfied 
    336336    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    337337 
     
    347347    time_before = time.time() 
    348348 
    349     from scipy_optimize import NelderMeadSimplexSolver 
     349    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    350350    from mystic.termination import ChangeOverGeneration as COG 
    351351    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    365365    print "Time elapsed=", time_elapsed 
    366366 
    367     from constraint_tools import verify_constraints_satisfied 
     367    from mystic.constraint_tools import verify_constraints_satisfied 
    368368    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    369369 
     
    379379    time_before = time.time() 
    380380 
    381     from scipy_optimize import PowellDirectionalSolver 
     381    from mystic.scipy_optimize import PowellDirectionalSolver 
    382382    from mystic.termination import VTR 
    383383    from mystic.termination import ChangeOverGeneration as COG 
     
    397397    print "Time elapsed=", time_elapsed 
    398398 
    399     from constraint_tools import verify_constraints_satisfied 
     399    from mystic.constraint_tools import verify_constraints_satisfied 
    400400    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    401401 
     
    410410    time_before = time.time() 
    411411 
    412     from scipy_bfgs import BFGSSolver 
    413     from termination import GradientTermination 
     412    from mystic.scipy_bfgs import BFGSSolver 
     413    from mystic.termination import Gradientmystic.termination 
    414414    from mystic.termination import ChangeOverGeneration as COG 
    415415    solver = BFGSSolver(ndim) 
     
    417417    solver.SetInitialPoints(x0) 
    418418    solver.enable_signal_handler() 
    419     #term = GradientTermination() # works well 
     419    #term = Gradientmystic.termination() # works well 
    420420    term = COG() # works well 
    421421    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     
    429429    print "Time elapsed=", time_elapsed 
    430430 
    431     from constraint_tools import verify_constraints_satisfied 
     431    from mystic.constraint_tools import verify_constraints_satisfied 
    432432    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    433433 
     
    442442    time_before = time.time() 
    443443 
    444     from scipy_ncg import NCGSolver 
    445     from termination import SolutionImprovement 
     444    from mystic.scipy_ncg import NCGSolver 
     445    from mystic.termination import SolutionImprovement 
    446446    from mystic.termination import ChangeOverGeneration as COG 
    447447    solver = NCGSolver(ndim) 
     
    460460    print "Time elapsed=", time_elapsed 
    461461 
    462     from constraint_tools import verify_constraints_satisfied 
     462    from mystic.constraint_tools import verify_constraints_satisfied 
    463463    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    464464 
     
    473473    time_before = time.time() 
    474474 
    475     from scipy_cg import CGSolver 
    476     from termination import ChangeOverGeneration as COG 
     475    from mystic.scipy_cg import CGSolver 
     476    from mystic.termination import ChangeOverGeneration as COG 
    477477    solver = CGSolver(ndim) 
    478478       
     
    490490    print "Time elapsed=", time_elapsed 
    491491 
    492     from constraint_tools import verify_constraints_satisfied 
     492    from mystic.constraint_tools import verify_constraints_satisfied 
    493493    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    494494 
     
    505505    time_before = time.time() 
    506506 
    507     from differential_evolution import DifferentialEvolutionSolver 
     507    from mystic.differential_evolution import DifferentialEvolutionSolver 
    508508    from mystic.termination import ChangeOverGeneration as COG 
    509509    from mystic.termination import NormalizedChangeOverGeneration as NCOG 
     
    525525    print "Time elapsed=", time_elapsed 
    526526 
    527     from constraint_tools import verify_constraints_satisfied 
     527    from mystic.constraint_tools import verify_constraints_satisfied 
    528528    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    529529 
     
    539539    time_before = time.time() 
    540540 
    541     from differential_evolution import DifferentialEvolutionSolver2 
     541    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    542542    from mystic.termination import CandidateRelativeTolerance as CRT 
    543543    from mystic.termination import ChangeOverGeneration as COG 
     
    557557    print "Time elapsed=", time_elapsed 
    558558 
    559     from constraint_tools import verify_constraints_satisfied 
     559    from mystic.constraint_tools import verify_constraints_satisfied 
    560560    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    561561 
     
    571571    time_before = time.time() 
    572572 
    573     from scipy_optimize import NelderMeadSimplexSolver 
     573    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    574574    from mystic.termination import ChangeOverGeneration as COG 
    575575    from mystic.termination import NormalizedChangeOverGeneration as NCOG 
     
    591591    print "Time elapsed=", time_elapsed 
    592592 
    593     from constraint_tools import verify_constraints_satisfied 
     593    from mystic.constraint_tools import verify_constraints_satisfied 
    594594    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    595595 
     
    605605    time_before = time.time() 
    606606 
    607     from scipy_optimize import PowellDirectionalSolver 
     607    from mystic.scipy_optimize import PowellDirectionalSolver 
    608608    from mystic.termination import VTR 
    609609    from mystic.termination import ChangeOverGeneration as COG 
     
    624624    print "Time elapsed=", time_elapsed 
    625625 
    626     from constraint_tools import verify_constraints_satisfied 
     626    from mystic.constraint_tools import verify_constraints_satisfied 
    627627    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    628628 
     
    637637    time_before = time.time() 
    638638 
    639     from scipy_bfgs import BFGSSolver 
    640     from termination import GradientTermination 
     639    from mystic.scipy_bfgs import BFGSSolver 
     640    from mystic.termination import Gradientmystic.termination 
    641641    from mystic.termination import ChangeOverGeneration as COG 
    642642    solver = BFGSSolver(ndim) 
     
    644644    solver.SetInitialPoints(x0) 
    645645    solver.enable_signal_handler() 
    646     term = GradientTermination() # also doesn't work 
     646    term = Gradientmystic.termination() # also doesn't work 
    647647    #term = COG() # doesn't work well either 
    648648    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     
    656656    print "Time elapsed=", time_elapsed 
    657657 
    658     from constraint_tools import verify_constraints_satisfied 
     658    from mystic.constraint_tools import verify_constraints_satisfied 
    659659    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    660660 
     
    669669    time_before = time.time() 
    670670 
    671     from scipy_ncg import NCGSolver 
    672     from termination import SolutionImprovement 
     671    from mystic.scipy_ncg import NCGSolver 
     672    from mystic.termination import SolutionImprovement 
    673673    from mystic.termination import ChangeOverGeneration as COG 
    674674    solver = NCGSolver(ndim) 
     
    688688    print "Time elapsed=", time_elapsed 
    689689 
    690     from constraint_tools import verify_constraints_satisfied 
     690    from mystic.constraint_tools import verify_constraints_satisfied 
    691691    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    692692 
     
    701701    time_before = time.time() 
    702702 
    703     from scipy_cg import CGSolver 
    704     from termination import GradientTermination  
     703    from mystic.scipy_cg import CGSolver 
     704    from mystic.termination import Gradientmystic.termination  
    705705    from mystic.termination import ChangeOverGeneration as COG 
    706706    solver = CGSolver(ndim) 
     
    708708    solver.SetInitialPoints(x0) 
    709709    solver.enable_signal_handler() 
    710     term = GradientTermination() # doesn't work well 
     710    term = Gradientmystic.termination() # doesn't work well 
    711711    #term = COG() # doesn't work well 
    712712    solver.Solve(costfunc, term, constraints=constraints_string, \ 
     
    720720    print "Time elapsed=", time_elapsed 
    721721 
    722     from constraint_tools import verify_constraints_satisfied 
     722    from mystic.constraint_tools import verify_constraints_satisfied 
    723723    print verify_constraints_satisfied(constraints_string, soln, disp=False) 
    724724 
  • branches/alta/mystic-0.2a1/constrained_tests/test_constraints_tp6.py

    r373 r376  
    129129 
    130130import numpy 
    131 from constraint_tools import verify_constraints_satisfied 
     131from mystic.constraint_tools import verify_constraints_satisfied 
    132132import time 
    133133 
     
    162162    time_before = time.time() 
    163163 
    164     from differential_evolution import DifferentialEvolutionSolver 
     164    from mystic.differential_evolution import DifferentialEvolutionSolver 
    165165    from mystic.termination import VTR 
    166166    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    182182    print "Time elapsed=", time_elapsed 
    183183 
    184     from constraint_tools import verify_constraints_satisfied 
     184    from mystic.constraint_tools import verify_constraints_satisfied 
    185185    print verify_constraints_satisfied(constraints_string, soln) 
    186186 
     
    196196    time_before = time.time() 
    197197 
    198     from differential_evolution import DifferentialEvolutionSolver2 
     198    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    199199    from mystic.termination import VTR 
    200200    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    221221    print "Time elapsed=", time_elapsed 
    222222 
    223     from constraint_tools import verify_constraints_satisfied 
     223    from mystic.constraint_tools import verify_constraints_satisfied 
    224224    print verify_constraints_satisfied(constraints_string, soln) 
    225225 
     
    235235    time_before = time.time() 
    236236 
    237     from scipy_optimize import NelderMeadSimplexSolver 
     237    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    238238    from mystic.termination import VTR 
    239239    from mystic.termination import ChangeOverGeneration as COG 
     
    257257    print "Time elapsed=", time_elapsed 
    258258 
    259     from constraint_tools import verify_constraints_satisfied 
     259    from mystic.constraint_tools import verify_constraints_satisfied 
    260260    print verify_constraints_satisfied(constraints_string, soln) 
    261261 
     
    271271    time_before = time.time() 
    272272 
    273     from scipy_optimize import PowellDirectionalSolver 
     273    from mystic.scipy_optimize import PowellDirectionalSolver 
    274274    from mystic.termination import VTR 
    275275    from mystic.termination import ChangeOverGeneration as COG 
     
    292292    print "Time elapsed=", time_elapsed 
    293293 
    294     from constraint_tools import verify_constraints_satisfied 
     294    from mystic.constraint_tools import verify_constraints_satisfied 
    295295    print verify_constraints_satisfied(constraints_string, soln) 
    296296 
     
    305305    time_before = time.time() 
    306306 
    307     from scipy_bfgs import BFGSSolver 
     307    from mystic.scipy_bfgs import BFGSSolver 
    308308    from mystic.termination import VTR 
    309309    from mystic.termination import GradientTermination 
     
    326326    print "Time elapsed=", time_elapsed 
    327327 
    328     from constraint_tools import verify_constraints_satisfied 
     328    from mystic.constraint_tools import verify_constraints_satisfied 
    329329    print verify_constraints_satisfied(constraints_string, soln) 
    330330 
     
    339339    time_before = time.time() 
    340340 
    341     from scipy_ncg import NCGSolver 
     341    from mystic.scipy_ncg import NCGSolver 
    342342    from mystic.termination import VTR 
    343343    from mystic.termination import ChangeOverGeneration as COG 
     
    360360    print "Time elapsed=", time_elapsed 
    361361 
    362     from constraint_tools import verify_constraints_satisfied 
     362    from mystic.constraint_tools import verify_constraints_satisfied 
    363363    print verify_constraints_satisfied(constraints_string, soln) 
    364364 
     
    373373    time_before = time.time() 
    374374 
    375     from scipy_cg import CGSolver 
     375    from mystic.scipy_cg import CGSolver 
    376376    from mystic.termination import VTR 
    377377    from mystic.termination import GradientTermination 
     
    396396    print "Time elapsed=", time_elapsed 
    397397 
    398     from constraint_tools import verify_constraints_satisfied 
     398    from mystic.constraint_tools import verify_constraints_satisfied 
    399399    print verify_constraints_satisfied(constraints_string, soln) 
    400400 
     
    411411    time_before = time.time() 
    412412 
    413     from differential_evolution import DifferentialEvolutionSolver 
     413    from mystic.differential_evolution import DifferentialEvolutionSolver 
    414414    from mystic.termination import VTR 
    415415    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    430430    print "Time elapsed=", time_elapsed 
    431431 
    432     from constraint_tools import verify_constraints_satisfied 
     432    from mystic.constraint_tools import verify_constraints_satisfied 
    433433    print verify_constraints_satisfied(constraints_string, soln) 
    434434 
     
    443443    time_before = time.time() 
    444444 
    445     from differential_evolution import DifferentialEvolutionSolver2 
     445    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    446446    from mystic.termination import VTR 
    447447    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    462462    print "Time elapsed=", time_elapsed 
    463463 
    464     from constraint_tools import verify_constraints_satisfied 
     464    from mystic.constraint_tools import verify_constraints_satisfied 
    465465    print verify_constraints_satisfied(constraints_string, soln) 
    466466 
     
    476476    time_before = time.time() 
    477477 
    478     from scipy_optimize import NelderMeadSimplexSolver 
     478    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    479479    from mystic.termination import VTR 
    480480    from mystic.termination import ChangeOverGeneration as COG 
     
    494494    print "Time elapsed=", time_elapsed 
    495495 
    496     from constraint_tools import verify_constraints_satisfied 
     496    from mystic.constraint_tools import verify_constraints_satisfied 
    497497    print verify_constraints_satisfied(constraints_string, soln) 
    498498 
     
    508508    time_before = time.time() 
    509509 
    510     from scipy_optimize import PowellDirectionalSolver 
     510    from mystic.scipy_optimize import PowellDirectionalSolver 
    511511    from mystic.termination import VTR 
    512512    from mystic.termination import ChangeOverGeneration as COG 
     
    526526    print "Time elapsed=", time_elapsed 
    527527 
    528     from constraint_tools import verify_constraints_satisfied 
     528    from mystic.constraint_tools import verify_constraints_satisfied 
    529529    print verify_constraints_satisfied(constraints_string, soln) 
    530530 
     
    539539    time_before = time.time() 
    540540 
    541     from scipy_bfgs import BFGSSolver 
     541    from mystic.scipy_bfgs import BFGSSolver 
    542542    from mystic.termination import VTR 
    543543    from mystic.termination import GradientTermination 
     
    558558    print "Time elapsed=", time_elapsed 
    559559 
    560     from constraint_tools import verify_constraints_satisfied 
     560    from mystic.constraint_tools import verify_constraints_satisfied 
    561561    print verify_constraints_satisfied(constraints_string, soln) 
    562562 
     
    571571    time_before = time.time() 
    572572 
    573     from scipy_ncg import NCGSolver 
     573    from mystic.scipy_ncg import NCGSolver 
    574574    from mystic.termination import VTR 
    575575    from mystic.termination import SolutionImprovement 
     
    591591    print "Time elapsed=", time_elapsed 
    592592 
    593     from constraint_tools import verify_constraints_satisfied 
     593    from mystic.constraint_tools import verify_constraints_satisfied 
    594594    print verify_constraints_satisfied(constraints_string, soln) 
    595595 
     
    604604    time_before = time.time() 
    605605 
    606     from scipy_cg import CGSolver 
     606    from mystic.scipy_cg import CGSolver 
    607607    from mystic.termination import VTR 
    608608    from mystic.termination import ChangeOverGeneration as COG 
     
    623623    print "Time elapsed=", time_elapsed 
    624624 
    625     from constraint_tools import verify_constraints_satisfied 
     625    from mystic.constraint_tools import verify_constraints_satisfied 
    626626    print verify_constraints_satisfied(constraints_string, soln) 
    627627 
  • branches/alta/mystic-0.2a1/constrained_tests/test_constraints_tp80.py

    r367 r376  
    178178    time_before = time.time() 
    179179 
    180     from differential_evolution import DifferentialEvolutionSolver 
     180    from mystic.differential_evolution import DifferentialEvolutionSolver 
    181181    from mystic.termination import VTR 
    182182    solver = DifferentialEvolutionSolver(ndim, npop) 
     
    208208    time_before = time.time() 
    209209 
    210     from differential_evolution import DifferentialEvolutionSolver2 
     210    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    211211    from mystic.termination import VTR 
    212212    solver = DifferentialEvolutionSolver2(ndim, npop) 
     
    238238    time_before = time.time() 
    239239 
    240     from scipy_optimize import NelderMeadSimplexSolver 
     240    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    241241    from mystic.termination import VTR 
    242242    solver = NelderMeadSimplexSolver(ndim) 
     
    268268    time_before = time.time() 
    269269 
    270     from scipy_optimize import PowellDirectionalSolver 
     270    from mystic.scipy_optimize import PowellDirectionalSolver 
    271271    from mystic.termination import VTR 
    272272    solver = PowellDirectionalSolver(ndim) 
     
    298298    time_before = time.time() 
    299299 
    300     from scipy_bfgs import BFGSSolver 
     300    from mystic.scipy_bfgs import BFGSSolver 
    301301    from mystic.termination import VTR 
    302302    solver = BFGSSolver(ndim) 
     
    328328    time_before = time.time() 
    329329 
    330     from scipy_ncg import NCGSolver 
     330    from mystic.scipy_ncg import NCGSolver 
    331331    from mystic.termination import VTR 
    332332    solver = NCGSolver(ndim) 
     
    358358    time_before = time.time() 
    359359 
    360     from scipy_cg import CGSolver 
     360    from mystic.scipy_cg import CGSolver 
    361361    from mystic.termination import VTR 
    362362    solver = CGSolver(ndim) 
     
    390390    time_before = time.time() 
    391391 
    392     from differential_evolution import DifferentialEvolutionSolver 
     392    from mystic.differential_evolution import DifferentialEvolutionSolver 
    393393    from mystic.termination import VTR 
    394394    solver = DifferentialEvolutionSolver(ndim, npop) 
     
    420420    time_before = time.time() 
    421421 
    422     from differential_evolution import DifferentialEvolutionSolver2 
     422    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    423423    from mystic.termination import VTR 
    424424    solver = DifferentialEvolutionSolver2(ndim, npop) 
     
    451451    time_before = time.time() 
    452452 
    453     from scipy_optimize import NelderMeadSimplexSolver 
     453    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    454454    from mystic.termination import VTR 
    455455    solver = NelderMeadSimplexSolver(ndim) 
     
    481481    time_before = time.time() 
    482482 
    483     from scipy_optimize import PowellDirectionalSolver 
     483    from mystic.scipy_optimize import PowellDirectionalSolver 
    484484    from mystic.termination import VTR 
    485485    solver = PowellDirectionalSolver(ndim) 
     
    510510    time_before = time.time() 
    511511 
    512     from scipy_bfgs import BFGSSolver 
     512    from mystic.scipy_bfgs import BFGSSolver 
    513513    from mystic.termination import VTR 
    514514    solver = BFGSSolver(ndim) 
     
    540540    time_before = time.time() 
    541541 
    542     from scipy_ncg import NCGSolver 
     542    from mystic.scipy_ncg import NCGSolver 
    543543    from mystic.termination import VTR 
    544544    solver = NCGSolver(ndim) 
     
    569569    time_before = time.time() 
    570570 
    571     from scipy_cg import CGSolver 
     571    from mystic.scipy_cg import CGSolver 
    572572    from mystic.termination import VTR 
    573573    solver = CGSolver(ndim) 
  • branches/alta/mystic-0.2a1/constrained_tests/test_constraints_venkataraman_71.py

    r355 r376  
    147147 
    148148import numpy 
    149 from constraint_tools import verify_constraints_satisfied 
     149from mystic.constraint_tools import verify_constraints_satisfied 
    150150import time 
    151151 
     
    184184    time_before = time.time() 
    185185 
    186     from differential_evolution import DifferentialEvolutionSolver 
     186    from mystic.differential_evolution import DifferentialEvolutionSolver 
    187187    from mystic.termination import VTR 
    188188    solver = DifferentialEvolutionSolver(ndim, npop) 
     
    200200    print "Time elapsed=", time_elapsed 
    201201 
    202     from constraint_tools import verify_constraints_satisfied 
     202    from mystic.constraint_tools import verify_constraints_satisfied 
    203203    print verify_constraints_satisfied(constraints_string, soln) 
    204204 
     
    214214    time_before = time.time() 
    215215 
    216     from differential_evolution import DifferentialEvolutionSolver2 
     216    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    217217    from mystic.termination import VTR 
    218218    solver = DifferentialEvolutionSolver2(ndim, npop) 
     
    230230    print "Time elapsed=", time_elapsed 
    231231 
    232     from constraint_tools import verify_constraints_satisfied 
     232    from mystic.constraint_tools import verify_constraints_satisfied 
    233233    print verify_constraints_satisfied(constraints_string, soln) 
    234234 
     
    244244    time_before = time.time() 
    245245 
    246     from scipy_optimize import NelderMeadSimplexSolver 
     246    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    247247    from mystic.termination import VTR 
    248248    solver = NelderMeadSimplexSolver(ndim) 
     
    260260    print "Time elapsed=", time_elapsed 
    261261 
    262     from constraint_tools import verify_constraints_satisfied 
     262    from mystic.constraint_tools import verify_constraints_satisfied 
    263263    print verify_constraints_satisfied(constraints_string, soln) 
    264264 
     
    274274    time_before = time.time() 
    275275 
    276     from scipy_optimize import PowellDirectionalSolver 
     276    from mystic.scipy_optimize import PowellDirectionalSolver 
    277277    from mystic.termination import VTR 
    278278    solver = PowellDirectionalSolver(ndim) 
     
    291291    print "Time elapsed=", time_elapsed 
    292292 
    293     from constraint_tools import verify_constraints_satisfied 
     293    from mystic.constraint_tools import verify_constraints_satisfied 
    294294    print verify_constraints_satisfied(constraints_string, soln) 
    295295 
     
    304304    time_before = time.time() 
    305305 
    306     from scipy_bfgs import BFGSSolver 
     306    from mystic.scipy_bfgs import BFGSSolver 
    307307    from mystic.termination import VTR 
    308308    solver = BFGSSolver(ndim) 
     
    321321    print "Time elapsed=", time_elapsed 
    322322 
    323     from constraint_tools import verify_constraints_satisfied 
     323    from mystic.constraint_tools import verify_constraints_satisfied 
    324324    print verify_constraints_satisfied(constraints_string, soln) 
    325325 
     
    334334    time_before = time.time() 
    335335 
    336     from scipy_ncg import NCGSolver 
     336    from mystic.scipy_ncg import NCGSolver 
    337337    from mystic.termination import VTR 
    338338    solver = NCGSolver(ndim) 
     
    351351    print "Time elapsed=", time_elapsed 
    352352 
    353     from constraint_tools import verify_constraints_satisfied 
     353    from mystic.constraint_tools import verify_constraints_satisfied 
    354354    print verify_constraints_satisfied(constraints_string, soln) 
    355355 
     
    364364    time_before = time.time() 
    365365 
    366     from scipy_cg import CGSolver 
     366    from mystic.scipy_cg import CGSolver 
    367367    from mystic.termination import VTR 
    368368    solver = CGSolver(ndim) 
     
    381381    print "Time elapsed=", time_elapsed 
    382382 
    383     from constraint_tools import verify_constraints_satisfied 
     383    from mystic.constraint_tools import verify_constraints_satisfied 
    384384    print verify_constraints_satisfied(constraints_string, soln) 
    385385 
     
    396396    time_before = time.time() 
    397397 
    398     from differential_evolution import DifferentialEvolutionSolver 
     398    from mystic.differential_evolution import DifferentialEvolutionSolver 
    399399    from mystic.termination import VTR 
    400400    solver = DifferentialEvolutionSolver(ndim, npop) 
     
    413413    print "Time elapsed=", time_elapsed 
    414414 
    415     from constraint_tools import verify_constraints_satisfied 
     415    from mystic.constraint_tools import verify_constraints_satisfied 
    416416    print verify_constraints_satisfied(constraints_string, soln) 
    417417 
     
    426426    time_before = time.time() 
    427427 
    428     from differential_evolution import DifferentialEvolutionSolver2 
     428    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    429429    from mystic.termination import VTR 
    430430    solver = DifferentialEvolutionSolver2(ndim, npop) 
     
    443443    print "Time elapsed=", time_elapsed 
    444444 
    445     from constraint_tools import verify_constraints_satisfied 
     445    from mystic.constraint_tools import verify_constraints_satisfied 
    446446    print verify_constraints_satisfied(constraints_string, soln) 
    447447 
     
    457457    time_before = time.time() 
    458458 
    459     from scipy_optimize import NelderMeadSimplexSolver 
     459    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    460460    from mystic.termination import VTR 
    461461    solver = NelderMeadSimplexSolver(ndim) 
     
    473473    print "Time elapsed=", time_elapsed 
    474474 
    475     from constraint_tools import verify_constraints_satisfied 
     475    from mystic.constraint_tools import verify_constraints_satisfied 
    476476    print verify_constraints_satisfied(constraints_string, soln) 
    477477 
     
    487487    time_before = time.time() 
    488488 
    489     from scipy_optimize import PowellDirectionalSolver 
     489    from mystic.scipy_optimize import PowellDirectionalSolver 
    490490    from mystic.termination import VTR 
    491491    solver = PowellDirectionalSolver(ndim) 
     
    503503    print "Time elapsed=", time_elapsed 
    504504 
    505     from constraint_tools import verify_constraints_satisfied 
     505    from mystic.constraint_tools import verify_constraints_satisfied 
    506506    print verify_constraints_satisfied(constraints_string, soln) 
    507507 
     
    516516    time_before = time.time() 
    517517 
    518     from scipy_bfgs import BFGSSolver 
     518    from mystic.scipy_bfgs import BFGSSolver 
    519519    from mystic.termination import VTR 
    520520    solver = BFGSSolver(ndim) 
     
    533533    print "Time elapsed=", time_elapsed 
    534534 
    535     from constraint_tools import verify_constraints_satisfied 
     535    from mystic.constraint_tools import verify_constraints_satisfied 
    536536    print verify_constraints_satisfied(constraints_string, soln) 
    537537 
     
    546546    time_before = time.time() 
    547547 
    548     from scipy_ncg import NCGSolver 
     548    from mystic.scipy_ncg import NCGSolver 
    549549    from mystic.termination import VTR 
    550550    solver = NCGSolver(ndim) 
     
    562562    print "Time elapsed=", time_elapsed 
    563563 
    564     from constraint_tools import verify_constraints_satisfied 
     564    from mystic.constraint_tools import verify_constraints_satisfied 
    565565    print verify_constraints_satisfied(constraints_string, soln) 
    566566 
     
    575575    time_before = time.time() 
    576576 
    577     from scipy_cg import CGSolver 
     577    from mystic.scipy_cg import CGSolver 
    578578    from mystic.termination import VTR 
    579579    solver = CGSolver(ndim) 
     
    592592    print "Time elapsed=", time_elapsed 
    593593 
    594     from constraint_tools import verify_constraints_satisfied 
     594    from mystic.constraint_tools import verify_constraints_satisfied 
    595595    print verify_constraints_satisfied(constraints_string, soln) 
    596596 
     
    612612    test_powelldirectional_auglag() 
    613613    test_bfgs_auglag() # a little off with x0=[0.5, 0.5] 
    614     test_ncg_auglag() # gets stuck without the hack in scipy_ncg 
     614    test_ncg_auglag() # gets stuck without the hack in mystic.scipy_ncg 
    615615                      # with x0=[0.5, 0.5], does not iterate 
    616616    test_cg_auglag() 
  • branches/alta/mystic-0.2a1/constrained_tests/test_constraints_zimmermann.py

    r373 r376  
    208208    time_before = time.time() 
    209209 
    210     from differential_evolution import DifferentialEvolutionSolver 
     210    from mystic.differential_evolution import DifferentialEvolutionSolver 
    211211    from mystic.termination import VTR 
    212212    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    240240    time_before = time.time() 
    241241 
    242     from differential_evolution import DifferentialEvolutionSolver2 
     242    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    243243    from mystic.termination import VTR 
    244244    from mystic.strategy import Rand1Bin 
     
    271271    time_before = time.time() 
    272272 
    273     from scipy_optimize import NelderMeadSimplexSolver 
     273    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    274274    from mystic.termination import VTR 
    275275    solver = NelderMeadSimplexSolver(ndim) 
     
    296296    print "\nPowellDirectional, penalty" 
    297297 
    298     random_seed(seed) 
    299  
    300     # Do some timing 
    301     time_before = time.time() 
    302  
    303     from scipy_optimize import PowellDirectionalSolver 
     298    import mystic 
     299 
     300    random_seed(seed) 
     301 
     302    # Do some timing 
     303    time_before = time.time() 
     304 
     305    from mystic.scipy_optimize import PowellDirectionalSolver 
    304306    from mystic.termination import VTR 
    305307    solver = PowellDirectionalSolver(ndim) 
    306      
    307308    solver.SetRandomInitialPoints(lb, ub) 
    308309    solver.enable_signal_handler() 
     
    331332    time_before = time.time() 
    332333 
    333     from scipy_bfgs import BFGSSolver 
     334    from mystic.scipy_bfgs import BFGSSolver 
    334335    from mystic.termination import VTR 
    335336    solver = BFGSSolver(ndim) 
     
    361362    time_before = time.time() 
    362363 
    363     from scipy_ncg import NCGSolver 
     364    from mystic.scipy_ncg import NCGSolver 
    364365    from mystic.termination import VTR 
    365366    solver = NCGSolver(ndim) 
     
    391392    time_before = time.time() 
    392393 
    393     from scipy_cg import CGSolver 
     394    from mystic.scipy_cg import CGSolver 
    394395    from mystic.termination import VTR 
    395396    solver = CGSolver(ndim) 
     
    424425    time_before = time.time() 
    425426 
    426     from differential_evolution import DifferentialEvolutionSolver 
     427    from mystic.differential_evolution import DifferentialEvolutionSolver 
    427428    from mystic.termination import VTR 
    428429    from mystic.termination import ChangeOverGeneration as COG 
     
    456457    time_before = time.time() 
    457458 
    458     from differential_evolution import DifferentialEvolutionSolver2 
     459    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    459460    from mystic.termination import VTR 
    460461    from mystic.strategy import Rand1Bin 
     
    487488    time_before = time.time() 
    488489 
    489     from scipy_optimize import NelderMeadSimplexSolver 
     490    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    490491    from mystic.termination import VTR 
    491492    from mystic.termination import CandidateRelativeTolerance as CRT 
     
    519520    time_before = time.time() 
    520521 
    521     from scipy_optimize import PowellDirectionalSolver 
     522    from mystic.scipy_optimize import PowellDirectionalSolver 
    522523    from mystic.termination import VTR 
    523524    solver = PowellDirectionalSolver(ndim) 
     
    548549    time_before = time.time() 
    549550 
    550     from scipy_bfgs import BFGSSolver 
     551    from mystic.scipy_bfgs import BFGSSolver 
    551552    from mystic.termination import VTR 
    552553    from mystic.termination import GradientTermination 
     
    580581    time_before = time.time() 
    581582 
    582     from scipy_ncg import NCGSolver 
     583    from mystic.scipy_ncg import NCGSolver 
    583584    from mystic.termination import VTR 
    584585    solver = NCGSolver(ndim) 
     
    609610    time_before = time.time() 
    610611 
    611     from scipy_cg import CGSolver 
     612    from mystic.scipy_cg import CGSolver 
    612613    from mystic.termination import VTR 
    613614    solver = CGSolver(ndim) 
     
    642643    time_before = time.time() 
    643644 
    644     from differential_evolution import DifferentialEvolutionSolver 
     645    from mystic.differential_evolution import DifferentialEvolutionSolver 
    645646    from mystic.termination import VTR 
    646647    from mystic.strategy import Rand1Bin 
     
    673674    time_before = time.time() 
    674675 
    675     from differential_evolution import DifferentialEvolutionSolver2 
     676    from mystic.differential_evolution import DifferentialEvolutionSolver2 
    676677    from mystic.termination import VTR 
    677678    from mystic.strategy import Rand1Bin 
     
    704705    time_before = time.time() 
    705706 
    706     from scipy_optimize import NelderMeadSimplexSolver 
     707    from mystic.scipy_optimize import NelderMeadSimplexSolver 
    707708    from mystic.termination import VTR 
    708709    solver = NelderMeadSimplexSolver(ndim) 
     
    734735    time_before = time.time() 
    735736 
    736     from scipy_optimize import PowellDirectionalSolver 
     737    from mystic.scipy_optimize import PowellDirectionalSolver 
    737738    from mystic.termination import VTR 
    738739    solver = PowellDirectionalSolver(ndim) 
     
    763764    time_before = time.time() 
    764765 
    765     from scipy_bfgs import BFGSSolver 
     766    from mystic.scipy_bfgs import BFGSSolver 
    766767    from mystic.termination import VTR 
    767768    solver = BFGSSolver(ndim) 
     
    793794    time_before = time.time() 
    794795 
    795     from scipy_ncg import NCGSolver 
     796    from mystic.scipy_ncg import NCGSolver 
    796797    from mystic.termination import VTR 
    797798    solver = NCGSolver(ndim) 
     
    822823    time_before = time.time() 
    823824 
    824     from scipy_cg import CGSolver 
     825    from mystic.scipy_cg import CGSolver 
    825826    from mystic.termination import VTR 
    826827    solver = CGSolver(ndim) 
  • branches/alta/mystic-0.2a1/constrained_tests/test_problems_constrained.py

    r367 r376  
    2121 
    2222#print venkataraman_71([1.0, 1.0]) 
    23  
    24  
    25 def antoniou_lu_15_6(x): 
    26     """ 
    27 Minimize (x1 - 2)**2 + (x2 - 1)**2  
    28 subject to: 
    29 -x1**2 + x2 >= 0 
    30 -x1 + x2**2 >= 0 
    31 Expected minimum: (1., 1.) 
    32 Mathematica: x -> 1.16537, y -> 1.35809 
    33 Source: Example 15.6, page 527. Practical Optimization: Algorithms  
    34 and Engineering Applications, by Andreas Antoniou and Wu-Sheng Lu.  
    35 Springer. 2007.""" #XXX Does not work? 
    36     x1 = x[0] 
    37     x2 = x[1] 
    38     return (x1 - 2.)**2 + (x2 - 1.)**2  
    39  
    40 #print antoniou_lu_15_6([1., 1.]) 
    4123 
    4224def cvxopt_qp(x): 
     
    216198#print g4([78, 33, 29.995256, 45, 36.7758129]) #-30665.539 
    217199 
    218 ################################################### 
    219  
    220 def shuonan(x): 
    221     """Source: 'Toy' problem from the project paper of Shuonan Dong, 18.086 MIT 
    222 Project 2, Spring 2006. "Methods for Constrained Optimization". 
    223  
    224 Minimize 2.*x1**2 + x1*x2 + 2.*x2**2 - 6.*x1 - 6.*x2 + 15. 
    225 subject to: 
    226 x1 + 2.*x2 <= 5. 
    227 4.*x1 <= 7. 
    228 x2 <= 2. 
    229 -2.*x1 + 2.*x2 = -1. 
    230  
    231 Graphs and results from this function do not seem to match his paper though...""" 
    232     x1 = x[0] 
    233     x2 = x[1] 
    234     return 2.*x1**2 + x1*x2 + 2.*x2**2 - 6.*x1 - 6.*x2 + 15. 
    235  
    236200################################################################## 
    237201# A very large source of constrained and only box-constrained test problems 
     
    291255    return 1./(27.*(3.**0.5))*((x[0] - 3.)**2 - 9.)*x[1]**3 
    292256 
     257 
     258c = [-6.089, -17.164, -34.054, -5.914,-24.721, -14.986, -24.100, -10.708,\ 
     259-26.662, -22.179]  
    293260def tp112(x): 
    294261    """TP112 of Schittkowski's test problems.  
     
    306273where f= -47.707579 
    307274""" 
    308     c = [-6.089, -17.164, -34.054, -5.914,-24.721, -14.986, -24.100, -10.708,\ 
    309          -26.662, -22.179] #XXX Move this list of constants outside? 
    310275    s = 0. 
    311276    for j in range(10): 
  • branches/alta/mystic-0.2a1/constraint_tools.py

    r371 r376  
    11831183    if method == 'direct': 
    11841184        if type(constraints) == str: 
     1185            suggestedorder = None 
     1186            if kwds.has_key('suggestedorder'):  
     1187                suggestedorder = kwds['suggestedorder'] 
    11851188            constraints = form_constraints_function(constraints, ndim, \ 
    1186                             varname=varname, varnamelist=varnamelist, **kwds) 
     1189                            varname=varname, varnamelist=varnamelist,\ 
     1190                            suggestedorder=suggestedorder) 
    11871191            # If there are strict constraints, wrap them.  
    11881192            if constraints_strict: 
  • branches/alta/mystic-0.2a1/mystic_test_suite.py

    r373 r376  
    586586        self.min = [-1.28]*self.ND 
    587587        self.max = [1.28]*self.ND 
    588         self.maxiter = 10000 
     588        self.maxiter = 2500 
    589589        self.nplaces = 0 # Precision of answer  
    590590 
     
    593593        import numpy 
    594594        from mystic.tools import random_seed 
    595         random_seed(123) 
     595        #random_seed(123) 
    596596        esow = Sow() 
    597597        ssow = Sow()  
     
    620620        from mystic.termination import VTR 
    621621        tol = 1e-7 
    622         self.NP = 40  
     622        self.NP = 100  
    623623        self.solver = DifferentialEvolutionSolver(self.ND, self.NP) 
    624624        self.term = VTR()#tol) 
     
    630630        from mystic.termination import ChangeOverGeneration as COG 
    631631        tol = 1e-7 
    632         self.NP = 40 
     632        self.NP = 100 
    633633        self.solver = DifferentialEvolutionSolver(self.ND, self.NP) 
    634634        self.term = COG()#tol) 
     
    640640        from mystic.termination import NormalizedChangeOverGeneration as NCOG 
    641641        tol = 1e-7 
    642         self.NP = 40  
     642        self.NP = 100  
    643643        self.solver = DifferentialEvolutionSolver(self.ND, self.NP) 
    644644        self.term = NCOG()#tol) 
     
    650650        from mystic.termination import CandidateRelativeTolerance as CRT 
    651651        tol = 1e-7 
    652         self.NP = 40  
     652        self.NP = 100  
    653653        self.solver = DifferentialEvolutionSolver(self.ND, self.NP) 
    654654        self.term = CRT()#tol) 
     
    662662        from mystic.termination import VTR 
    663663        tol = 1e-7 
    664         self.NP = 40  
     664        self.NP = 100  
    665665        self.solver = DifferentialEvolutionSolver2(self.ND, self.NP) 
    666666        self.term = VTR()#tol) 
     
    672672        from mystic.termination import ChangeOverGeneration as COG 
    673673        tol = 1e-7 
    674         self.NP = 40  
     674        self.NP = 100  
    675675        self.solver = DifferentialEvolutionSolver2(self.ND, self.NP) 
    676676        self.term = COG()#tol) 
     
    682682        from mystic.termination import NormalizedChangeOverGeneration as NCOG 
    683683        tol = 1e-7 
    684         self.NP = 40  
     684        self.NP = 100  
    685685        self.solver = DifferentialEvolutionSolver2(self.ND, self.NP) 
    686686        self.term = NCOG()#tol) 
     
    692692        from mystic.termination import CandidateRelativeTolerance as CRT 
    693693        tol = 1e-7 
    694         self.NP = 40  
     694        self.NP = 100  
    695695        self.solver = DifferentialEvolutionSolver2(self.ND, self.NP) 
    696696        self.term = CRT()#tol) 
     
    780780        import numpy 
    781781        from mystic.tools import random_seed 
    782        #random_seed(123) 
     782        random_seed(123) 
    783783        esow = Sow() 
    784784        ssow = Sow()  
     
    13701370        from mystic.termination import VTR 
    13711371        tol = 1e-7 
    1372         self.NP = 100  
    1373         self.solver = DifferentialEvolutionSolver(self.ND, self.NP) 
    1374         self.term = VTR(0.00001) 
     1372        self.NP = 40  
     1373        self.solver = DifferentialEvolutionSolver(self.ND, self.NP) 
     1374        self.term = VTR()#0.00001) 
    13751375        from mystic.strategy import Rand1Exp 
    13761376        self._run_solver( strategy=Rand1Exp, CrossProbability=0.3, ScalingFactor=1.0 ) 
     
    13801380        from mystic.termination import ChangeOverGeneration as COG 
    13811381        tol = 1e-7 
    1382         self.NP = 100 
     1382        self.NP = 40 
    13831383        self.solver = DifferentialEvolutionSolver(self.ND, self.NP) 
    13841384        self.term = COG()#tol) 
     
    13901390        from mystic.termination import NormalizedChangeOverGeneration as NCOG 
    13911391        tol = 1e-7 
    1392         self.NP = 100  
     1392        self.NP = 40 
    13931393        self.solver = DifferentialEvolutionSolver(self.ND, self.NP) 
    13941394        self.term = NCOG()#tol) 
     
    14001400        from mystic.termination import CandidateRelativeTolerance as CRT 
    14011401        tol = 1e-7 
    1402         self.NP = 100  
     1402        self.NP = 40 
    14031403        self.solver = DifferentialEvolutionSolver(self.ND, self.NP) 
    14041404        self.term = CRT()#tol) 
     
    14121412        from mystic.termination import VTR 
    14131413        tol = 1e-7 
    1414         self.NP = 100 
     1414        self.NP = 40 
    14151415        self.solver = DifferentialEvolutionSolver2(self.ND, self.NP) 
    14161416        self.term = VTR()#tol) 
     
    14221422        from mystic.termination import ChangeOverGeneration as COG 
    14231423        tol = 1e-7 
    1424         self.NP = 100 
     1424        self.NP = 40 
    14251425        self.solver = DifferentialEvolutionSolver2(self.ND, self.NP) 
    14261426        self.term = COG()#tol) 
     
    14321432        from mystic.termination import NormalizedChangeOverGeneration as NCOG 
    14331433        tol = 1e-7 
    1434         self.NP = 100 
     1434        self.NP = 40 
    14351435        self.solver = DifferentialEvolutionSolver2(self.ND, self.NP) 
    14361436        self.term = NCOG()#tol) 
     
    14421442        from mystic.termination import CandidateRelativeTolerance as CRT 
    14431443        tol = 1e-7 
    1444         self.NP = 100  
     1444        self.NP = 40  
    14451445        self.solver = DifferentialEvolutionSolver2(self.ND, self.NP) 
    14461446        self.term = CRT()#tol) 
     
    32243224    #                                suite11, suite12, suite13, suite14,\ 
    32253225    #                                suite15, suite16, suite17]) 
    3226     allsuites = unittest.TestSuite([suite4]) 
     3226    allsuites = unittest.TestSuite([suite5]) 
    32273227    unittest.TextTestRunner(verbosity=2).run(allsuites) 
Note: See TracChangeset for help on using the changeset viewer.