Error Messages/42539
Error message examples
In the call to DefineOptimization, 4 values are being passed to the «guess» parameter where at most 2 are expected (since 2 values are specified for the «decisions» parameter) In the call to DefineOptimization, 3 values are being passed to the «domain» parameter where one is expected (since one value is specified for the «decisions» parameter)
Cause
You have listed too many values in the «guess» or «domain» parameter of DefineOptimization. These parameters are in positional correspondence with the parameters passed to the «decisions» parameter, and so it doesn't make sense for there to be more values passed to the «guess» parameter than there are parameters passed to the «decisions» parameter.
The following example results in this error:
DefineOptimization( decisions: Units_to_make, Labor_alloc, guess: 1, 2, 3, 4, constraints: Avail_labor, Meet_req_effort, maximize: Net_Profit)
In this definition, 1 is the guess for Units_to_make
, 2 is the guess for Labor_alloc
, but 3 and 4 are just extra and are the cause of this error.
The following would also cause this error, even when there are two decision variables in the optimization:
DefineOptimization( decisions: All, domain: Continuous(), Integer(), constraints: All, maximize: Net_Profit)
Here you might think that the Continuous() domain specification applies to the first decision in the model and Integer() applies to the second decision in the model -- but this is not how it works, and how would you know which is the first and which is the second decision anyway? What actually happens is that the first guess, Continuous(), applies to the first decision parameter listed, which in this case is All
. Hence, Continuous() applies to all decision variables, and the second domain parameter, Integer(), is an extra, hence the error.
Remedy
Remove the extra parameters from your «guess» or «domain» parameter to DefineOptimization.
We generally specify the guess and domain in the Initial Value and Domain attributes of the decision nodes themselves. These parameters to DefineOptimization are utilized when you want to override those attribute settings for a particular optimization. Thus, if you aren't using these parameters to over ride the attribute settings, just remove them entirely and set them in the decision variables' object windows.
Enable comment auto-refresher