Answer to Question #332702 in Python for GIGIG

Question #332702

A . An airline intends to extend its air fleet by purchasing three types of aircrafts, denoted by I, II and III respectively. The available budget is 5000 units. The three types have the following features: 

l .costs 100 units, has a range of 6.000 km and the collision avoidance system range is 30 km; 

II. costs 60 units, has a range of 4.200 km and the collision avoidance system range is 48 km;

III. costs 50 units, has a range of 2.800 km and the collision avoidance system range is 32 km; 

Compute how many aircrafts from each type should be purchased such that 

-the budget is not exceeded 

-the mean flight range is maximized the mean of 

-the collision avoidance system range is at least 40 km.


Q. Solve A using the backtracking algorithm.

1
Expert's answer
2022-04-24T17:16:54-0400


def maximum(ans,sm,lus,lmk,sz,cnt):
  if(sz<=0):
    ans.append(sm)
    sm=0
    print(cnt)
    return;
  else:
    for i in range(3):
      sm+=lmk[i]
      sz-=lus[i]
      cnt+=1
      maximum(ans,sm,lus,lmk,sz,cnt)
      return;
sz=5000
lus=[100,60,50]
lmk=[600,4200,2800]
dmk=[30,48,32]
ans=list()
sm=0
cnt=0
maximum(ans,sm,lus,lmk,sz,cnt)  
print(ans)#We can optimized code

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS