NetLogo error in BehaviorSearch optimization: error caused by: java.lang.NullPointerException - netlogo

I developed a NetLogo model with the following setup
And I'm trying to run BehaviorSearch optimization like this:
The final measure is the average euclidean distance of the network:
sqrt ( ( centroid-x - max ( [xcor] of turtles )) ^ 2 + ( centroid-y - max ( [ycor] of turtles )) ^ 2 )
The code uses the following extensions [ py nw arduino csv matrix ]
But I get the error
Unexpected exception caused by java.lang.NullPointerException
Looks like something was not defined, But I can't find it.
Any ideas what can be wrong ?
I'm using Ubuntu 20.04, Java 1.8 properly configured, I updated to 1.11. However, when I click Load parameter ranges from model interface, nothing happens.

Issue solved here:
In the app/ folder of your NetLogo install, find and open the Behaviorsearch.cfg file in a text editor. In the [JVMOptions] section add a line with -Dorg.nlogo.preferHeadless=true.

Related

unable to get the distance informations using GROMACS commands (Tutorial file), what should i do now?

I was following the Gromacs MD Simulation tutorial, but an error occured in the 1st command during "Analyzing Protein-Ligand Interactions and Ligand Dynamics".
I can't edit the mentioned files, as these are binary files.
Please suggest something to resolve this issue.
I tried to resolve the error to get the distance information.
This is the command I used :
gmx distance -s md_0_10.tpr -f md_0_10_center.xtc -select 'resname "JZ4" and name OAB plus resid 102 and name OE1' -oall
Error cccurred:
[Program: gmx distance, version 2021.4-Ubuntu-2021.4-2
Source file: src/gromacs/trajectoryanalysis/modules/distance.cpp (line 218)
Function: void gmx::analysismodules::{anonymous}::checkSelections(const SelectionList&)
Inconsistency in user input:
Selection 'resname "JZ4" and name OAB plus resid 102 and name OE1' does not
evaluate into an even number of positions (there are 1 positions)
]
Screenshot of the problem

Can't find extension NetLogo

I have a program which uses a NetLogo Headless Workspace.
The program work fine, but when I add and the code extensions [sound]
The program raises the error mentioned below. It seems a problem of directories but I am unable to find the bug.
Any help will be highly apppreciated.
C:\Users\cmartise\Desktop\ecj>java -cp "C:\Users\cmartise\Documents\NetBeansProj
ects\prueba\build\classes\;C:\Program Files\NetLogo 6.0\app\*" prueba.Prueba
main
C:\Users\cmartise\Desktop\ecj\ec\app\model0
Can't find extension: sound at position 12 in
at org.nlogo.core.ErrorSource.signalError(ErrorSource.scala:11)
at org.nlogo.workspace.ExtensionManager.importExtension(ExtensionManager
.scala:186)
at org.nlogo.parse.StructureParser$.$anonfun$parsingWithExtensions$1(Str
uctureParser.scala:71)
at org.nlogo.parse.StructureParser$.$anonfun$parsingWithExtensions$1$ada
pted(StructureParser.scala:69)
at scala.collection.immutable.List.foreach(List.scala:378)
at org.nlogo.parse.StructureParser$.parsingWithExtensions(StructureParse
r.scala:69)
at org.nlogo.parse.StructureParser$.parseSources(StructureParser.scala:3
5)
at org.nlogo.parse.NetLogoParser.basicParse(NetLogoParser.scala:17)
at org.nlogo.parse.NetLogoParser.basicParse$(NetLogoParser.scala:15)
at org.nlogo.parse.FrontEnd$.basicParse(FrontEnd.scala:10)
at org.nlogo.parse.FrontEndMain.frontEnd(FrontEnd.scala:27)
at org.nlogo.parse.FrontEndMain.frontEnd$(FrontEnd.scala:25)
at org.nlogo.parse.FrontEnd$.frontEnd(FrontEnd.scala:10)
at org.nlogo.compile.CompilerMain$.compile(CompilerMain.scala:38)
at org.nlogo.compile.Compiler.compileProgram(Compiler.scala:52)
at org.nlogo.headless.HeadlessModelOpener.openFromModel(HeadlessModelOpe
ner.scala:54)
at org.nlogo.headless.HeadlessWorkspace.openModel(HeadlessWorkspace.scal
a:530)
at org.nlogo.headless.HeadlessWorkspace.open(HeadlessWorkspace.scala:497
)
at prueba.Prueba$1.run(Prueba.java:36)

Matlab Distributed Server parfor can't find mex opencv files

everyone!
I'm trying to parallelize an algorithm that uses mex files from mexopencv (KNearest.m, KNearest_.mexw32).
The program is based vlfeat (vlsift.mex32) + mexopencv (KNearest.m and KNearest_.mexw32).I classify descriptors obtained from images.
All the code is located on the fileshare
\\ LAB-07 \ untitled \ DISTRIB \ (this is the program code)
\\ LAB-07 \ untitled \ + cv (mexopencv)
When I run the program with matlabpool close everything works well.
Then I make matlabpool open (2 computers on 2 cores each. ultimately 4 worker, but now I use for testing only 2 workers on the computer and run the program which)
PathDependencises from fileshare -> \LAB-07\untitled\DISTRIB\ , \LAB-07\untitled+cv
Before parfor loop I train classifier on the local machine
classifiers = cv.KNearest
classifiers.train(Descriptors',Labels','MaxK',1)
Then run parfor
descr=vlsift(img);
PredictClasses = classifiers.predict(descr');
Error
Error in ==> KNearest>KNearest.find_nearest at 173
Invalid MEX-file '\\LAB-07\untitled\+cv\private\KNearest_.mexw32':
The specified module could not be found.
That is KNearest.m finds, but no KNearest_.mexw32. Because KNearest_.mexw32 located in private folder, I changed the code KNearest.m (everywhere where it appeal KNearest_ () changed to cv.KNearest_ (). Example: this.id = сv.KNearest_ ()) and placed in a folder with KNearest_.mexw32 KNearest.m. As a result, get the same error
Immediately after matlabpool open file search on workers
pctRunOnAll which ('KNearest.m')
'KNearest.m' not found.
'KNearest.m' not found.
'KNearest.m' not found.
pctRunOnAll which ('KNearest_.mexw32')
'KNearest_.mexw32' not found.
'KNearest_.mexw32' not found.
'KNearest_.mexw32' not found.
after cd \LAB-07\untitled+cv
pctRunOnAll which ('KNearest.m')
\\LAB-07\untitled\+cv\KNearest.m
\\LAB-07\untitled\+cv\KNearest.m % cv.KNearest constructor
\\LAB-07\untitled\+cv\KNearest.m
>> pctRunOnAll which ('KNearest_.mexw32')
\\LAB-07\untitled\+cv\KNearest_.mexw32
\\LAB-07\untitled\+cv\KNearest_.mexw32
\\LAB-07\untitled\+cv\KNearest_.mexw32
I ran and FileDependecies, but the same result.
I do not know this is related or not, I display during the execution of the program classifiers
after training and before parfor
classifiers =
cv.KNearest handle
Package: cv
Properties:
id: 5
MaxK: 1
VarCount: 128
SampleCount: 9162
IsRegression: 0
Methods, Events, Superclasses
Within parfor before classifiers.predict
classifiers =
cv.KNearest handle
Package: cv
Properties:
id: 5
I tested the file cvtColor.mexw32. I left in a folder only 2 files cvtColor.mexw32 and vl_sift
parfor i=1:2
im1=imread('Copy_of_start40.png');
im_vl = im2single(rgb2gray(im1));
desc=vl_sift(im_vl);
im1 = cvtColor(im1,'RGB2GRAY');
end
The same error, and vl_sift work, cvtColor no...
If the worker machines can see the code in your shared filesystem, you should not need FileDependencies or PathDependencies at all. It looks like you're using Windows. It seems to me that the most likely problem is file permissions. MDCS workers running under a jobmanager on Windows by default run not using your own account (they run using the "LocalSystem" account I think), and so may well simply not have access to files on a shared filesystem. You could try making sure your code is world-readable.
Otherwise, you can add the files to the pool by using something like
matlabpool('addfiledependencies', {'\\LAB-07\untitled\+cv'})
Note that MATLAB interprets directories with a + in as defining "packages", not sure if this is intentional in your case.
EDIT
Ah, re-reading your original post, and your comments below - I suspect the problem is that the workers cannot see the libraries on which your MEX file depends. (That's what the "Invalid MEX-file" message is indicating). You could use http://www.dependencywalker.com/ to work out what are the dependencies of your MEX file, and make sure they're available on the workers (I think they need to be on %PATH%, or in the current directory).
Edric thanks. There was a problem in the PATH for parfor. With http://www.dependencywalker.com/ looked missing files and put them in a folder +cv. Only this method works in parfor.
But predict in parfor gives an error
PredictClasses = classifiers.predict(descr');
??? Error using ==> parallel_function at 598
Error in ==> KNearest>KNearest.find_nearest at 173
Unexpected Standard exception from MEX file.
What() is:..\..\..\src\opencv\modules\ml\src\knearest.cpp:365: error: (-2) The search
tree must be constructed first using train method
I solved this problem by calling each time within parfor train
classifiers = cv.KNearest
classifiers.train(Descriptors',Labels','MaxK',1)
But it's an ugly solution :)

Compiling Multiple Files with modules

I am programming in Fortran 90 using GFortran and I'm having troubles with Modules. When I compile the code below, I get the following error:
Derivatives.f90:7.16:
Included at C:\Users\dchalhub\Dropbox\Doutorado\#Tese\New folder\main.f90:1:
Use Mesh
1
Fatal Error: Can't open module file 'mesh.mod' for reading at (1): No such file or directory
gfortran.exe: Internal error: Aborted (program f951)
Please submit a full bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
So, the 'mesh.mod' file is not created.
But when I remove the first two lines: 'include 'Derivatives.f90'' and 'include 'Poisson.f90'' the module is created without any problems.
After the mod file is created, I put back the first two lines, compile the code again and it works perfectly.
include 'Derivatives.f90'
include 'Poisson.f90'
!**************************************************************
MODULE MESH
IMPLICIT NONE
INTEGER :: IMAX,JMAX,NMAX
REAL(8), ALLOCATABLE :: XD(:),YD(:),FX(:,:),FY(:,:)
REAL(8) :: PI,E,DX,DY,H,L,RHO,MU
PARAMETER (PI = ACOS(-1.D0))
PARAMETER (E = 2.71828182845904523536028747135266249775724709369995)
END MODULE MESH
!**************************************************************
!**************************************************************
!*********** Lid-driven Cavity Program*************************
!**************************************************************
program Cavity
Use Mesh
implicit none
End program Cavity
I don't know why but there is something wrong with compiling multiple files with modules.
Does any one know what should I do to make it work properly?

Tesseract problem with mftraining stage

I've successfully created a box file with tesseract
now after running the unicharset_extractor
having it creating the unicharset file that looks like:
...
n 3 NULL -1
s 3 NULL 23
t 3 NULL 43
...
I've continued with this command
mftraining -U unicharset -O testlang.unicharset testlang.tr
only to get the next error
Reading testlang.tr ...
testlang has no defined properties.
Error: Illegal short name for a feature!
I've never worked with Tesseract, but it seems there is an open issue in the bug database that looks a lot like your problem : http://code.google.com/p/tesseract-ocr/issues/detail?id=385
It seems that it is related to scientific notation not being correctly supported by some functions.
On the issue page a user suggests a solution, and another one proposes a patch. You could try applying the patch to see if it helps.