Is there a way to forbid using the "\" command in MATLAB Grader submissions?
조회 수: 4 (최근 30일)
이전 댓글 표시
When using MATLAB Grader to automatically evaluate submitted functions, I'd like to forbid my students using Matlab's built-in linear system solver (command "\", among other). To achieve this, I tried the assessment test:
assessFunctionAbsence({'\','mldivide'},'FileName','yoursolver.m');
where yoursolver.m is the submitted function. While the use of mldivide(A,b) is correctly identified, the use of "\" (its shorthand equivalent) is not, yoursolver.m containing "\" command passes this test. Any ideas how to identify the use of "\" and forbid its use? Thanks!
댓글 수: 5
Jan
2019년 8월 21일
@Ales Janka: What a pity. Bruno's comment shows, that even excluding \ will not solve the problem.
Does the function inmem work in the grader to check, if the mldivide function has been used?
John D'Errico
2019년 8월 21일
편집: John D'Errico
2019년 8월 21일
I'd agree with Jan and Bruno. Overloading the mldivide function, first ensuring that your version is on top of the search path will work. You would also need to overload mrdivide too though. Just create new functions on top of the search path that cause an error return when used. So what if a warning arises?
Can the students get around such a kludge? Yes, probably. I could probably come up with multiple hacks. And, worse, if I wanted to do so, there are lots of ways to solve a backslash problem that do not use backslash. Lets see...
lsqr, lscov, regress, inv, pinv, lsqlin, ...
You don't say if the problem is square or not, but all of those functions will work in any case.
The point is, if you want to stop an enterprising student who knows what they are doing and who wants to subvert the system, you won't do so easily if you want it to be a totally automatic solution.
I suppose you could also computationally parse through the code, searching for calls to the possible outlawed solutions. Or you could check to see if ANY of the possible alternatives were woken up. I might need to extend my list above.
Instead, simple inspection seems a good idea. Just glance through the code. Or even better, tell the students they are not allowed to use specific codes to solve the problem. Then check a few random solutions by eye.
Trust works, especially if some inspection is applied to validate that students were worthy of your trust. I'd bet that you even should know which students need to have their work checked. If you have no idea which students cannot be trusted, then it might be you need to know your students better.
채택된 답변
추가 답변 (0개)
커뮤니티
더 많은 답변 보기: 원격 교육 커뮤니티
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!