Optimization Experiment internal error (no model BUILD problems) - anylogic - anylogic

I built my model and got Zero problems.
The Simulation Experiment is running without any errors (I'm using test/random values for the parameters)
However, when I run the Optimization Experiment, I'm getting the following 500 errors:
I have 246 int parameters in the optimization experiments ( I know too much but did not return any problem while building the model, I used the same number before in a different problem, and it worked totally fine)
I have defined 1756 constraints ( I know too much, but still under the limit of 65535 bytes and did not return any problem while building the model )
I have used root to define my constraints as below (maybe this is causing errors? but did not return any problem while building the model):

The reason behind this 500 Error (internal error) is the type of the parameter and the step size defined in the optimization experiment panel (Parameters).
What I have found is as follows:
if you use the int type for a parameter, its step size must be 1
if you use the discrete type for a parameter, its step size can be any integer (for example 4)
Even one parameter is not allowed to break this role, otherwise AnyLogic will return the same error message : 500 Error

Related

AnyLogic executeExpression exception

I am using AnyLogic 8 Professional 8.8.1. In my model I sample a repair time for a component that failed from a distribution that is configurable through an input file. To achieve this I specify the distribution in the input file as a String and then in the model, call the executeExpression after each failure to get the downtime for the component.
I have done this for various classes (agent types) in my model and have combined all the logic in a superclass, which the various components merely extend this class.
So far it worked perfectly (except for the annoying 1.6 JVM message see this question) until I tried to add the functionality to another agent. I simply made this agent also extend the superclass, so it is the exact same code executing.
Executing Expression triangular(82.0,287.0,123.0)
Expression returned: 150.21341253179259
Tue Apr 01 21:23:10 CAT 2025: stockyardFeed1 has broken down
Updating status
Executing Expression triangular(82.0,287.0,123.0)
Annotation processing got disabled, since it requires a 1.6 compliant JVM
----------
1. ERROR in \nmet_terminal_model\Expression_9_xjal.java (at line 75)
public class Expression_9_xjal extends nmet_terminal_model.Schematic$17{
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The nested type nmet_terminal_model.Schematic$17 cannot be referenced using its binary name
----------
2. ERROR in \nmet_terminal_model\Expression_9_xjal.java (at line 78)
return triangular(82.0,287.0,123.0);
^^^^^^^^^^
The method triangular(double, double, double) is undefined for the type Expression_9_xjal.Performer
----------
2 problems (2 errors)
Exception during discrete event execution:
Truncated class file
To make it even more confusing is that I added a traceln writing the distribution to execute and its answer in the specific function and when making the distribution the same as another type of component in the input file you will notice that the first two lines in the console output works fine, but then when trying to run the exact same - it throws the error.

openbugs generating inital values error

I have a model that I can run in winbugs but I get an error in openbugs when loading and generating initial values even when using the same code and the same data.
When loading initial values in both winbugs and openbugs I get the message that the "chain contains uninitalized variables". Then I can successfully generate initial values in winbugs but in openbugs I get the error "error for node Ny[2] of type GraphBinoimial. Node second argument must be integer valued." My initial values for Ny are Ny=c(4,4,4,4,4,4,4,4). These seem like integers to me. Plus these same initial values are accepted in winbugs.
You may be asking yourself, if I can get it work in winbugs why do I care to get it to work in openbugs? I am most interested in running the whole process through R. I've been trying to do this with R2Winbugs or Brugs (openbugs) but I get errors on initialization with both of these and it even crashes R (I'd never seen the r-bomb before but now I can make it happen repeatedly). I think this is probably for the same reason that I can't run the data manually in openbugs.
Being able to run this through R would greatly reduce the frustration of interacting with win/openbugs especially when running a series of models with different data.
Thanks in advance for your insight.
lg

Cannot change the dimensions of run-time parameter in Model block

I have a Simulink model with a Model block I am using to avoid duplication of some functionality.
When I try and run the parent model, I get the following errors:
Cannot change the dimensions of run-time parameter 'Gain' in
'TranslationChannel/First-Order Filter1/Model/Continuous/A' from
[1x1] to [0x0] while model is executing
Invalid setting in
'TranslationChannel/Second-Order Filter/Model/Continuous/A*x/A11' for
parameter 'Gain'
Error evaluating parameter 'Gain' in
'TranslationChannel/Second-Order Filter/Model/Continuous/A*x/A11'
Reference to non-existent field 'A11'.
Invalid setting in
'TranslationChannel/Tilt/Model/Continuous/A*x/A11' for parameter
'Gain'
Error evaluating parameter 'Gain' in
'TranslationChannel/Tilt/Model/Continuous/A*x/A11'
Reference to
non-existent field 'A11'.
The sub-model is below:
The block the error refers to is First Order Fliter 1, the parameters are which are:
How do I resolve this error, or, is there a better way of calling the same series of blocks multiple times in a model?
The parent model is below:
EDIT:
After my discussion with Ander, I tried connecting a step source directly to the model block to eliminated any possibility of a null signal and got the same error, suggesting the problem is due to calling the second model. If anyone can assist further, that would be great.
EDIT 2: I have confirmed that data is being passed into the model. Removing the filters from the sub-model makes it work fine. The error occurs in the masked portion of the filters.
I have resolved this my using a library instead of a model, and putting the filter blocks into a subsystem inside the library that I then drag to my main model.
This allows me to tune the parameters once and have it change all the blocks at once.

What potential error can be caused by retrieving and changing of a value in the same line?

I was asked question about what would happen if I try to retrieve a reference value and then try to change it within the same line of code. My answer was that nothing will happen because as I tried to do this before I did not encounter any compiler errors (at least in C# or Java).
What is the real answer to this?
This is example with the pseudo code:
Module main()
Call changeNumber(10)
End Module
Module changeNumber(Integer Ref number)
Set number = number * number
Display number
End Module
(PS. Sorry for not formatting/creting this post correctly. I'm having bit of an issue here.)
There would be no unusual side effects, if that's what you're asking. The language specifications dictate a specific order of execution (number * number is evaluated, then set to number), which prevents any issues from occurring.
Nothing would happen, in your particular pseudo code.
In reference to a question you asked after this question -
Actually there could be issues in some rare instance, but it would depend on how you are allocating space for the number and your coding language. Consider this. you are explicitly naming the data type as an int, well what if the accepted input is a larger number than an int can handle (or a negative number), that ends up being x integers long and then you multiply it by that same number, your allocated space (which usually has padding with integer) could also have insufficient space that is too small for this particular instance, which would cause a segmentation fault in C. depending on which language you're using, whether it's higher level than C, it may have compilation checks for this case, but not always.

How can I use 5x5filter (Xilinx block), it keeps telling me there is an error in the counter?

I'm trying to apply edge filter to an image using Xilinx blocks,
I used 5x5 buffer then I connected the 5x5filter to it.
But it keeps telling me:
Illegal Period, This blocks attempts to set period that is a non-integer multiple of the system rate
Error occurred during "Block Configuration".'
which I did not understand.
Similar such problem(with solution) is posted in Xilinx Forum. Go through the link given below:
http://forums.xilinx.com/t5/DSP-Tools/Can-any-1-help-me-regarding-FIR-implementation-in-system/m-p/33650#M1463
It means that the sample time of one of the block isn't an integer multiple of the model's minor timestep. Check the configuration parameters for the model and the parameters of your new blocks.
I don't think this has anything to do with the Xilinx blocks specifically.