Write a Java program that reads an input graph data from a user. Then, it should present a path for the travelling salesman problem (TSP). In the assignment, you can assume that the maximum number of vertices in the input graph is less than or equal to 20.
Input format: This is a sample input from a user.
|
The first line (= 4 in the example) indicates that there are four vertices in the graph. The next line (= 12 in the example) indicates the number of edges in the graph. The remaining 12 lines are the edge information with the “source vertex”, “destination vertex”, and “cost”. The last line (= 0 in the example) indicates the starting vertex of the travelling salesman problem. This is the graph with the input information provided.
Sample Run 0: Assume that the user typed the following lines
4
12
0 1 2
0 3 7
0 2 5
1 0 2
1 2 8
1 3 3
2 0 5
2 1 8
2 3 1
3 0 7
3 1 9
3 2 1
0
This is the correct output. Your program should present the path and total cost in separate lines.
Path:0->1->3->2->0
Cost:11
Sample Run 1: Assume that the user typed the following lines
5
6
0 2 7
3 1 20
0 4 3
1 0 8
2 4 100
3 0 19
3
This is the correct output.
Path:
Cost:-1
Note that if there is no path for the TSP, your program should present empty path and -1 cost.
Sample Run 2: Assume that the user typed the following lines
5
7
0 2 8
2 1 7
2 4 3
1 4 100
3 0 20
3 2 19
4 3 50
3
This is the correct output of your program.
Path:3->0->2->1->4->3
Cost:185
This is the directed graph of the input data:
[Hint]: To solve this problem, you can use all permutations of the vertices, except the starting vertex. For example, there are three vertices 1, 2, and 3, in the first sample run, except the starting vertex 0. This is all permutations with the three vertices
1, 2, 3
1, 3, 2
2, 1, 3,
2, 3, 1
3, 1, 2
3, 2, 1
In: Computer Science
Create a Python program that:
Reads the content of a file (Vehlist.txt)
The file contains matching pairs of vehicle models and their
respective makes
Separate out the individual make and model on each line of the
file
Add the vehicle make to one list, and the vehicle model to another
list; such that they are in the same relative position in each
list
Prompt the user to enter a vehicle model
Search the list containing the vehicle models for a match
If a match is found, display the vehicle make by accessing the
vehicle make list entry in the same relative position the match was
found
If no match is found, display a message saying so to the user
Allow the user to enter name for the file
The program should:
Use variables with meaningful names
Display easily understood prompts when collecting user input
Have appropriate comments indicating what each part of the program
is doing
Have a comment area at the beginning of the program identifying the
author of the program and the class it was created for
Save the program as a Python module, and submit the program through
this assignment
In: Computer Science
In: Anatomy and Physiology
What is the income distribution of super shoppers? A supermarket super shopper is defined as a shopper for whom at least 70% of the items purchased were on sale or purchased with a coupon. In the following table, income units are in thousands of dollars, and each interval goes up to but does not include the given high value. The midpoints are given to the nearest thousand dollars.
| Income range | 5-15 | 15-25 | 25-35 | 35-45 | 45-55 | 55 or more |
|---|---|---|---|---|---|---|
| Midpoint x | 10 | 20 | 30 | 40 | 50 | 60 |
| Percent of super shoppers | 22% | 15% | 20% | 16% | 19% | 8% |
(a)
Using the income midpoints x and the percent of super shoppers, do we have a valid probability distribution? Explain.
Yes. The events are distinct and the probabilities do not sum to 1. Yes. The events are indistinct and the probabilities sum to less than 1. Yes. The events are distinct and the probabilities sum to 1. No. The events are indistinct and the probabilities sum to more than 1. No. The events are indistinct and the probabilities sum to 1.
(b)
Use a histogram to graph the probability distribution of part (a). (Select the correct graph.)
(c)
Compute the expected income μ of a super shopper (in
thousands of dollars). (Enter a number. Round your answer to two
decimal places.)
μ = thousands of dollars
(d)
Compute the standard deviation σ for the income of
super shoppers (in thousands of dollars). (Enter a number. Round
your answer to two decimal places.)
σ = thousands of dollars
In: Statistics and Probability
develop simple linear regression models for predicting sales as a function of the number of each type of ad. Compare these results to a multiple linear regression model using both independent variables. State each model and explain R- square, significance F and P-values.
| Concert Sales | ||
| Thousands of | Thousands of | |
| Sales ($1000) | Radio&TV ads | Newspaper ads |
| $1,119.00 | 0 | 40 |
| $973.00 | 0 | 40 |
| $875.00 | 25 | 25 |
| $625.00 | 25 | 25 |
| $910.00 | 30 | 30 |
| $971.00 | 30 | 30 |
| $931.00 | 35 | 35 |
| $1,177.00 | 35 | 35 |
| $882.00 | 40 | 25 |
| $982.00 | 40 | 25 |
| $1,628.00 | 45 | 45 |
| $1,577.00 | 45 | 45 |
| $1,044.00 | 50 | 50 |
| $914.00 | 50 | 50 |
| $1,329.00 | 55 | 20 |
| $1,330.00 | 55 | 20 |
| $1,405.00 | 60 | 30 |
| $1,436.00 | 60 | 30 |
| $1,521.00 | 65 | 35 |
| $1,741.00 | 65 | 35 |
| $1,866.00 | 70 | 40 |
| $1,717.00 | 70 | 40 |
In: Statistics and Probability
Johnson Industries finances its projects with 40 percent debt, 10 percent preferred stock, and 50 percent common stock.
What is the company’s weighted average cost of capital (WACC)? Show work.
In: Finance
D.G. is a 74-year-old woman who arrives at the emergency room complaining of shortness of breath, palpitations (for 2 days), and lower extremity edema. Her medical history includes diabetes mellitus, hypertension, heart failure with reduced ejection fraction, and osteoarthritis. She had a left heart catheterization and coronary angiography last year and has no significant coronary artery disease. She has a biventricular pacemaker/implantable defibrillator for heart failure symptom treatment and sudden cardiac death prevention. The patient’s current medications are losartan 100 mg/d, metoprolol succinate 50 mg/d, metformin 500 mg twice daily, spironolactone 25 mg/d, furosemide 40 mg/d, and naproxen 500 mg twice daily. Vital signs are as follows: blood pressure of 140/80 mm Hg, respiratory rate of 30 bpm, and heart rate of 120 bpm. ECG shows atrial fibrillation with a rapid ventricular response. Echocardiography reveals a moderately dilated left atrium, left ventricular systolic ejection fraction of 35% (unchanged), chronic kidney disease (baseline serum creatinine 1.01 mg/dL), and moderate mitral regurgitation. Pertinent laboratory values include the following: hemoglobin 12 g/dL, hematocrit 36%, platelets 300,000/microliter, and serum creatinine 1.20 mg/dL (estimated creatinine clearance 39 mL/min). Her weight is 60 kg (increased from 55 kg), and height is 5 ft 3 inches. She does not smoke and does not drink alcohol. Dietary habits include one can of Ensure daily, with other meals provided by a social service agency (Meals on Wheels). Social concerns include the fact she lives alone, but a son visits every 1 to 2 weeks and transports her to physician appointments. She is living on a limited budget. With regard to her medication adherence, her son states that she occasionally forgets to take her afternoon medications, but overall, she is considered to be reasonably adherent with her drug regimens.
Diagnosis: Atrial fibrillation, acute onset
Answer the following questions. Include two references, cited in APA style.
List specific goals of treatment for D.G.
What drug therapy would you prescribe for stroke prevention in atrial fibrillation? Why?
What are the parameters for monitoring success of the anticoagulant therapy?
Discuss specific patient education based on the prescribed therapy.
List one or two adverse reactions for the selected agent that would cause you to change therapy.
What would be the choice for the second-line therapy?
What OTC or alternative medications would be appropriate for D.G.?
What lifestyle changes would you recommend to D.G.?
Describe one or two drug–drug or drug–food interactions for the selected agent.
In: Nursing
In: Accounting
Find the equation of the regression line for the given data. Then construct a scatter plot of the data and draw the regression line. (The pair of variables have a significant correlation.) Then use the regression equation to predict the value of y for each of the given x-values, if meaningful. The table below shows the heights (in feet) and the number of stories of six notable buildings in a city. Height comma x 762 621 515 508 491 480 (a) xequals499 feet (b) xequals641 feet Stories, y 51 46 45 41 37 35 (c) xequals315 feet (d) xequals726 feet Find the regression equation. ModifyingAbove y with caretequals nothingxplusleft parenthesis nothing right parenthesis (Round the slope to three decimal places as needed. Round the y-intercept to two decimal places as needed.) Choose the correct graph below. A. 0 800 0 60 Height (feet) Stories A scatterplot has a horizontal axis labeled Height in feet from 0 to 800 in increments of 200 and a vertical axis labeled Stories from 0 to 60 in increments of 10. The following points are plotted: (742, 31), (601, 36), (495, 35), (488, 31), (471, 27), (460, 25). A trend line that falls from left to right passes through the points (200, 33), and (600, 30). All coordinates are approximate. B. 0 800 0 60 Height (feet) Stories A scatterplot has a horizontal axis labeled Height in feet from 0 to 800 in increments of 200 and a vertical axis labeled Stories from 0 to 60 in increments of 10. The following points are plotted: (752, 33), (601, 31), (485, 30), (458, 41), (331, 27), (280, 35). A trend line that falls from left to right passes through the points (200, 44), and (600, 40). All coordinates are approximate. C. 0 800 0 60 Height (feet) Stories A scatterplot has a horizontal axis labeled Height in feet from 0 to 800 in increments of 200 and a vertical axis labeled Stories from 0 to 60 in increments of 10. The following points are plotted: (772, 56), (631, 51), (525, 50), (518, 46), (501, 42), (490, 40). A trend line that rises from left to right passes through the points (200, 35), and (600, 54). All coordinates are approximate. D. 0 800 0 60 Height (feet) Stories A scatterplot has a horizontal axis labeled Height in feet from 0 to 800 in increments of 200 and a vertical axis labeled Stories from 0 to 60 in increments of 10. The following points are plotted: (762, 51), (621, 46), (515, 45), (508, 41), (491, 37), (480, 35). A trend line that rises from left to right passes through the points (200, 25), and (600, 44). All coordinates are approximate. (a) Predict the value of y for xequals499. Choose the correct answer below. A. 40 B. 51 C. 46 D. not meaningful (b) Predict the value of y for xequals641. Choose the correct answer below. A. 46 B. 31 C. 40 D. not meaningful (c) Predict the value of y for xequals315. Choose the correct answer below. A. 46 B. 51 C. 31 D. not meaningful (d) Predict the value of y for xequals726. Choose the correct answer below. A. 51 B. 40 C. 31 D. not meaningful
In: Statistics and Probability
A small business enterprise makes dresses and trousers. To make a dress requires 12 hour of cutting and 20 minutes of stitching. To make trousers requires 15 minutes of cutting and 12 hour of stitching. The profit on a dress is N$40 and on a pair of trousers N$50. The business operates for a maximum of 8 hours per day. Determine how many dresses and trousers should be made to maximize the profit and what the maximum profit is?
In: Statistics and Probability