[npl] / trunk / NationalProblemLibrary / ASU-topics / set119LPsimplex / p9.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# View of /trunk/NationalProblemLibrary/ASU-topics/set119LPsimplex/p9.pg

Sat Jan 14 02:13:08 2006 UTC (7 years, 4 months ago) by jj
File size: 1349 byte(s)
New problems for the library.


    1 ##DESCRIPTION
2 ##   Evaluation of a simple algebraic expression
3 ##ENDDESCRIPTION
4
5 ##KEYWORDS('percent')
6
7 #
8 # First comes some stuff that appears at the beginning of every problem
9 #
10
11 DOCUMENT();        # This should be the first executable line in the problem.
12
14 "PG.pl",
15 "PGbasicmacros.pl",
16 "PGchoicemacros.pl",
18 "PGauxiliaryFunctions.pl",
19 "PGasu.pl"
20 );
21
22 TEXT(&beginproblem);
23
24 #
25 # Now we do the randomization of variables, and other computations
26 # as needed for this problem.  Sometimes we compute the answers here.
27 #
28
29 $a = random(2,4); 30 do {$b = random(2,5); } until ($b !=$a);
31
32 $d = random(3, 6); 33$c = $d+random(1,3); 34 35$ab = $a*$b;
36 @c1 = ($c,$d);
37 @r2 = ($b,$a);
38 @s = NchooseK(2,2);
39 @c1 = @c1[@s];
40 @r2 = @r2[@s];
41
42 BEGIN_TEXT
43 Use the simplex method to maximize
44 $P = c1[0] x_1 + c1[1] x_2$
45 subject to
46 $47 \begin{array}{rrrrr} 48 x_1 & + & x_2 & \le & a \cr 49 r2[0] x_1 & + & r2[1] x_2 & \le & ab \cr 50 \end{array} 51$
52 $BR 53 $x_1 \ge 0\ \qquad x_2 \ge 0$ 54$BR$BR 55 $$P =$$ \{ans_rule(40)\} 56 END_TEXT 57 58 # 59 # Tell WeBWork how to test if answers are right. These should come in the 60 # same order as the answer blanks above. You tell WeBWork both the type of 61 # "answer evaluator" to use, and the correct answer. 62 # 63 64 ANS(num_cmp($a*\$c));
65
66 ENDDOCUMENT();        # This should be the last executable line in the problem.
67