Exemplo n.º 1
0
 def setUp(self):
     self.A = array([[ 1,  0, -1], [ 0,  1,  0], [ 1,  0,  1]])
     self.B = array([[1e12,0],[0,1e-8]])
     self.dummyOptions = helper.dummyOptions() 
     self.dummyOptions.verbose=0;
     self.abs_tol=1e-15;
     self.rel_tol=1e-15;
Exemplo n.º 2
0
 def setUp(self):
     self.options = helper.dummyOptions()
     self.options.verbose = 2
     #self.values = helper.dummyValues()
     self.abs_tol=1e-14
     self.rel_tol=1e-14
     pass
 def setUp(self):
     set_check_condition(0)
     self.x = array([[0.5, 1.0, 0.5]]).T
     self.lb = array([])
     self.ub = array([])
     self.values = helper.dummyValues()
     self.options = helper.dummyOptions()
     self.info = dummyInfo()
     self.abs_tol=1e-8;
     self.rel_tol=1e-8;
Exemplo n.º 4
0
    def setUp(self):
        self.options = helper.dummyOptions()
        self.info = dummyInfo()

        self.x = array(
            [[0.500000000000000, 1.000000000000000, 0.500000000000000]]).T
        self.lm = array([[0, 0, 0, -0.333333332763891, -0.000000000249999]]).T
        #print "lm", self.lm
        self.lb = array([[-0.500000000000000, 0, -np.Inf]]).T
        self.ub = array([[np.Inf, np.Inf, np.Inf]]).T
Exemplo n.º 5
0
    def setUp(self):
        self.M = array(np.eye(3))
        self.y = array([[-0.009783923878659, -0.0, 0.0]]).T
        self.s = array([[-0.503054026564966, -1.0, -0.184478531874161]]).T
        self.first = 1

        self.info = dummyInfo()
        self.options = helper.dummyOptions()

        # set hessian approximation to bfgs
        self.options.hess_approx = 130
        self.values = helper.dummyValues()
Exemplo n.º 6
0
 def setUp(self):
     self.info = dummyInfo()
     self.old_delta = 1
     self.norms = 0
     self.pc = 0
     self.itype = None
     self.options = helper.dummyOptions()
     self.nb = 2
     self.mi = 0
     self.values = helper.dummyValues()
     self.constrained_pbl = 2
     self.merit = 5.105551275463990
Exemplo n.º 7
0
    def setUp(self):
        self.X = array([[0, 1, 0], [0, 0, 1]])
        self.fX = array([1, 100, 101])
        self.y = array([[2, 4]]).T

        self.ciX = copy(self.X)
        self.ceX = copy(self.X)

        self.info = dummyInfo()
        self.options = helper.dummyOptions()
        self.values = helper.dummyValues()
        self.abs_tol = 1e-15
        self.rel_tol = 1e-15
Exemplo n.º 8
0
    def test_sqpdfo_check_convex3(self):
        """
        With a non symmetric matrix non convex
        """
        C = array([[1,2,3],[4,5,6],[7,8,9]])

        res = sqpdfo_check_convex_(C, helper.dummyOptions())

        self.assertFalse(compare_array(C, res, self.abs_tol, self.rel_tol))
        self.assertTrue(compare_array(res, res.T, self.abs_tol, self.rel_tol))

        correctres=array([[0.000000000925233, 0.000000001000001, 1.88302358e+01]])
        self.assertTrue(compare_array(correctres, np.sort(eig_(res)), 1e-8, 1e-8))
Exemplo n.º 9
0
    def setUp(self):
        self.simul = sqpdfo_evalfgh_
        self.x = array([[-0.003054026564966, 0, 0.315521468125839]]).T
        self.null_step = 0
        self.constrained_pbl = 2
        self.lm = array(
            [[0, -0.999999999499998, 0, -0.000000000375002,
              0.000000000083334]]).T
        self.M = array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
        self.n = 3
        self.me = 2
        self.mi = 0
        self.s = array(
            [[-0.503054026564966, -1.000000000000000, -0.184478531874161]]).T
        self.gx = array([[-0.009783923878659, 1.000000000000000, 0]]).T
        self.gci = array([])
        self.gce = array(
            [[1.000000000000000, 0.999999999999999, 1.000000000000000],
             [1.000000000000000, 1.999999999999999, 3.000000000000000]])

        self.info = dummyInfo()
        self.options = helper.dummyOptions()
        self.values = helper.dummyValues()

        self.fcmodel = array([[
            0.099563123926544, -0.013550429460611, 1.384968815034240, 0,
            6.144976749236061
        ],
                              [
                                  0.312467441560872, 1.384968815034241,
                                  1.384968815034240, 1.384968815034241,
                                  0.000000000000006
                              ],
                              [
                                  -0.056489622187450, 1.384968815034241,
                                  2.769937630068480, 4.154906445102721,
                                  0.000000000000014
                              ]])

        self.Y = array([[
            -0.003054026564966, -0.500000000000000, 0.500000000000000,
            0.500000000000000, 0.500000000000000
        ], [0, 1.000000000000000, 0, 1.000000000000000, 1.000000000000000],
                        [
                            0.315521468125839, 0.500000000000000,
                            0.500000000000000, -0.500000000000000,
                            0.500000000000000
                        ]])
        self.fY = array([
            0.099563123926544, 1.500000000000000, 0.500000000000000,
            1.500000000000000, 1.500000000000000
        ])
        self.ciY = array([])
        self.ceY = array([[
            0.312467441560872, 1.000000000000000, 1.000000000000000,
            1.000000000000000, 2.000000000000000
        ],
                          [
                              -0.056489622187450, 2.000000000000000,
                              1.000000000000000, 0, 3.000000000000000
                          ]])
        self.sigma = 1
        self.scale = array([[
            1.000000000000000, 0.722037918214987, 0.722037918214987,
            0.722037918214987, 0.521338755340232
        ]]).T
        self.shift_Y = 1
        self.QZ = array([[1.000000000000000, 0, 0, 0, 0],
                         [
                             0, -0.437717028004984, -0.826365739060244,
                             0.329535025867438, -0.130115853870500
                         ],
                         [
                             0, 0.880814115424577, -0.315023389192614,
                             0.329471408091712, -0.127966204837389
                         ],
                         [
                             0, 0.162491294867564, -0.418566952172131,
                             -0.884320607054428, -0.127966204837389
                         ],
                         [
                             0, 0.078529462977709, -0.206595343893201,
                             -0.028849989870035, 0.974843149132506
                         ]])
        self.RZ = array([[
            1.000000000000000, 1.000000000000000, 1.000000000000000,
            1.000000000000000, 1.000000000000000
        ],
                         [
                             0, 0.819739267991799, -0.132165180682231,
                             0.386491133279071, 0.503816009553305
                         ],
                         [
                             0, 0, -0.369537503265736, -0.294775124607443,
                             -0.596996335387400
                         ], [0, 0, 0, 0.876403859762092, 0.237890849609900],
                         [0, 0, 0, 0, -0.092396452142661]])
        self.whichmodel = 0
        self.ind_Y = array([4, 1, 2, 3, 0])
        self.i_xbest = 4
        self.m = 4

        self.abs_tol = 1e-14
        self.rel_tol = 1e-14
Exemplo n.º 10
0
    def setUp(self):
        self.options = helper.dummyOptions()
        self.values = helper.dummyValues()

        pass
Exemplo n.º 11
0
    def setUp(self):

        set_threshold(1.000000000000000e-08)
        set_test_prob(3)
        set_fileoutput(1)
        set_simul_not_initialized(1)
        set_check_condition(0)

        self.func = sqpdfo_evalfgh_
        self.n = 3
        self.nb = 2
        self.mi = 0
        self.me = 2
        self.lm = array([[0.0], [0.0], [0.0], [-0.333333332763891],
                         [-0.000000000249999]])
        self.nitold = 0
        self.nit = 0
        self.i_xbest = 0
        self.lb = array([[-0.500000000000000], [0.0], [-np.Inf]])
        self.ub = array([[np.Inf], [np.Inf], [np.Inf]])
        self.m = 3
        self.X = array([[
            0.500000000000000, -0.500000000000000, 0.500000000000000,
            0.500000000000000
        ], [1.000000000000000, 1.000000000000000, 0.0, 1.000000000000000],
                        [
                            0.500000000000000, 0.500000000000000,
                            0.500000000000000, -0.500000000000000
                        ]])
        self.fX = array([
            1.500000000000000, 1.500000000000000, 0.500000000000000,
            1.500000000000000
        ])
        self.ciX = array([])
        self.ceX = array([[2.0, 1.0, 1.0, 1.0], [3.0, 2.0, 1.0, 0.0]])
        self.ind_Y = array([0, 1, 2, 3])
        self.QZ = array([[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0],
                         [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]])
        self.RZ = array([[1.0, 1.0, 1.0, 1.0], [0.0, -1.0, 0.0, 0.0],
                         [0.0, 0.0, -1.0, 0.0], [0.0, 0.0, 0.0, -1.0]])
        self.delta = 1
        self.cur_degree = 4
        self.neval = 0
        self.maxeval = 600
        self.maxit = 600
        self.fcmodel = array([[1.500000000000000, 0.0, 1.000000000000000, 0.0],
                              [
                                  2.000000000000000, 1.000000000000000,
                                  1.000000000000000, 1.000000000000000
                              ],
                              [
                                  3.000000000000000, 1.000000000000000,
                                  2.000000000000000, 3.000000000000000
                              ]])
        self.gx = array([[0.0], [1.0], [0.0]])
        self.normgx = 1.0
        self.show_errg = 0
        self.pquad = 10
        self.pdiag = 7
        self.plin = 4
        self.stallfact = 2.220446049250313e-15
        self.eps_rho = 1.000000000000000e-14
        self.Deltamax = 100000.0
        self.rep_degree = 4
        self.epsilon = 1.000000000000000e-05
        self.verbose = 2
        self.eta1 = 1.000000000000000e-04
        self.eta2 = 0.900000000000000
        self.gamma1 = 0.010000000000000
        self.gamma2 = 0.500000000000000
        self.gamma3 = 2.0
        self.interpol_TR = 1
        self.factor_CV = 100
        self.Lambda_XN = 1.000000000000000e-10
        self.Lambda_CP = 1.200000000000000
        self.factor_FPU = 1.0
        self.factor_FPR = 10.0
        self.Lambda_FP = 1.000000000000000e-10
        self.criterion_S = 'distance'
        self.criterion_FP = 'distance'
        self.criterion_CP = 'standard'
        self.mu = 0.0
        self.theta = 1.0
        self.eps_TR = 1.000000000000000e-04
        self.eps_L = 1.000000000000000e-03
        self.lSolver = 1
        self.stratLam = 1
        self.eps_current = 1.000000000000000e-05
        self.vstatus = array([[0], [0], [0]])
        self.xstatus = array([[1], [1], [1], [1]])
        self.sstatus = array([[1], [1], [1], [1]])
        self.dstatus = array([[0], [0], [0], [0]])
        self.ndummyY = 0
        self.sspace_save = array([])
        self.xspace_save = array([])
        self.xfix = array([[0], [0], [0]])
        self.fxmax = 1.000000000000000e+25
        self.poised_model = 1
        self.M = array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]])
        self.kappa_ill = 1.000000000000000e+15
        self.kappa_th = 2000
        self.eps_bnd = 1.000000000000000e-06
        self.poised = 1
        self.Y_radius = 1
        self.c = helper.dummyUnionStruct()
        self.c.free = 0
        self.c.fixed = 1
        self.c.alwaysfixed = 2
        self.c.in_ = 1
        self.c.out = 0
        self.c.unused = 0
        self.c.inY = 1
        self.c.dummy = 1
        self.c.nodummy = 0
        self.level = 'toplevel'
        self.whichmodel = 0
        self.hardcons = 0
        self.noisy = 0
        self.scaleX = 0
        self.scalefacX = array([1, 1, 1])
        self.CNTsin = 0
        self.shrink_Delta = 1
        self.scale = array([[1], [1], [1], [1]])
        self.shift_Y = 1
        self.info = dummyInfo()
        self.options = helper.dummyOptions()
        self.values = helper.dummyValues()
        self.abs_tol = 1e-5
        self.rel_tol = 1e-5