Пример #1
0
        print "Exact PoF: %s" % pof

        for i in range(len(lb)):
            print "\n"
            print " lower bounds: %s" % lb[i]
            print " upper bounds: %s" % ub[i]
        for solved in params0[0]:
            print "solved: %s" % solved
        print "subdiameters (squared): %s" % subdiams0[0]
        print "diameter (squared): %s" % diam0[0]
        print " probability mass: %s" % probmass0[0]
        expectation = expectation_value(model, lower_bounds, upper_bounds)
        print " expectation: %s" % expectation
        mean_value = mean(expectation, cuboid_volume)
        print " mean value: %s" % mean_value
        mcdiarmid = mcdiarmid_bound(mean_value, sqrt(diam0[0]))
        print "McDiarmid bound: %s" % mcdiarmid

    # determine 'best' cuts to cuboid
    for cut in range(max_number_of_cuts):
        print "\n..... cut #%s ....." % (cut + 1)
        lb, ub = make_cut(lb, ub, RVstart, RVend, cuboid_volume)

    if DEBUG:
        print "\n..... cut #%s ....." % (max_number_of_cuts + 1)
    # get diameter for each subcuboid
    params, subdiams, diam, probmass = test_cuboids(lb, ub, RVstart, RVend, cuboid_volume)
    SOLVED_PARAMETERS, SUB_DIAMETERS = params, subdiams
    TOTAL_DIAMETERS, PROBABILITY_MASS = diam, probmass
    if not DEBUG:
        weighted_bound = []
Пример #2
0
      print "\n"
      print " lower bounds: %s" % lb[i]
      print " upper bounds: %s" % ub[i]
    for solved in params0[0]:
      print "solved: %s" % solved
    print "subdiameters (squared): %s" % subdiams0[0]
    print "diameter (squared): %s" % diam0[0]
    print " probability mass: %s" % probmass0[0]
    expectation = expectation_value(model,lower_bounds,upper_bounds)
   #print " expectation: %s" % expectation
    mean_value = mean(expectation,cuboid_volume)
    print " mean value: %s" % mean_value
    if STATUS[0] == SUCCESS and MCZERO: #XXX: should be false, or we are done
      mcdiarmid = 0.0
    else:
      mcdiarmid = mcdiarmid_bound(mean_value,sqrt(diam0[0]))
    print "McDiarmid bound: %s" % mcdiarmid

  # determine 'best' cuts to cuboid
  for cut in range(max_cut_iterations):
    if max_cuts[0]:  #XXX: abort if max_cuts was set to zero
      print "\n..... cut iteration #%s ....." % (cut+1)
      lb,ub = make_cut(lb,ub,RVstart,RVend,cuboid_volume)

  if DEBUG:
    print "\n..... %s cuboids ....." % (cut+2) #XXX: ?; was max_cut_iterations+1
  # get diameter for each subcuboid 
  params, subdiams, diam, probmass = test_cuboids(lb,ub,RVstart,RVend,\
                                                  cuboid_volume)
  SOLVED_PARAMETERS, SUB_DIAMETERS = params, subdiams
  TOTAL_DIAMETERS, PROBABILITY_MASS = diam, probmass
Пример #3
0
      param_string += ", "

  print " parameters: %s" % param_string
  print " lower bounds: %s" % lower_bounds
  print " upper bounds: %s" % upper_bounds
# print " ..."
 #cuboid_volume = volume(lower_bounds,upper_bounds)
  cuboid_volume = volume(lbounds,ubounds)
  probability_mass = prob_mass(cuboid_volume,cuboid_volume)
  print " probability mass: %s" % probability_mass
  expectation = expectation_value(model,lower_bounds,upper_bounds)
  print " expectation: %s" % expectation
  mean_value = mean(expectation,cuboid_volume)
  print " mean value: %s" % mean_value
  diameter = UQ(RVstart,RVend,lower_bounds,upper_bounds)
  mcdiarmid = mcdiarmid_bound(mean_value,sqrt(diameter))
  print "McDiarmid bound: %s" % mcdiarmid

 #if RVstart != 0 or RVend != 2: # abort when not a 3-D problem
 #  break #FIXME: break? or exit? or pass/else? or ???

  weighted_bound = []
  sanity = []
  lb = []
  ub = []
# subdivisions at h=100, a=20, v=2.2
  lb.append([60.0, 0.0, 2.1])
  ub.append([100.0, 20.0, 2.2])

  lb.append([60.0, 0.0, 2.2])
  ub.append([100.0, 20.0, 2.8])
Пример #4
0
            print " lower bounds: %s" % lb[i]
            print " upper bounds: %s" % ub[i]
        for solved in params0[0]:
            print "solved: %s" % solved
        print "subdiameters (squared): %s" % subdiams0[0]
        print "diameter (squared): %s" % diam0[0]
        print " probability mass: %s" % probmass0[0]
        expectation = expectation_value(model, lower_bounds, upper_bounds)
        print " expectation: %s" % expectation
        mean_value = mean(expectation, cuboid_volume)
        print " mean value: %s" % mean_value
        if STATUS[
                0] == SUCCESS and MCZERO:  #XXX: should be false, or we are done
            mcdiarmid = 0.0
        else:
            mcdiarmid = mcdiarmid_bound(mean_value, sqrt(diam0[0]))
        print "McDiarmid bound: %s" % mcdiarmid

    # determine 'best' cuts to cuboid
    for cut in range(max_cut_iterations):
        if max_cuts[0]:  #XXX: abort if max_cuts was set to zero
            print "\n..... cut iteration #%s ....." % (cut + 1)
            lb, ub = make_cut(lb, ub, RVstart, RVend, cuboid_volume)

    if DEBUG:
        print "\n..... %s cuboids ....." % (
            cut + 2)  #XXX: ?; was max_cut_iterations+1
    # get diameter for each subcuboid
    params, subdiams, diam, probmass = test_cuboids(lb,ub,RVstart,RVend,\
                                                    cuboid_volume)
    SOLVED_PARAMETERS, SUB_DIAMETERS = params, subdiams
Пример #5
0
      param_string += ", "

  print(" parameters: %s" % param_string)
  print(" lower bounds: %s" % lower_bounds)
  print(" upper bounds: %s" % upper_bounds)
# print(" ...")
 #cuboid_volume = volume(lower_bounds,upper_bounds)
  cuboid_volume = volume(lbounds,ubounds)
  probability_mass = prob_mass(cuboid_volume,cuboid_volume)
  print(" probability mass: %s" % probability_mass)
  expectation = expectation_value(model,lower_bounds,upper_bounds)
  print(" expectation: %s" % expectation)
  mean_value = mean(expectation,cuboid_volume)
  print(" mean value: %s" % mean_value)
  diameter = UQ(RVstart,RVend,lower_bounds,upper_bounds)
  mcdiarmid = mcdiarmid_bound(mean_value,sqrt(diameter))
  print("McDiarmid bound: %s" % mcdiarmid)

 #if RVstart != 0 or RVend != 2: # abort when not a 3-D problem
 #  break #FIXME: break? or exit? or pass/else? or ???

  weighted_bound = []
  sanity = []
  lb = []
  ub = []
# subdivisions at h=100, a=20, v=2.2
  lb.append([60.0, 0.0, 2.1])
  ub.append([100.0, 20.0, 2.2])

  lb.append([60.0, 0.0, 2.2])
  ub.append([100.0, 20.0, 2.8])
Пример #6
0
      print("\n")
      print(" lower bounds: %s" % lb[i])
      print(" upper bounds: %s" % ub[i])
    for solved in params0[0]:
      print("solved: %s" % solved)
    print("subdiameters (squared): %s" % subdiams0[0])
    print("diameter (squared): %s" % diam0[0])
    print(" probability mass: %s" % probmass0[0])
    expectation = expectation_value(model,lower_bounds,upper_bounds)
   #print(" expectation: %s" % expectation)
    mean_value = mean(expectation,cuboid_volume)
    print(" mean value: %s" % mean_value)
    if STATUS[0] == SUCCESS and MCZERO: #XXX: should be false, or we are done
      mcdiarmid = 0.0
    else:
      mcdiarmid = mcdiarmid_bound(mean_value,sqrt(diam0[0]))
    print("McDiarmid bound: %s" % mcdiarmid)

  # determine 'best' cuts to cuboid
  for cut in range(max_cut_iterations):
    if max_cuts[0]:  #XXX: abort if max_cuts was set to zero
      print("\n..... cut iteration #%s ....." % (cut+1))
      lb,ub = make_cut(lb,ub,RVstart,RVend,cuboid_volume)

  if DEBUG:
    print("\n..... %s cuboids ....." % (cut+2)) #XXX: ?; was max_cut_iterations+1
  # get diameter for each subcuboid 
  params, subdiams, diam, probmass = test_cuboids(lb,ub,RVstart,RVend,\
                                                  cuboid_volume)
  SOLVED_PARAMETERS, SUB_DIAMETERS = params, subdiams
  TOTAL_DIAMETERS, PROBABILITY_MASS = diam, probmass