[npl] / trunk / NationalProblemLibrary / ASU-topics / set119LPsimplex / p8.pg Repository:
ViewVC logotype

View of /trunk/NationalProblemLibrary/ASU-topics/set119LPsimplex/p8.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 268 - (download) (annotate)
Sat Jun 3 14:35:45 2006 UTC (6 years, 11 months ago) by gage
File size: 2194 byte(s)
 Cleaned code with convert-functions.pl script

    1 ## DESCRIPTION
    2 ##   Simplex Method
    3 ## ENDDESCRIPTION
    4 
    5 ## KEYWORDS('Simplex Method')
    6 ## Tagged by nhamblet
    7 
    8 ## DBsubject('Algebra')
    9 ## DBchapter('Linear Programming')
   10 ## DBsection('Simplex Method')
   11 ## Date('')
   12 ## Author('')
   13 ## Institution('ASU')
   14 ## TitleText1('')
   15 ## EditionText1('')
   16 ## AuthorText1('')
   17 ## Section1('')
   18 ## Problem1('')
   19 
   20 #
   21 # First comes some stuff that appears at the beginning of every problem
   22 #
   23 
   24 DOCUMENT();        # This should be the first executable line in the problem.
   25 
   26 loadMacros(
   27 "PG.pl",
   28 "PGbasicmacros.pl",
   29 "PGchoicemacros.pl",
   30 "PGanswermacros.pl",
   31 "PGauxiliaryFunctions.pl",
   32 "LinearProgramming.pl",
   33 "PGmatrixmacros.pl",
   34 "PGasu.pl"
   35 );
   36 
   37 
   38 TEXT(beginproblem());
   39 
   40 
   41 $tops1 = ['P', 'x_1', 'x_2', 's_1', 's_2', '\mbox{\tiny{RHS}}'];
   42 $tops2 = ['P', 'x_1', 'x_2', 'x_3', 's_1', 's_2', 's_3', '\mbox{\tiny{RHS}}'];
   43 
   44 
   45 $sys1 = [[0, 0, random(-20,20), random(-20,20), 1, 0, 0, random(15, 45)],
   46 [0, random(-20,20), random(-20,20), random(-20,20), 0, 1, 0, random(15, 80)],
   47 [0, random(-20,20), random(-20,20), random(-20,20), 0, 0, 1, random(15, 80)],
   48 [1, random(2,20), random(2,20), random(2,20), 0, 0, 0, random(20, 200)]];
   49 
   50 @sl1 = (0, 5,1,6,4, 2, 3, 7);
   51 @ans1 = (0, 0, 0, 0, $sys1->[0][7], $sys1->[1][7],$sys1->[2][7],$sys1->[3][7]);
   52 @ans1=@ans1[@sl1];
   53 for $jj (0..3) {
   54   $sys1->[$jj] = [ @{$sys1->[$jj]}[@sl1] ];
   55 }
   56 
   57 BEGIN_TEXT
   58 For the simplex tableau given below, enter the current values of the requested
   59 variables.
   60 
   61   $BR$BR
   62 \[\{ lp_display_mm($sys1, top_labels=>$tops2) \} \]
   63 $BR
   64 \(x_1 = \) \{ ans_rule(10) \}
   65 $BR
   66 \(x_2 = \) \{ ans_rule(10) \}
   67 $BR
   68 \(x_3 = \) \{ ans_rule(10) \}
   69 $BR
   70 \(s_1 = \) \{ ans_rule(10) \}
   71 $BR
   72 \(s_2 = \) \{ ans_rule(10) \}
   73 $BR
   74 \(s_3 = \) \{ ans_rule(10) \}
   75 $BR
   76 \(P = \) \{ ans_rule(10) \}
   77 
   78 END_TEXT
   79 
   80 #
   81 # Tell WeBWork how to test if answers are right.  These should come in the
   82 # same order as the answer blanks above.  You tell WeBWork both the type of
   83 # "answer evaluator" to use, and the correct answer.
   84 #
   85 
   86 ANS(num_cmp($ans1[1]));ANS(num_cmp($ans1[2]));
   87 ANS(num_cmp($ans1[3]));ANS(num_cmp($ans1[4]));
   88 ANS(num_cmp($ans1[5]));ANS(num_cmp($ans1[6]));
   89 ANS(num_cmp($ans1[7]));
   90 
   91 ENDDOCUMENT();        # This should be the last executable line in the problem.

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9