paper - People Server at UNCW

advertisement

Seth Register

Ethan Ingalls

CSC 380

Computer Optimization Algorithm

Abstract

The goal of this paper is to provide an of CPU, GPU, RAM, and HDD with the highest score in the lowest amount of time. examination of an algorithm designed for finding the most ideal set of computer

2. Score Benchmarking: hardware with cost and time as the constraints. We will be using hardware scores from third party sources to set our benchmark scores. We set these base case scores into our tested inputs and apply them to our different algorithms.To generate final

Determining the scores of our hardware was critical to the overall success of the project. We settled on using the benchmarked scores generated using

Futuremark's 3DMark program. results we implement a small subset of inputs and gradually increase to analyze the time complexity with the number of inputs.

The three algorithms used will be greedy,

brute force, and modified brute force.

1. Introduction

Deciding on which computer parts to buy, and what combination of parts are better than others is an often complicated task. Every year new and slightly improved computer hardware makes it debut, and only increasing the size and complexity of the selection. Our program should allow for users to easily set a cost constraint, and quickly generate an ideal set of hardware for a desktop computer.

Stemming from our original idea of optimizing video cards, we decided to combine the traveling salesman problem

(TSP) and computer hardware optimization.

By using the ideas behind TSP we are able to optimize the proficiency of the hardware, while keeping the cost as low as possible.

The three algorithms stem from commonly used ideas, but we adapted them to our own problem, and ultimately coded our own algorithms. Formally stated: Given a set of finite computer hardware (inputs) and a cost constraint, find the combination

They have tested numerous sets of hardware and have provided clear and accurate results.

We applied the score and price to each piece of hardware to create our testing set.

From the results we then generated, random, similar, scores with corresponding prices to create a large set to stress test our algorithms.

3. Brute Force

Our Brute Force algorithm follows the same principle all brute force algorithms have: to test every single possible input by simply going down the line comparing each individual element.

Starting with CPUs it goes down the list:

The time complexity of our algorithm is

O(n 4 )

Results: For our final stress testing results, we did five different tests starting at 100 to

500. Any higher and it would take significantly longer.

This graph shows score vs. number of inputs

(yAxis= Score, xAxis= #inputs)

At 100 inputs: 0.3 seconds

At 500 inputs: 168seconds

The Time graph shows how much the time grows exponentially when the number of inputs increases.

Possible holes for implementation is obviously the time vs. number inputs. At

1000inputs, it would take 7 days to find an answer.

4. Modified Brute Force:

The Modified Brute Force algorithm follows a very similar path as the Brute

Force. The difference between regular brute force and modified is that modified has two simple checks to avoid unnecessary permutations. For example if the current

CPU and GPU selections together with the cheapest RAM and HDD is greater than the input cost constraint, skip checking the rest of the permutations of that CPU and GPU because it cannot get any cheaper, it only gets more expensive as it iterates.

At 100 inputs the score was: 86923

At 500 inputs the score was: 437240

This graph shows time vs. number inputs

(yAxis= Time(ms), xAxis= #inputs)

The best case time complexity is O(n)

The average case is O(n 4 )/2

The worst case is O(n 4 )

Page: 2

This graph shows score vs. number of inputs

Results: (yAxis= Score, xAxis= #inputs)

5. Greedy

Our Greedy algorithm’s basic principle is to be lazy. It will only check the bare number of combinations to achieve a result.

Going from the ground up, it tests the first video card then moves to the first CPU,

RAM, and HDD. After a first round through, if there is money left over it simply goes to the next GPU, CPU, RAM, and HDD until it reaches the highest score while still in the price range.

At 100 inputs the score was: 86923

At 500 inputs the score was: 437240

This graph shows time vs. number of inputs

(yAxis= Time(ms), xAxis= #inputs)

At 100 inputs: 0.15 seconds

At 500 inputs: 88.6 seconds

As the inputs grow larger, the time grows by about half the amount Brute Force does.

Possible holes are, again, the time complexity in the real world. If this reached over 1000 inputs it would take about 4 days to reach a conclusion.

The Time complexity of this algorithm is

O(Log(n)), as it depends on the number of items it has to compare, but it does not search the entire list.

Page: 3

Results: Again using five inputs starting from 100 - 500:

At 100 inputs: 41801

At 500 inputs: 166160

This graph shows time vs. number of inputs

(yAxis= Time(ms), xAxis= #inputs)

At 100 inputs the time is: 1ms

At 500 inputs the time is: 1ms

At 500,000 inputs the time is: 57ms

The time is significantly quicker than Brute

Force or Modified Brute Force, but the score is much lower.

The biggest downfall of using this algorithm is, even though it will be fast, its accuracy is decreased with the number of items compared. Another issue would be determining which type of input to start with. If you put GPU at the front of the algorithm it will always favor the GPU as the first part to increase over the rest. This will not always yield the most accurate results.

6. Conclusion:

Over the course of testing, we quickly realized Modified Brute Force algorithm was the best of the three. It gives the exact same result as Brute Force, but in half the time. Greedy was extremely quick, especially with super high inputs, but the accuracy was off by a high margin. However,

Modified Brute Force will still not be practical because it will still take a much longer time given higher inputs than Greedy.

7. Future Work:

The future of this program could be huge. Given our limited time, we only had the resources to account for GPU, CPU,

RAM, and HDD. Those are the biggest factors of how efficiently a computer will run, but not all of the factors. With more time, this program could take into account all those other factors, and implement even more algorithms to generate results tailored to the user’s needs. We would also like to allow for the users to pick and choose which brands and types they prefer, and give them an option to take out a set of hardware they may not want to test and run with only the selected sets.

8. Why 380?

This project deserves 380 credit, as it has had both of us learn, design, and implement three different algorithms. We have seen the practicality of the time

Page: 4

complexities in the real world, and understand why the most thorough method may not always be the most useful. Taking away the knowledge of basic algorithm design and implementation is what we came in here to learn, and because of this project we have gone above and beyond by even stretching our programming knowledge in addition to algorithm designs.

9. Questions:

1.

What is the difference between the

Brute Force and Modified Brute

Force, and how does it affect their time complexities?

2.

What are two problems when using

Greedy algorithm?

3.

Why would a Greedy algorithm ever be used?

Answers:

1)MBF has checks to eliminate unnecessary iterations

Creates an average case about half of BF

2) Least accurate

Depends on which input is first in the code

3)With high amount of inputs

Page: 5

Download