pretty printing
This commit is contained in:
parent
a719dd974c
commit
3ccbed4d3a
|
@ -1,4 +1,4 @@
|
||||||
import matplotlib.pyplot as plt
|
from matplotlib import pyplot as plt
|
||||||
from matplotlib import colors
|
from matplotlib import colors
|
||||||
from matplotlib import patches
|
from matplotlib import patches
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -27,4 +27,4 @@ def create_plot(problem, solution):
|
||||||
labels = ["Job "+str(j) for j in range(0,problem.jobs)]
|
labels = ["Job "+str(j) for j in range(0,problem.jobs)]
|
||||||
ax.legend(handles, labels)
|
ax.legend(handles, labels)
|
||||||
|
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
11
src/main.py
11
src/main.py
|
@ -3,14 +3,13 @@
|
||||||
import sys
|
import sys
|
||||||
import getopt
|
import getopt
|
||||||
from SchedulingAlgorithms import simanneal as sim
|
from SchedulingAlgorithms import simanneal as sim
|
||||||
from Outpout import output as o
|
|
||||||
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
s= """
|
s= """
|
||||||
Command line options:
|
Command line options:
|
||||||
-h show this help
|
-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
|
-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
|
-i index of the problem you want solved. has no effect without l
|
||||||
|
|
||||||
|
@ -32,6 +31,7 @@ def main():
|
||||||
print(usage())
|
print(usage())
|
||||||
if ('-p', '') in opts:
|
if ('-p', '') in opts:
|
||||||
print("Plotting enabled.")
|
print("Plotting enabled.")
|
||||||
|
from Output import output as o
|
||||||
plot = True
|
plot = True
|
||||||
if('-l', '') in opts:
|
if('-l', '') in opts:
|
||||||
js1 = True
|
js1 = True
|
||||||
|
@ -48,10 +48,11 @@ def main():
|
||||||
from Parser import js2_style as parser
|
from Parser import js2_style as parser
|
||||||
print("Parsing file: " + infile)
|
print("Parsing file: " + infile)
|
||||||
problem = parser.parse_file(infile)
|
problem = parser.parse_file(infile)
|
||||||
if js1 and idx == -1:
|
if js1:
|
||||||
print("File contains " + str(len(problem)) + " problems.")
|
print("File contains " + str(len(problem)) + " problems.")
|
||||||
idx = int(input("Which problem do you want so solve? [0-" + str(len(problem)-1) + "] "))
|
if idx == -1:
|
||||||
problem = problem[idx]
|
idx = int(input("Which problem do you want so solve? [0-" + str(len(problem)-1) + "] "))
|
||||||
|
problem = problem[idx]
|
||||||
print(problem)
|
print(problem)
|
||||||
sim.init(problem)
|
sim.init(problem)
|
||||||
solution = sim.anneal()
|
solution = sim.anneal()
|
||||||
|
|
Loading…
Reference in a new issue