Forum archive 2000-2006

Gavin LaRose - subsequent problems having same seed

Gavin LaRose - subsequent problems having same seed

by Arnold Pizer -
Number of replies: 0
inactiveTopicsubsequent problems having same seed topic started 6/20/2002; 1:54:26 AM
last post 6/25/2002; 4:09:39 AM
userGavin LaRose - subsequent problems having same seed  blueArrow
6/20/2002; 1:54:26 AM (reads: 1150, responses: 7)
What I'd like to do is take a long multi-part problem and split it into several problem files. To make this work, however, each problem file would need to have the same data---that is, the same problem seed. I'm thinking that in practice probably the only way to do this is to set the seed for each of the problem files to the same, arbitrary value (e.g., something to do with the psvn). Is there a better way that I've not thought of?

Following up with this thought, is it possible to include information that a student submitted in a previous problem in the current one? For example, in problem 1 the student includes a function "foo" as one answer. For problem 2, we want the student to use this function. Thus we'd like to have the problem show up saying something like:

   In problem 1 you entered the function: foo
Use this function to...
Is this possible? It looks like processProblem8 has access to this data, but it's not clear to me how to or whether it could be included in the problem.

Thanks!
Gavin

<| Post or View Comments |>


userMichael Gage - Re: subsequent problems having same seed  blueArrow
6/20/2002; 2:49:33 AM (reads: 1313, responses: 0)
Hi Gavin,

CAPA originally used the psvn to generate seeds, but we've found that it can be rather constraining -- too many dependencies that aren't really related. In particular the psvn's, currently generated randomly, are really just unique identifiers for each record in the database. If one switches databases (something we're working hard on) the results may change.

The new database model would give you control over setting the seed for each problem and you could write your own routine for deciding the dependencies.

Here's my suggestion -- it's a kludge which will work in the meantime -- and changes code in a minimal number of places.

The idea is that in the setDefinion file we can add an extra field -- set to 1 it demands that we use the seed from the previous problem. Set to 0 or omitted gives the current behavior.

In FILE.pl change the readSetDef subroutine to check for the extra field and return (as a last variable) a reference to the new array of directives as to whether or not to use the previous seed. (Perhaps force the 0th element to always be zero, since you will never? use the seed given to the previous student.)

Next, in the proceduresForBuildProbSetDB.pl and the subroutine buildProbSetDB

accept the extra array reference -- approximatly line 49-50

Finally at line 281--282 modify the lines so that the seed is chosen appropriately -- if the method is not "readFromLogFile" then check to see if you are supposed to reuse the seed. if so reuse it, otherwise generate a new one. In each case save a copy of the seed in a variable whose scope contains the while statement looping through the problems. This will be needed for the next problem in case it wants to reuse the seed.

This change should be backword compatible, so if you get time to hack it we can put it in our CVS for others who would like to do this. It's a nice new feature. We'll make sure it is included, in a cleaner way, in the next version.

Take care,

Mike

<| Post or View Comments |>


userMichael Gage - Re: subsequent problems having same seed  blueArrow
6/20/2002; 2:50:02 AM (reads: 1288, responses: 0)
Hi Gavin,

CAPA originally used the psvn to generate seeds, but we've found that it can be rather constraining -- too many dependencies that aren't really related. In particular the psvn's, currently generated randomly, are really just unique identifiers for each record in the database. If one switches databases (something we're working hard on) the results may change.

The new database model would give you control over setting the seed for each problem and you could write your own routine for deciding the dependencies.

Here's my suggestion -- it's a kludge which will work in the meantime -- and changes code in a minimal number of places.

The idea is that in the setDefinion file we can add an extra field -- set to 1 it demands that we use the seed from the previous problem. Set to 0 or omitted gives the current behavior.

In FILE.pl change the readSetDef subroutine to check for the extra field and return (as a last variable) a reference to the new array of directives as to whether or not to use the previous seed. (Perhaps force the 0th element to always be zero, since you will never? use the seed given to the previous student.)

Next, in the proceduresForBuildProbSetDB.pl and the subroutine buildProbSetDB

accept the extra array reference -- approximatly line 49-50

Finally at line 281--282 modify the lines so that the seed is chosen appropriately -- if the method is not "readFromLogFile" then check to see if you are supposed to reuse the seed. if so reuse it, otherwise generate a new one. In each case save a copy of the seed in a variable whose scope contains the while statement looping through the problems. This will be needed for the next problem in case it wants to reuse the seed.

This change should be backword compatible, so if you get time to hack it we can put it in our CVS for others who would like to do this. It's a nice new feature. We'll make sure it is included, in a cleaner way, in the next version.

Take care,

Mike

<| Post or View Comments |>


userArnold K. Pizer - Re: subsequent problems having same seed  blueArrow
6/20/2002; 3:11:23 AM (reads: 1295, responses: 0)
Hi Gavin,

Let me make a comment on sharing problem seeds. From time to time I have though about adding the concept of "linked" problems. Linked problems would share the same seed (and that's all they would share). Then if the linked problems defined the same random variables in the same order, they would share the same problem data (it would be the responsibility of problem authors to do this). This could also allow what I think of as "inserts" --- e.g. "the next three problems concern the function f(x) = 3sin(5x)" where the insert (by definition a pg problem that is not scored and usually would not require an answer and would probably be displayed in a separate window) and the three following problems would be linked. Linked problems would be designated in the set definition file and would require only a trivial change to the code that actually builds the problem sets. Would other people besides Gavin find this useful?

You could extend the concept of "linked" to include sharing access to of data in the database, e.g. student answers, but I think the real problem here would be to design a good interface for accessing that information (via the problem set, problem name, answer_name??). E.g. a student's last answer for a problem is storred in a string that breaks up into a hash where each answer_name points to the associated student answer. Most people writing problems are not aware of answer_names, they just use automatically generated default ones.

To answer your original question, off the top of my head, I can not think of a better way of sharing seeds then what you suggest (assuming you don't want to monkey with the build problem set code).

Arnie

<| Post or View Comments |>


userGavin LaRose - Re: subsequent problems having same seed  blueArrow
6/20/2002; 6:27:54 AM (reads: 1311, responses: 0)
Hi Mike & Arnie,

It looks like Mike's suggestion is both pretty straightforward and easy to implement. I've edited the two files indicated to allow for an additional field in the problem definition file and that seems to work. I'll send you what I ended up with.

The next step would be carrying over student info from previous problem parts, but for the moment I've settled on including a note in the middle problem parts to write down the solution for use in the next part.

Thanks,
Gavin

<| Post or View Comments |>


userArnold K. Pizer - Re: subsequent problems having same seed  blueArrow
6/20/2002; 6:36:44 AM (reads: 1299, responses: 0)
You can also suggest that they open a new window and then they can copy and paste between problems.

<| Post or View Comments |>


userMark Schmitt - Re: subsequent problems having same seed  blueArrow
6/20/2002; 8:11:44 AM (reads: 1314, responses: 0)
Arnie,

In response to your question above (re: Would others like linked problems), I would vote YES. One of the first questions I got from my department head when I showed him WeBWorK was whether you could make a string of problems connected. I would also love to see what Gavin suggested where you can use the student's own answers in later problems.

Mark

<| Post or View Comments |>


userArnold K. Pizer - Re: subsequent problems having same seed  blueArrow
6/25/2002; 4:09:39 AM (reads: 1320, responses: 0)
Hi,

We have added Gavin's code for generating "linked" problems and updated (on webhost.math.rochester.edu, not yet on webwork.math.rochester.edu) the description of set definition files.

These changes are now in the CVS repository and will be in the next distribution.

Arnie

<| Post or View Comments |>