Results 1 to 6 of 6

Thread: can someone?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Location
    Atlanta Ga.
    Posts
    177

    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

  2. #2
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860
    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.

  3. #3
    Fanatic Member sql_lall's Avatar
    Join Date
    Jul 2002
    Location
    Up Above (i.e. AUS)
    Posts
    571

    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

  4. #4
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860
    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.

  5. #5
    New Member
    Join Date
    Sep 2004
    Location
    Chile
    Posts
    6
    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

  6. #6
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860
    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
  •  



Click Here to Expand Forum to Full Width