Ignore:
Timestamp:
02/11/19 04:14:06 (6 years ago)
Author:
bdef
Message:

CHG: pyhton 3 migration (not opperational yet)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/py3/classes/qmu/@dakota_method/dakota_method.py

    r23677 r23709  
    11#move this later
    22from helpers import *
     3
     4from MatlabFuncs import *
    35import numpy as np
    46
     
    4446
    4547        def __init__(self,*args):
    46                 self.method              = ''
    47                 self.type                        = ''
    48                 self.variables = []
    49                 self.lcspec              = []
    50                 self.responses = []
    51                 self.ghspec              = []
     48                self.method   =''
     49                self.type     =''
     50                self.variables=[]
     51                self.lcspec   =[]
     52                self.responses=[]
     53                self.ghspec   =[]
    5254                #properites
    53                 self.params              = struct()
     55                self.params   =struct()
    5456
    5557        @staticmethod
     
    7577                        #given argument was a way of constructing a method
    7678                        else:
    77                                 mlist=[
    78                                         'dot_bfgs',
    79                                         'dot_frcg',
    80                                         'dot_mmfd',
    81                                         'dot_slp',
    82                                         'dot_sqp',
    83                                         'npsol_sqp',
    84                                         'conmin_frcg',
    85                                         'conmin_mfd',
    86                                         'optpp_cg',
    87                                         'optpp_q_newton',
    88                                         'optpp_fd_newton',
    89                                         'optpp_newton',
    90                                         'optpp_pds',
    91                                         'asynch_pattern_search',
    92                                         'coliny_cobyla',
    93                                         'coliny_direct',
    94                                         'coliny_ea',
    95                                         'coliny_pattern_search',
    96                                         'coliny_solis_wets',
    97                                         'ncsu_direct',
    98                                         'surrogate_based_local',
    99                                         'surrogate_based_global',
    100                                         'moga',
    101                                         'soga',
    102                                         'nl2sol',
    103                                         'nlssol_sqp',
    104                                         'optpp_g_newton',
    105                                         'nond_sampling',
    106                                         'nond_local_reliability',
    107                                         'nond_global_reliability',
    108                                         'nond_polynomial_chaos',
    109                                         'nond_stoch_collocation',
    110                                         'nond_evidence',
    111                                         'dace',
    112                                         'fsu_quasi_mc',
    113                                         'fsu_cvt',
    114                                         'vector_parameter_study',
    115                                         'list_parameter_study',
    116                                         'centered_parameter_study',
    117                                         'multidim_parameter_study',
    118                                         'bayes_calibration']
     79                                mlist=['dot_bfgs',
     80                                                         'dot_frcg',
     81                                                         'dot_mmfd',
     82                                                         'dot_slp',
     83                                                         'dot_sqp',
     84                                                         'npsol_sqp',
     85                                                         'conmin_frcg',
     86                                                         'conmin_mfd',
     87                                                         'optpp_cg',
     88                                                         'optpp_q_newton',
     89                                                         'optpp_fd_newton',
     90                                                         'optpp_newton',
     91                                                         'optpp_pds',
     92                                                         'asynch_pattern_search',
     93                                                         'coliny_cobyla',
     94                                                         'coliny_direct',
     95                                                         'coliny_ea',
     96                                                         'coliny_pattern_search',
     97                                                         'coliny_solis_wets',
     98                                                         'ncsu_direct',
     99                                                         'surrogate_based_local',
     100                                                         'surrogate_based_global',
     101                                                         'moga',
     102                                                         'soga',
     103                                                         'nl2sol',
     104                                                         'nlssol_sqp',
     105                                                         'optpp_g_newton',
     106                                                         'nond_sampling',
     107                                                         'nond_local_reliability',
     108                                                         'nond_global_reliability',
     109                                                         'nond_polynomial_chaos',
     110                                                         'nond_stoch_collocation',
     111                                                         'nond_evidence',
     112                                                         'dace',
     113                                                         'fsu_quasi_mc',
     114                                                         'fsu_cvt',
     115                                                         'vector_parameter_study',
     116                                                         'list_parameter_study',
     117                                                         'centered_parameter_study',
     118                                                         'multidim_parameter_study',
     119                                                         'bayes_calibration']
    119120
    120121                                mlist2=[]
     
    122123                                        if strncmpi(method,mlist[i],len(method)):
    123124                                                mlist2.append(mlist[i])
    124 
    125                                 #  check for a unique match in the list of methods
    126 
     125                                                #  check for a unique match in the list of methods
    127126                                l = len(mlist2)
    128127                                if l == 0:
     
    134133
    135134                                #  assign the default values for the method
     135                          # switch dm.method
    136136                                if dm.method in ['dot_bfgs','dot_frcg']:
    137137                                        dm.type     ='dot'
    138                                         dm.variables=['continuous_design','continuous_state']
     138                                        dm.variables=['continuous_design',
     139                                                                                                'continuous_state']
    139140                                        dm.lcspec   =[]
    140141                                        dm.responses=['objective_function']
     
    151152                                elif dm.method in ['dot_mmfd','dot_slp','dot_sqp']:
    152153                                        dm.type     ='dot'
    153                                         dm.variables=['continuous_design','continuous_state']
     154                                        dm.variables=['continuous_design',
     155                                                                                                'continuous_state']
    154156                                        dm.lcspec   =['linear_inequality_constraint',
    155157                                                                                                'linear_equality_constraint']
     
    236238                                        dm.params.max_step=1000.
    237239                                        dm.params.gradient_tolerance=1.0e-4
    238                                 elif dm.method in ['optpp_q_newton','optpp_fd_newton','optpp_newton']:
     240
     241                                elif dm.method in ['optpp_q_newton',
     242                                                                                                         'optpp_fd_newton',
     243                                                                                                         'optpp_newton']:
    239244                                        dm.type     ='optpp'
    240245                                        dm.variables=['continuous_design',
     
    455460                                        dm.params.vol_boxsize_limit=1.0e-8
    456461
    457                                 # elif dm.method in ['surrogate_based_local',
    458                                 #                                                                        'surrogate_based_global']:
     462                                        #if dm.method in ['surrogate_based_local',
     463                                        #'surrogate_based_global']:
     464
    459465                                elif dm.method == 'moga':
    460466                                        dm.type     ='jega'
     
    501507                                        dm.params.postprocessor_type=False
    502508                                        dm.params.orthogonal_distance=[0.01]
     509
    503510                                elif dm.method == 'soga':
    504511                                        dm.type     ='jega'
     
    563570                                        dm.params.covariance=0
    564571                                        dm.params.regression_stressbalances=False
     572
    565573                                elif dm.method == 'nlssol_sqp':
    566574                                        dm.type     ='lsq'
     
    619627                                        dm.responses=['response_function']
    620628                                        dm.ghspec   =[]
    621                                         #not documented, but apparently works
     629                                        #                               not documented, but apparently works
    622630                                        dm.params.output=False
    623631                                        dm.params.seed=False
     
    658666                                        dm.responses=['response_function']
    659667                                        dm.ghspec   =['grad']
    660                                         #not documented, but may work
     668                                        #                               not documented, but may work
    661669                                        dm.params.output=False
    662670                                        dm.params.x_gaussian_process=False
     
    860868
    861869                                else:
    862                                         raise RuntimeError('Unimplemented method: '+str(dm.method)+'.')
     870                                        raise RuntimeError('Unimplemented method: {}.'.format(dm.method))
    863871
    864872                #  if more than one argument, issue warning
Note: See TracChangeset for help on using the changeset viewer.