# Cloud deployed NArgMin does not obey constraints (but local evaluation does)

[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},
NArgMin[
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?

• (I reduced this down to an even smaller example) – Joshua Schrier Jun 6 at 1:05

The basic issue is that you're misinterpreting the meaning of the AccuracyGoal and PrecisionGoal. For example:
WolframLanguageData["AccuracyGoal", "PlaintextUsage"]

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.
• Aha! AccuracyGoal and PrecisionGoal` set number of digits, not values. Confirmed that this works correctly. Thanks for your help. – Joshua Schrier Jun 6 at 18:02