pretty printing

This commit is contained in:
Maximilian Schlosser 2017-07-12 18:17:05 +02:00
parent a719dd974c
commit 3ccbed4d3a
2 changed files with 8 additions and 7 deletions

View file

@ -1,4 +1,4 @@
import matplotlib.pyplot as plt
from matplotlib import pyplot as plt
from matplotlib import colors
from matplotlib import patches
import numpy as np
@ -27,4 +27,4 @@ def create_plot(problem, solution):
labels = ["Job "+str(j) for j in range(0,problem.jobs)]
ax.legend(handles, labels)
plt.show()
plt.show()

View file

@ -3,14 +3,13 @@
import sys
import getopt
from SchedulingAlgorithms import simanneal as sim
from Outpout import output as o
def usage():
s= """
Command line options:
-h show this help
-p activate pretty output (matplotlib)
-p activate pretty output (requires tkinter)
-l assume that a file contains multiple problems, default is only 1
-i index of the problem you want solved. has no effect without l
@ -32,6 +31,7 @@ def main():
print(usage())
if ('-p', '') in opts:
print("Plotting enabled.")
from Output import output as o
plot = True
if('-l', '') in opts:
js1 = True
@ -48,10 +48,11 @@ def main():
from Parser import js2_style as parser
print("Parsing file: " + infile)
problem = parser.parse_file(infile)
if js1 and idx == -1:
if js1:
print("File contains " + str(len(problem)) + " problems.")
idx = int(input("Which problem do you want so solve? [0-" + str(len(problem)-1) + "] "))
problem = problem[idx]
if idx == -1:
idx = int(input("Which problem do you want so solve? [0-" + str(len(problem)-1) + "] "))
problem = problem[idx]
print(problem)
sim.init(problem)
solution = sim.anneal()