Question

In this problem, you’ll use brute force search to find an optimal answer. Suppose you’ve been...

In this problem, you’ll use brute force search to find an optimal answer. Suppose you’ve been

tasked to design a normal, rectangular building, unlike Luddy, that has a loss of heat given by:

f(x, y, z) = 11xy + 14yz + 15xz

where the variables x, y, z are the three dimensions. We want to have a building with minimalheat loss. Suppose the volume of the building is 147,840ft3 ; in other words:

xyz = 147840

Although we can solve this using calculus, we prefer search! We want to find values for each

variable from zero to 100 inclusive that minimizes the heat loss that equals the volume. So your

function will find x, y, z where f(x, y, z) is a minimum and equal to the building size.

def vol(x,y,z):

return x*y*z == 147840

def f(x,y,z):

# TODO: for a single value of x, y, z, caluclate the value of function "f"

pass

if __name__ == "main":

#some arbitrary starting point

a,b,c = 1,1,1

# TODO: LOOPS SEARCHING THROUGH all possible

#VALUES KEEPING MINIMUM

# HINT: There should be no print statements in the for loops

# Do not remove these statements

print("Smallest dimension possible")

print("H W L Value")

print(a,b,c,f(a,b,c))

In Python Brute Force Search

The Output needs to be this:

H W L Value

56 60 44 110880

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I have updated the f(x,y,z) function and also the loop to find out the minimum value.

def vol(x,y,z):
return x*y*z == 147840

def f(x,y,z):
# TODO: for a single value of x, y, z, caluclate the value of function "f"
return 11*x*y+14*y*z+15*x*z

pass

if __name__ == "main":
#some arbitrary starting point
a,b,c = 1,1,1
# TODO: LOOPS SEARCHING THROUGH all possible
hl=1000000
for i in range(100):
for j in range(100):
for k in range(100):
if vol(i,j,k):
temp=f(i,j,k)
if temp < hl :
a=i
b=j
c=k
#VALUES KEEPING MINIMUM
# HINT: There should be no print statements in the for loops
# Do not remove these statements
print("Smallest dimension possible")
print("H W L Value")
print(a,b,c,f(a,b,c))


//Kindly Upvote the answer if it helps to solve your query and comment to ask if you have any queries regarding the solution or approach.

Add a comment
Know the answer?
Add Answer to:
In this problem, you’ll use brute force search to find an optimal answer. Suppose you’ve been...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT