Repository navigation
Pass code arguments to the DEoptim objective without running them - #73
Merged
Merged
Conversation
.DEoptimChunk() and .rescoreFn() built the objective's call with do.call() and no quote = TRUE, so a language argument (mpbRedTopSpread's quotedSpread) was run as code in the main process. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eliotmcintire
added a commit
to achubaty/mpbRedTopSpread
that referenced
this pull request
Dec 4, 2026
…the cluster workers" It treated a symptom: the quoted spread ran in the main process because clusters' do.call() lacked quote = TRUE (PredictiveEcology/clusters#73). On the workers it runs inside objFunInner, which sees the module's functions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## development #73 +/- ##
===============================================
+ Coverage 76.22% 76.23% +0.01%
===============================================
Files 24 24
Lines 2145 2146 +1
===============================================
+ Hits 1635 1636 +1
Misses 510 510 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The MPB spread fit hands its objective a piece of code to run later, inside the objective. The fitting loop ran that code too early, in the main R session, so the fit stopped before any worker started.
Affects: fits whose objective takes a quoted expression (mpbRedTopSpread) now run; other fits are unchanged.
Technical details
.DEoptimChunk()(R/DEoptim.R:67) callsdo.call(DEoptim::DEoptim, c(list(...), dotsList)), and.rescoreFn()(R/DEoptim.R:188) callsdo.call(fn, c(list(par), args)). Withoutquote = TRUE,do.call()puts a language object such asquotedSpread = quote({...})into the call as code. DEoptim then evaluated it whenparApply()forced its..., in the main process: "object 'massAttackRasStart' not found". Both calls now usequote = TRUE.New
test-DEoptimLanguageArgs.Rpasses a quotedstop()to an objective through each function. Both tests failed before the fix.test-DEoptimChunks,test-DEoptimRescoreandtest-DEoptimIterativepass.🤖 Generated with Claude Code