Exemplo n.º 1
0
def main():
    print("Welcome to the Market Simulator!\n")
    lengthOfSimulation = int(input("Enter the total running time: "))
    averageTimePerCus = int(
        input("Enter the average processing time per customer: "))
    probabilityOfNewArrival = float(
        input("Enter the probability of a new arrival: "))
    numCashiers = int(input("Enter the number of cashiers: "))
    if lengthOfSimulation < 1 or lengthOfSimulation > 1000:
        print("Running time must be an integer greater than 0" + \
              "\nand less than or equal to 1000")
    elif averageTimePerCus <= 0 or averageTimePerCus >= lengthOfSimulation:
        print("Average time per customer must be an integer" + \
              "\ngreater than 0 and less than running time")
    elif probabilityOfNewArrival <= 0 or probabilityOfNewArrival > 1:
        print("Probability must be geater than 0" + \
              "\nand less than or equal to 1")
    elif numCashiers <= 0:
        print("Number of cashiers must be >= 0")
    else:
        model = MarketModel(lengthOfSimulation, averageTimePerCus,
                            probabilityOfNewArrival, numCashiers)
        model.runSimulation()
        print("\n" + "-" * 40)
        print(model)
Exemplo n.º 2
0
def main():
    print("Welcome to the Market Simulator!\n")
    lengthOfSimulation = int(input("Enter the total running time: "))
    averageTimePerCus = int(
        input("Enter the average processing time per customer: "))
    probabilityOfNewArrival = float(
        input("Enter the probability of a new arrival: "))
    cashierCount = int(input("Enter the number of cashiers: "))

    if lengthOfSimulation < 1 or lengthOfSimulation > 1000:
        print("Running time must be an integer greater than 0" + \
              "\nand less than or equal to 1000")
    elif averageTimePerCus <= 0 or averageTimePerCus >= lengthOfSimulation:
        print("Average time per customer must be an integer" + \
              "\ngreater than 0 and less than running time")
    elif probabilityOfNewArrival <= 0 or probabilityOfNewArrival > 1:
        print("Probability must be geater than 0" + \
              "\nand less than or equal to 1")
    elif not isinstance(cashierCount, int) or cashierCount < 1:
        print("The number of cashiers must be a positive integer" + \
              "\nand be greater than 1")
    else:
        model = MarketModel(lengthOfSimulation, averageTimePerCus,
                            probabilityOfNewArrival, cashierCount)

        print("")
        print("----------------------------------------")
        model.runSimulation()
        print(model)
Exemplo n.º 3
0
def main():
    print("Welcome to the Market Simulator!\n")
    lengthOfSimulation = int(input("Enter the total running time: "))
    averageTimePerCus = int(input("Enter the average processing time per customer: "))
    probabilityOfNewArrival = float(input("Enter the probability of a new arrival: "))
    if lengthOfSimulation < 1 or lengthOfSimulation > 1000:
        print("Running time must be an integer greater than 0" + \
              "\nand less than or equal to 1000")
    elif averageTimePerCus <= 0 or averageTimePerCus >= lengthOfSimulation:
        print("Average time per customer must be an integer" + \
              "\ngreater than 0 and less than running time")
    elif probabilityOfNewArrival <= 0 or probabilityOfNewArrival > 1:
        print("Probability must be geater than 0" + \
              "\nand less than or equal to 1")
    else:
        model = MarketModel(lengthOfSimulation, averageTimePerCus,
                            probabilityOfNewArrival)
        model.runSimulation()
        print(model)
Exemplo n.º 4
0
    def run(self):
        """Obtains the inputs, validates them, runs the simulation,
        and displays the results."""
        # Obtain and validate the inputs
        lengthOfSimulation = self.runTimeFld.getNumber()
        averageTimePerCus = self.aveTimeFld.getNumber()
        probabilityOfNewArrival = self.probabilityFld.getNumber()
        numCashiers = self.cashiersFld.getNumber()
        if lengthOfSimulation == 0 or averageTimePerCus == 0 \
           or probabilityOfNewArrival == 0 or numCashiers == 0:
            self.messageBox("ERROR", "All inputs must be greater than 0")
            return

        # Create and run the simulation
        model = MarketModel(lengthOfSimulation, averageTimePerCus,
                            probabilityOfNewArrival, numCashiers)
        model.runSimulation()

        # Display the results
        self.outputArea.setText(str(model))
Exemplo n.º 5
0
    def run(self):
        """Obtains the inputs, validates them, runs the simulation,
        and displays the results."""
        # Obtain and validate the inputs
        lengthOfSimulation = self.runTimeFld.getNumber()
        averageTimePerCus = self.aveTimeFld.getNumber()
        probabilityOfNewArrival = self.probabilityFld.getNumber()
        numCashiers = self.cashiersFld.getNumber()
        if lengthOfSimulation == 0 or averageTimePerCus == 0 \
           or probabilityOfNewArrival == 0 or numCashiers == 0:
            self.messageBox("ERROR", "All inputs must be greater than 0")
            return

        # Create and run the simulation
        model = MarketModel(lengthOfSimulation, averageTimePerCus,
                            probabilityOfNewArrival, numCashiers)
        model.runSimulation()

        # Display the results
        self.outputArea.setText(str(model))
Exemplo n.º 6
0
from marketmodel import MarketModel

print("Welcome the Market Simulator")
lengthOfSimulation = int(input("Enter the total running time: "))
averageTimePerCus = int(input("Enter the average time per customer: "))
probabilityOfNewArrival = float(
    input("Enter the probability of a new arrival: "))

model = MarketModel(lengthOfSimulation, averageTimePerCus,
                    probabilityOfNewArrival)

model.runSimulation()
print(model)