Exemplo n.º 1
0
# print "(D)", dependencyGraph.vs["D"]["directPrice"], "-", dependencyGraph.vs["D"]["craftPrice"]

# dependencyGraph.setPrice("D", 6)
# print "-" * 40
# print "(A)", dependencyGraph.vs["A"]["directPrice"], "-", dependencyGraph.vs["A"]["craftPrice"]
# print "(B)", dependencyGraph.vs["B"]["directPrice"], "-", dependencyGraph.vs["B"]["craftPrice"]
# print "(C)", dependencyGraph.vs["C"]["directPrice"], "-", dependencyGraph.vs["C"]["craftPrice"]
# print "(D)", dependencyGraph.vs["D"]["directPrice"], "-", dependencyGraph.vs["D"]["craftPrice"]

# dependencyGraph.setPrice("B", 20)
# print "-" * 40
# print "(A)", dependencyGraph.vs["A"]["directPrice"], "-", dependencyGraph.vs["A"]["craftPrice"]
# print "(B)", dependencyGraph.vs["B"]["directPrice"], "-", dependencyGraph.vs["B"]["craftPrice"]
# print "(C)", dependencyGraph.vs["C"]["directPrice"], "-", dependencyGraph.vs["C"]["craftPrice"]
# print "(D)", dependencyGraph.vs["D"]["directPrice"], "-", dependencyGraph.vs["D"]["craftPrice"]

# dependencyGraph.setPrice("A", 30)
# print "-" * 40
# print "(A)", dependencyGraph.vs["A"]["directPrice"], "-", dependencyGraph.vs["A"]["craftPrice"]
# print "(B)", dependencyGraph.vs["B"]["directPrice"], "-", dependencyGraph.vs["B"]["craftPrice"]
# print "(C)", dependencyGraph.vs["C"]["directPrice"], "-", dependencyGraph.vs["C"]["craftPrice"]
# print "(D)", dependencyGraph.vs["D"]["directPrice"], "-", dependencyGraph.vs["D"]["craftPrice"]

dependencyGraph.setPrice("A", 30)
dependencyGraph.setPrice("B", 20)
dependencyGraph.setPrice("C", 2)
dependencyGraph.setPrice("D", 6)

print "\n"
print dependencyGraph.getPriceDiffs()
Exemplo n.º 2
0
	count += 1

	if count % 1000 == 0:
		print count, "/", total, "(", (count / (total / 100)), "%)"

	auctionItem = str(auction["item"])
	auctionPrice = auction["buyout"]
	auctionQuant = auction["quantity"]
	auctionPricePU = float(auctionPrice) / auctionQuant

	dependencyGraph.addVertex(auctionItem)

	vertexPrice = dependencyGraph.getPrice(auctionItem)

	if vertexPrice > auctionPricePU:
		dependencyGraph.setPrice(auctionItem, auctionPricePU)

	edges = relationsGraph.getEdges(auctionItem)

	for edge in edges:
		dependencyGraph.addEdge(auctionItem, edge[0], edge[1])

# get a sorted list of craft / direct price differences
diffs = dependencyGraph.getPriceDiffs()

# dump price differences to file
diffFile = open("/ABSOULTE_PATH_TO/data/diff-file.csv", "w")

for diff in diffs:
	diffFile.write(
		",".join([