Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

An important part of writing code is writing efficient code that takes as little time as possible to run. This particularly important when dealing with

An important part of writing code is writing efficient code that
takes as little time as possible to run. This particularly important
when dealing with large problems, as is often the case for real-world
optimisation problems.
Here the task is to compare the efficiency of your code written in
Question 3 with the code given in Question 4 to see which format
is best (that is, fastest).
For this question you cannot use the AMPL version downloaded
from learnOnline as this version will only solve small problems.
Download and install the AMPL Community Edition, and use the
open-source solver HiGHS which allows problems of any size. Choose
the HiGHS solver with
option solver highs ;
(a) The code
display _total_solve_time ;
will show the time taken to complete the last solve command.
Place this code at the end of your code written in Question 3
and at the end of the code given in Question 4.
Systematically run the code from both Question 3 and Ques-
tion 4 for all numbers of cities n given in and record the time
taken to solve each problem. Since the solve time can be
quite variable, you should do each test multiple times and
then calculate the average time (use your judgement to deter-
mine how many runs you should do). Also, you want this to
be a fair test so do all runs on the same computer under the
same conditions.
Note that two largest problems n=30,40 will take some time
to run, and it is possible that your computer is not able to
solve them using both codes. If you fail to solve these larger
problems, then make a note of this and complete this question
without these results (you will not be penalised).
Tabulate your results. Comment on anything that you think
is interesting or important about these results. In particular,
comment on the efficiency of the code.
(b) Plot the average run times against n for both codes on the
same graph. Make sure your graph is displaying useful in-
formation (for example, you might find that a log plot or a
semilog plot is more informative than a linear plot).
From your plot, estimate how long it might take to solve a
TSP with n=100 cities (assuming it is possible to do so).
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions

Question

Identify the process and purpose of financial statement analysis.

Answered: 1 week ago