[Edited 20:02 for concision]

Problem statement: NArgMin correctly obeys constraints when evaluating locally (on $Version = "11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)"), but when the cloud deployed version of the function does not correctly obey the constraints and returns different results.

Minimal broken example:

test2[input_String] := Module[
  {x = ToExpression[input],
   m = {{0.75`, 0, 0}, {0.38`, 5.84`, 0}, {1, 1, 1}},
   v1, v2, v3},
    Norm[m.{v1, v2, v3} - Append[x, 1] ],
    Element[{v1, v2, v3}, Cuboid[{0, 0, 0}, {1, 1, 1}]],
    AccuracyGoal -> 0.0001,
    PrecisionGoal -> 0.0001]
   // ToString

example = "{0.0919614, 0.0926934}"
test2[example] (*correctly returns "{0.122615, 0.00789377, 0.869491}"*)

In contrast, when deployed to cloud, a different result is returned which violates the positivity constrain on the arguments.

api = APIFunction[{"input" -> String}, test2[#input] &]
deployedFunction2 = CloudDeploy[ api, Permissions -> "Public"]

URLExecute[deployedFunction2, {"input" -> example}] (*incorrectly returns "{0.405362, -0.00654954, 0.593471}", which violates the region constraint in NArgMin*)

Conclusion: I'm puzzled why the cloud version of the NArgMin call returns the wrong result, and does not correctly obey the provided constraints, whereas the local version works OK. What am I missing here?

  • $\begingroup$ (I reduced this down to an even smaller example) $\endgroup$ – Joshua Schrier Jun 6 '19 at 1:05

The basic issue is that you're misinterpreting the meaning of the AccuracyGoal and PrecisionGoal. For example:

WolframLanguageData["AccuracyGoal", "PlaintextUsage"]

"AccuracyGoal is an option for various numerical operations which specifies how many effective digits of accuracy should be sought in the final result."

So, using AccuracyGoal->.0001 means that you'll accept an answer with basically 0 digits of accuracy, or in other words, basically any answer is fine.

As for the difference between M11.3 and the cloud, the cloud uses M12, and there's been a change in behavior for this edge case.

  • $\begingroup$ Aha! AccuracyGoal and PrecisionGoal set number of digits, not values. Confirmed that this works correctly. Thanks for your help. $\endgroup$ – Joshua Schrier Jun 6 '19 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.