Closed ChristianMalan closed 3 years ago
Glad to hear it was helpful! Regarding your current question - fortunately, there's no problem at all :)
What you're seeing is that Java arrays don't override toString
function. When this happens - to any Java class - what gets printed out follows the format: class_identifier
+ @ + hash_code_hex
(open this demo model for an example).
In the case of primitive arrays, the class identifier is a bracket for each depth and a single letter representing the data type.
If you want to print out your array to the console, you can use Arrays.toString(route_order[0])
or Arrays.deepToString(route_order)
- the Arrays
class is built-in, so you don't need to import anything.
Otherwise, your array is still intact! So if you did traceln(10 * route_order[0][0]);
it would correctly output -10
(10 * -1)
@ChristianMalan , I'm closing this for now, but if you have any more questions about this, feel free to ask
Hi,
Thank you for the quick feedback last time, it really helped a lot.
I am once again stuck.
I'm looking to convert the output from my python script
run_vehicle_routing_sweep
into an array of type int[][] in AnyLogic. In this case, the output from the python script is:I try to convert it into something useable in AnyLogic with the following code:
This results in the output:
Do you have any suggestions?
I also tried to use a dictionary approach, but that gives additional errors (relating to java expecting double quotes, rather than the single quotes from the python dictionary).
I don't know if my approach is off, or if it is a bug. Either way, I would really appreciate some help.