def dpll(clauses, symbols, model): # Implementa l'algoritmo di Davis-Putnam. randomGen.count += 1 unknownClauses = [] for c in clauses: val = checkClauseTruth(model, c) if (val == False): return False if (val == None): unknownClauses.append(c) if (not unknownClauses): return True P, value = findPureSymbol(symbols, unknownClauses) if (P): return dpll(clauses, removeAll(symbols,P), copyAndAppend(model,[P,value])) P, value = findUnitClause(unknownClauses, model) if (P): return dpll(clauses, removeAll(symbols,P), copyAndAppend(model,[P,value])) P = symbols[0] symbols = removeAll(symbols, P) return (dpll(clauses, symbols, copyAndAppend(model, [P,True])) or dpll(clauses, symbols, copyAndAppend(model, [P,False])))
def plot_pos(start, end, project, step=1): data = slice_array(start, end, project, step) pos_data = [] for stepdata in data['data']: total = len(stepdata) if not total: pos_data.append(0.5) pos_count = 0 for item in stepdata: content = removeAll(item.content) if not content: total -= 1 continue if is_possitive(content): pos_count += 1 if not pos_count: pos_data.append(0.5) else: pos_data.append(float(pos_count) / total) xaxis = [item.strftime("%Y-%m-%d %H:%M") for item in data['xaxis']] return {'data': pos_data, 'xaxis': xaxis}
# Create mesh and object mesh = bpy.data.meshes.new(name + 'Mesh') obj = bpy.data.objects.new(name, mesh) obj.location = origin # Link object to scene bpy.context.scene.objects.link(obj) # Create mesh from given verts and faces mesh.from_pydata(verts, [], faces) #Update mesh with new data mesh.update(calc_edges=True) return obj # Remove all elements utils.removeAll() # Create camera target = utils.createTarget() camera = utils.createCamera((-10, -10, 10), target) # Set cursor to (0,0,0) bpy.context.scene.cursor_location = (0, 0, 0) # Create lamps utils.rainbowLights(10, 300, 3) # Create object torus = createSurface(torusSurface(4, 2), 20, 20) utils.setSmooth(torus, 2)