[system] / trunk / pg / lib / Value / AnswerChecker.pm Repository:
ViewVC logotype

Log of /trunk/pg/lib/Value/AnswerChecker.pm

Parent Directory Parent Directory


Links to HEAD: (view) (download) (as text) (annotate)
Sticky Revision:

Revision 2688 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 27 19:42:59 2004 UTC (15 years, 3 months ago) by dpvc
File length: 21882 byte(s)
Diff to previous 2687
Added in functMaxConstantOfIntegration support in the adaptive
parameter answer checking.  Also added a flag to the formula answer
checker that allows checking a formula up to a constant (for
integration problems).  This really just adds a new parameter to the
context and adds that to the formula, so there is nothing deep about
this.

	ANS(Formula("2x")->cmp(upToConstant=>1));

Finally, don't look for adaptive parameters if they aren't actually
used in the professor's formula (even if they are defined).

Revision 2687 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 27 00:28:27 2004 UTC (15 years, 3 months ago) by dpvc
File length: 21305 byte(s)
Diff to previous 2671
Added ability to have linear adaptive parameters in the function
answer checker.  It only works for real-valued functions, though.
To use a parameter, use

       Context()->variables->add(a=>'Parameter');

and then use 'a' as a variable within your answer.  The student will
not be allowed to enter the parameter, but the professor will.

Note that the correct answer will show the full professor's answer,
including the parameters, even though the student can't type it.  Is
this the right behaviour?

Revision 2671 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Aug 22 21:18:06 2004 UTC (15 years, 3 months ago) by dpvc
File length: 21142 byte(s)
Diff to previous 2667
Fixed some inconsistencies between handing of matrices within the
parser and Value packages.  Added a predefined Matrix context.

Revision 2667 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Aug 22 02:51:53 2004 UTC (15 years, 3 months ago) by dpvc
File length: 21097 byte(s)
Diff to previous 2664
Added support for dimension warnings in the answer checker for
formulas that return points, vectors or matrices.

Revision 2664 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 21 22:02:14 2004 UTC (15 years, 3 months ago) by dpvc
File length: 20722 byte(s)
Diff to previous 2661
Added a file to perform WeBWorK-specific modifications to the
Parser/Value packages.  (I've tried to make these independent of
WeBWorK, so you can use them in other perl code if you want to.)

The parameters for fuzzy reals and some of the other parameters now
are taken from the pg->{ansEvalDefaults} values (as defined in
global.conf or course.conf).  More still needs to be done with this,
however.

Revision 2661 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 20 15:56:56 2004 UTC (15 years, 3 months ago) by dpvc
File length: 20653 byte(s)
Diff to previous 2656
A number of fixes to make handing lists work better.  In particular,
you can now specify checks for whether the right kinds of parentheses
(or none at all) are used on the student's answer.  Some of the flags
for the list checker have been changed to accommodate this.

Revision 2656 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 20 02:13:38 2004 UTC (15 years, 3 months ago) by dpvc
File length: 19561 byte(s)
Diff to previous 2648
We need to protect the HTML in the professor's answer so that if it
contains <, for example, it won't disappear.

Revision 2648 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Aug 19 12:38:47 2004 UTC (15 years, 3 months ago) by dpvc
File length: 19548 byte(s)
Diff to previous 2634
The answer checkers now work with subclasses of Formulas that are not
part of the Value:: package tree itself (we call Value::isFormula()
rather than checking the class directly).

I also removed the various cmp_* flags that stored method names as
they ended up not needing to be used (they were intended as a means of
overriding the default method names, but subclassing turned out to be
a better approach).

I moved some initialization of the answer checker out of the anonymous
subroutine that is installed in the checker and just have that
subroutine call the correct answer's main checker (which I renamed).

Finally, I changed the student_ans value to be an HTMLized version of
the student answer, since the student could include things like < in
his answer (e.g., for vectors), in which case his whole answer might
disappear.  I wonder if this couldn't be handled better at a higher
level, as it seems wrong to make the student_ans be HTML rather than
the parsed string.  I originally thought Problem.pm could do the
protecting of HTML special characters, but this won't work without
additional changes, since some answer checkers put HTML into
student_ans to mark sytanx errors in the student answer, and you DON'T
want to protect those HTML characters.  The student_ans field is
probably being misused in this, and there might want to be another
field that gets used by Problem.pm in place of student_ans (which can
be HTML protected) when it is non-empty; say student_HTML or something
like that.  The answer checkers could use that field if it wants to
add HTML to the student answer, and student_ans otherwise, with the
assurance that it's HTML characters will be protected.  That way, if a
second answer checker calls the first (like some list checkers do),
then the second checker doesn't have to worry about removing HTML from
the student ans, and doesn't ahve to wonder whether the student_ans
actually contains an error message or syntax markings rather than the
actual student answer.

Revision 2634 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Aug 17 15:21:58 2004 UTC (15 years, 3 months ago) by dpvc
File length: 19750 byte(s)
Diff to previous 2632
Changed the string used for the student answer to be taken from the
unevaluated formula rather than the fully-evaluated one.  This leaves
constants unreplaced, for one thing.

Currently the parser combines constants automatically during the parse
[which should be controllable by a flag], so student answers that
produce numbers are fully evaluated at this point already, except for
constant substitution.  This could be changed so that even for
numberic results, the student sees the parsed expression (rather than
the numeric result), which might help them identify where they and the
parser differ in their interpretation.  It is still nice to see the
final computed result, however, but there is no place to show the
parsed input as well as the final result.  One solution would be to
add another column (wasting space).  Another would be to make the
value shown be "parsed-value = computed-value" when they are not the
same thing.  A bit ugly, but works within the current framework.

Revision 2632 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Aug 17 12:05:18 2004 UTC (15 years, 3 months ago) by dpvc
File length: 19789 byte(s)
Diff to previous 2629
Fixed typo in name of random generator.

Revision 2629 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Aug 17 02:01:27 2004 UTC (15 years, 3 months ago) by dpvc
File length: 19792 byte(s)
Diff to previous 2627
Fixed a number of minor problems with creating perl functions from
formulas (this is done automatically as part of the function answer
checker, so is showing up now that I have that checker in place).

Also improved error messages in the function answer checker, and fixed
a bug when students enter a constant list or union when the answer
checker expects formulas.

Revision 2627 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Aug 16 20:22:16 2004 UTC (15 years, 3 months ago) by dpvc
File length: 19426 byte(s)
Diff to previous 2626
Removed unwanted side-effects of some type-match checks, and moved the
ignoreStrings flag so that it is available for the checkers of ANY type.

Revision 2626 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Aug 16 19:44:26 2004 UTC (15 years, 3 months ago) by dpvc
File length: 19577 byte(s)
Diff to previous 2624
One more fix for handling intervals properly (I think it's really
right this time).  Also, named constants that end in numbers will
produce TeX output with the number as a subscript (this was already
true for variable names).

Revision 2624 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Aug 16 13:44:45 2004 UTC (15 years, 3 months ago) by dpvc
File length: 19576 byte(s)
Diff to previous 2622
Added support for unorderd list or formulas with partial credit.
Fixed type mismatch reporting in formula answer checker.
Fixed an error with Unions producing incorrect perl versions under
some circumstances.

Revision 2622 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Aug 15 22:46:57 2004 UTC (15 years, 3 months ago) by dpvc
File length: 18104 byte(s)
Diff to previous 2621
Created the first draft of the Parser's function answer checker.  Some
work still needs to be done, in particular, type mismatches are not
being reported, and lists are being processed only as ordered lists
with no partial credit.

This doesn't implement everything from fun_cmp.  In particular, there
is no support for parameter matching at the moment.  This will have to
be added, but I'm not quite sure how to do it when the function's
return value is not a real number (e.g., an interval).

On the other hand, this checker is more forgiving about domain errors:
if tries a point where the professor's function is not defined, it
ignores that one and looks for another (until it decides it can't find
one).  Once it has these points, it tries them on the student's
answer, and if the student's function is undefined, then the student
answer is wrong (since it is not defined somewhere that the
professor's funciton is).  This avoids the "Error evaluating student
function at ..." messages, which just confused most students anyway.

Revision 2621 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Aug 15 17:05:41 2004 UTC (15 years, 3 months ago) by dpvc
File length: 17162 byte(s)
Diff to previous 2617
Improved error messages, particularly when the student enters a
formula in an answer that should be constant, and also for incorrect
answers in lists of answers.  There are a few other miscellaneous output
improvements as well.

Revision 2617 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Aug 15 00:13:38 2004 UTC (15 years, 3 months ago) by dpvc
File length: 16068 byte(s)
Diff to previous 2612
The Union answer checker now uses the generic List checker, so that it
will be able to produce partial credit and hints about which Intervals
are correct.

Revision 2612 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 14 19:29:42 2004 UTC (15 years, 3 months ago) by dpvc
File length: 15738 byte(s)
Diff to previous 2611
Fixed some bugs in the handle of the context in ->string and ->TeX
methods of Value objects.

Revision 2611 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 14 15:59:35 2004 UTC (15 years, 3 months ago) by dpvc
File length: 15495 byte(s)
Diff to previous 2609
Fixed a typo in one of the parser answer checkers.  Added a line that
was incorrecctly removed in the parser.

Revision 2609 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 14 13:54:52 2004 UTC (15 years, 3 months ago) by dpvc
File length: 15496 byte(s)
Diff to previous 2606
Added a String type to the Value package.  Mostly this is to make it
possible to generate an answer checker for it that uses the parser.
It also makes it more consistent for handling things like stringify,
especially when they are recursively called internally.

Added new default strings "NONE" and "DNE", since these get used a
lot.

Modified how the default parameters are set up for the answer
checkers, and how the answer checker reports the expected answer type
in type mismatch error messages.

Revision 2606 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 14 11:25:47 2004 UTC (15 years, 3 months ago) by dpvc
File length: 14844 byte(s)
Diff to previous 2605
Can now specify that the objects stringify themselfs in their TeX
forms rather than their answer-string forms.  This makes it easier to
use the objects in the text of a problem (without having to call ->TeX
explicitly each reference).

Use

       Context()->texStrings

to start outputting TeX strings, and

      Context()->normalStrings

to switch back.

Revision 2605 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 14 02:50:18 2004 UTC (15 years, 3 months ago) by dpvc
File length: 14816 byte(s)
Diff to previous 2604
Incorporated infinities into Parser package better.  They have been
stored as String objects (with extra data) in the parser, and I've
left it that way, but now they convert to/from Vallue::Infinity
objects correctly, and these are used for generating the output.

Also added the Infinity answer checker, and adjusted the error
messages produces by type mismatches in the answer checkers and
elsewhere.

Revision 2604 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 13 23:49:16 2004 UTC (15 years, 3 months ago) by dpvc
File length: 14299 byte(s)
Diff to previous 2601
Fixed some output issues with intervals and unions.

Revision 2601 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 13 19:06:09 2004 UTC (15 years, 3 months ago) by dpvc
File length: 13956 byte(s)
Diff to previous 2600
Added ability to report incorrect coordinates in point and vector
answers, and incorrect endpoints and endpoint types in intervals.
Separated these kinds of checks from the typeMatch check, where they
didn't really belong.

Added ability to specify intervals and unions as strings in Interval()
and Union(), which makes it easier to make constants of these types.

There are still problems comparing intervals that contain infinities;
I really need to make the infinity object to solve this, so have put
off trying to fix that for now.

Revision 2600 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 13 14:39:16 2004 UTC (15 years, 3 months ago) by dpvc
File length: 11987 byte(s)
Diff to previous 2599
Handle list entries that are not Value objects better.

Revision 2599 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 13 14:19:23 2004 UTC (15 years, 3 months ago) by dpvc
File length: 11651 byte(s)
Diff to previous 2597
The List object's answer checker is now considerably improved.  It
will allow you to specify an unorderd or ordered check, and whether to
print various kinds of hints for wrong answers.

The checker can return partial credit, but WW doesn't deal well with
this at the moment (some small changes to Problem.pm can take care of
that).  Partial credit should be based on $showPartialCorrectAnswers,
but it is disabled for now.

The list answer checker probably still needs some work, especially
with non-numeric lists.

Revision 2597 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 13 11:38:22 2004 UTC (15 years, 3 months ago) by dpvc
File length: 8048 byte(s)
Diff to previous 2596
Added answer checker for parallel vectors.
Added option to number checker to have it not report type mismatches
for the known strings (like 'infinity').  (Really need a class for
infinities, and a Value.pm class for strings.)

Revision 2596 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Aug 12 23:11:32 2004 UTC (15 years, 3 months ago) by dpvc
File length: 7356 byte(s)
Diff to previous 2594
Have parser handle infinities better.

Revision 2594 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Aug 12 20:17:18 2004 UTC (15 years, 3 months ago) by dpvc
File length: 7060 byte(s)
Diff to previous 2593
Fixes for handling intervals better.  In particular, deal better with
ambiguous situations, like (1,2) that could be a point.

You can use [a,a] to specify the single point a.  I'd like to make {a}
represent this (and maybe even {a,b,c} to form finite sets), but this
would interfere with the use of { and } as alternative parentheses.
(Does anyone really use these?)

Do we need a cross product for intervals (and sets) as a means of
representing regions in R^2 (or higher)?

Revision 2593 - (view) (download) (as text) (annotate) - [select for diffs]
Added Thu Aug 12 16:48:52 2004 UTC (15 years, 3 months ago) by dpvc
File length: 6598 byte(s)
This is a preliminary attempt at adding answer checkers that use the
parser.  If you have a parser object (like a formula or a vector), you
can use the ->cmp method to get an answer checker appropriate for the
object.  For example:

	 Context('Vector');
	 $v = Vector(1,2,3);
	 #  print text of problem
	 ANS($v->cmp);

would produce an answer checker that matched against the vector <1,2,3>.
Most of the parameters are set in the Context, but additional ones can
be passed to the checker (this still needs work).

See the sample problems for more examples.

The checkers for Reals, Complexes, Points, Vectors, Matrices and
Intervals work pretty well.  The ones for List and Union objects need
more work, as they only do an ORDERED check at the moment (the student
answers must be in the same order).  This needs to be fixed.
The checker for Formula objects (which corresponds to fun_cmp) still
needs to be written.

This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

Sort log by:

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9