|
-
Aug 29th, 2004, 11:07 PM
#1
Thread Starter
Addicted Member
can someone?
Cans omeone help me with this one?
Maximize
P = 40x1 + 60x2 + 50x3
Subject to the constraints
2x1 + 2x2 + x3 < 8
X1 – 4x2 + 3x3 < 12
X1 > 0 X2 > 0 X3 > 0
-
Sep 1st, 2004, 12:38 AM
#2
Fanatic Member
P = 40x1 + 60x2 + 50x3 = 40x + 120x + 150x = 310x
max = infinity
Unless you mean 40x^1 + 60x^2 + 50x^3 in whichcase:
dx/dy(x^n )= nx^n
dx/dy(50x^3 + 60x^2 + 40x) = 150x^2 + 120x + 40
maximums and minimums are at:
150x^2 + 120x + 40 = 0
15x^2 + 12x + 4 = 0
x = (-12 +- sqr(12^2 - 4*15*4))/2*15 = -12/30 +- sqr(144-240)/30
= -2/5 +- i*sqr(96)/30 = -2/5 +- i*4*sqr(6)/30 = -2/5 +- 2i*sqr(6)/15
= -2/5 + .326i or -2/5 - .326i
The answer is imaginary.
Don't pay attention to this signature, it's contradictory.
-
Sep 1st, 2004, 04:21 AM
#3
Fanatic Member
hmm
i think they mean there are three variables:
x1, x2 and x3
In that case, there is a simple algorithm that solves all these things for you, I think it's even call SIMPLEX, just search for it, and you'll probably be able to find a program that solves them for you.
sql_lall 
-
Sep 1st, 2004, 11:37 AM
#4
Fanatic Member
Well then why in the world didn't he just use x, y and z???
Don't pay attention to this signature, it's contradictory.
-
Sep 3rd, 2004, 09:00 AM
#5
New Member
Hello:
This simple visual basic probabilistic program can solve your problem:
Code:
RANDOMIZE
pmax=-1e30
FOR i=1 TO 10000
' random digits in the range 0-8
x1=INT(8*RND)
x2=INT(8*RND)
x3=INT(8*RND)
' test the inequalities
IF 2*x1+2*x2+x3<8 AND x1-4*x2+3*x3<12 THEN
' calculate p
p=40*x1+60*x2+50*x3
' is better?
IF p>pmax THEN
pmax=p
PRINT x1, x2, x3, pmax
END IF
END IF
NEXT i
The solution is x1=0, x2=1, x3=5 and the maximum is 310
If you wish real numbers rather than integer numbers, remove the "INT" in the code.
Regards
-
Sep 3rd, 2004, 12:15 PM
#6
Fanatic Member
Originally posted by MarcoA
Hello:
This simple visual basic probabilistic program can solve your problem:
Code:
RANDOMIZE
pmax=-1e30
FOR i=1 TO 10000
' random digits in the range 0-8
x1=INT(8*RND)
x2=INT(8*RND)
x3=INT(8*RND)
' test the inequalities
IF 2*x1+2*x2+x3<8 AND x1-4*x2+3*x3<12 THEN
' calculate p
p=40*x1+60*x2+50*x3
' is better?
IF p>pmax THEN
pmax=p
PRINT x1, x2, x3, pmax
END IF
END IF
NEXT i
The solution is x1=0, x2=1, x3=5 and the maximum is 310
If you wish real numbers rather than integer numbers, remove the "INT" in the code.
Regards
int(8*rnd) returns a random number between 0 and 7, not 0 and 8.
also, it would make more sense to just loop x1, x2 and x3 through all the values of 8. It totals up to 512 iterations MAX.
Don't pay attention to this signature, it's contradictory.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|