Linear programming 1

Algebra Level pending

A farmer has 500acres of land kept for grazing by some animals.The estimate that one cow requires five acres and one goat requires 4 acres.The farmer has the facilities for 40 cows and 100 goats.if the farmer makes $300 per cow and $100 per goat.How many cow and goat should be varse for maximum profit.(linear programming)

No answer in options 1600 16 000 30 000

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Steven Chase
Feb 12, 2021

Since the number of each type of animal is an integer, and these integers must be within finite ranges, there are finitely many permutations. One can simply evaluate them all and see which one is best.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import math

#########################

# Initialize values of optimal profit, and associated numbers of animals

Pmax = 0

C_store = 0   
G_store = 0

#########################

for C in range(0,41):       # number of cows - limited by facilities
    for G in range(0,101):  # number of goats - limited by facilities

        A = 5*C + 4*G   # Acres required

        if A <= 500:      # If within acres available

            P = 300*C + 100*G   # Calculate profit

            if P > Pmax:      # if profit greater than max seen so far

                Pmax = P      # Update max profit

                C_store = C   # .......and update optimal number of cows and goats
                G_store = G

#########################

print Pmax
print ""
print C_store
print G_store
print ""
print (C_store + G_store)

#>>> 
#19500

#40
#75

#115
#>>> 

@Steven Chase will I be able to see your previous problems?
Why don't you reply ?

Talulah Riley - 6 days, 23 hours ago

Log in to reply

I think you will be able to download your own problems, but not mine. They are putting together some sort of download feature

Steven Chase - 6 days, 4 hours ago
Tom Engelsman
Feb 12, 2021

This can be modeled per the following linear program:

M A X $ 300 c + $ 100 g MAX \$300c + \$100g

Subject to:

5 c + 4 g 500 ; 5c+4g \le 500;

0 c 40 ; 0 \le c \le 40;

0 g 100 ; 0 \le g \le 100;

which gives the feasible region:

and the critical vertices ( c , g ) = ( 0 , 0 ) ; ( 40 , 0 ) ; ( 40 , 75 ) ; ( 20 , 100 ) ; ( 0 , 100 ) (c,g) = (0,0); (40,0); (40,75); (20,100); (0,100) . Of these point, the maximum profit objective occurs at ( c , g ) = ( 40 , 75 ) $ 300 ( 40 ) + $ 100 ( 75 ) = $ 19 , 500 (c,g) = (40,75) \Rightarrow \$300(40) + \$100(75) = \boxed{\$19,500}

leaving us with Choice A as the answer.

Fletcher Mattox
Feb 12, 2021
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from scipy.optimize import minimize

def profit(x):
    cows, goats = x
    return -(300*cows + 100*goats)

def constraint(x):
    cows, goats = x
    return 500 - 5*cows - 4*goats

constraints = ({'type':'ineq', 'fun':constraint})
bounds = [(0, 40), (0, 100)]
x0 = [10, 20]
res = minimize(profit, x0, constraints=constraints, bounds=bounds, method='SLSQP')
print(round(-res.fun))

1
19500

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...