CUTEst.jl icon indicating copy to clipboard operation
CUTEst.jl copied to clipboard

CUTEstModel - Path with blank spaces

Open leonardosecchin opened this issue 3 years ago • 5 comments

Hi, I am using Julia 1.5.3. The routine "CUTEstModel" apparently does not handle paths containing blank spaces when reading a SIF file. Sincerely, Leonardo.

leonardosecchin avatar Mar 19 '21 20:03 leonardosecchin

Hi @leonardosecchin, thanks for the issue. I have a few clarification questions:

You're trying CUTEstModel("PATH TO FILE")? Can you post an example and the output? Is it a separate .SIF file that you have, or one of the shipped ones?

abelsiqueira avatar Mar 19 '21 20:03 abelsiqueira

Hi, I executed "nlp = CUTEstModel(sifdir[i]);", where "sifdir[i]" is a string provided by "readdir" command. Here is the output. I printed the complete path to the sif file (it exists!) from Julia. I notice that no "basename" command is executed...

This is the complete path to SIF file: /home/leonardo/Dropbox/UFES/Otimizacao 2/julia/sif/AKIVA.SIF

basename: operando extra “.SIF” Tente "basename --help" para mais informações. ERROR: ArgumentError: NULL library handle Stacktrace: [1] #dlsym#1 at /home/leonardo/julia/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:54 [inlined] [2] dlsym(::Ptr{Nothing}, ::Symbol) at /home/leonardo/julia/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:54 [3] (::CUTEst.var"#24#25"{Bool,Bool,Tuple{},String,String,Array{Int32,1}})() at /home/leonardo/.julia/packages/CUTEst/wFmxq/src/CUTEst.jl:215 [4] cd(::CUTEst.var"#24#25"{Bool,Bool,Tuple{},String,String,Array{Int32,1}}, ::String) at ./file.jl:104 [5] CUTEstModel(::String; decode::Bool, verbose::Bool, efirst::Bool, lfirst::Bool, lvfirst::Bool) at /home/leonardo/.julia/packages/CUTEst/wFmxq/src/CUTEst.jl:205 [6] CUTEstModel at /home/leonardo/.julia/packages/CUTEst/wFmxq/src/CUTEst.jl:193 [inlined] [7] testesSIF(; sifpath::String) at /home/leonardo/Dropbox/UFES/Otimizacao 2/julia/testesSIF.jl:55 [8] testesSIF() at /home/leonardo/Dropbox/UFES/Otimizacao 2/julia/testesSIF.jl:27 [9] top-level scope at REPL[4]:1

leonardosecchin avatar Mar 19 '21 20:03 leonardosecchin

Makes sense, I'll have to take a look to see whether it's inside CUTEst.jl or just CUTEst. In the meantime, can you use the SIF problems downloaded automatically by CUTEst.jl? nlp = CUTEstModel("AKIVA") for instance, should work.

abelsiqueira avatar Mar 19 '21 20:03 abelsiqueira

If the environment variable MASTSIF has no blank spaces, CUTEstModel works. Otherwise, an error "xxxx.SIF not found" occurs. I believe that this does not depend on whether we use the path of the problems automatically download by CUTEst.jl (where there are probably no blank spaces) or a particular path.

leonardosecchin avatar Mar 19 '21 21:03 leonardosecchin

Hello again. I've tried to run CUTEst directly and it fails too, so it's not an issue with the Julia wrapper, but with the sifdecoder code.

Example:

sifdecoder "Some dir/AKIVA.SIF" 
basename: extra operand ‘.SIF’
Try 'basename --help' for more information.

 ERROR: file .SIF is not known in directories
 .
dir or $MASTSIF

I went into the sifdecoder script and changed

-251   PROBNAME=`basename $PROBLEM .SIF`
+251   PROBNAME=`basename "$PROBLEM" .SIF`
-252   PROBDIR=`dirname $PROBLEM`
+252   PROBDIR=`dirname "$PROBLEM"`

-400   $LN -s $PROBDIR/${PROBNAME}.SIF ./$TEMPNAME.SIF
+400   $LN -s "$PROBDIR/${PROBNAME}.SIF" ./$TEMPNAME.SIF

and apparently, it works. I just don't know a good way to test it. @dpo, do you?

abelsiqueira avatar Mar 20 '21 18:03 abelsiqueira

Fixed with the release v0.13.3. The decoder is now a binary and not anymore a shell script. We have a new dependency for it (SIFDecode_jll.jl).

amontoison avatar Aug 19 '24 04:08 amontoison