[OS] COIN-OS command line arguments

Mike Steglich mike.steglich at berlin.de
Wed Feb 8 12:44:49 EST 2012


Hi,

I would like to propose some changes in OSSolverService.cpp to solve the issues I have posted on Monday. 
In my mind it is not necessary to change OSParseosss.l because the regular expression optionValue ([-a-zA-Z./~:_0-9$\?+\\!@#&*()]+|\"[^"\n]*\") allows to use double quotes for an option. 

If one defines an OSiL file name embedded in double quotes in a config file diet.conf:
	-osil "folder 1/diet.osil"
and executes OSSOlverService with -config diet.conf  then 
the variable osoptions->osilFile is assigned "folder 1/diet.osil"  (including the double quotes).  This is the problem; OSSolverService can't find the file "folder 1/diet.osil". The only thing that is to do is to clean up the double quotes. 

Therefore I have created a patch of OSSolverService.cpp.  (All changes are marked by a comment //stegger) 
I have created two function to clean up the double quotes for the relevant options: 
void cleanDoubleQuotes(string &str);
void cleanOptions();

This works for all (relevant) arguments that are defined in a config file.

A different problem is a "normal" command line argument. If one defines  -osil "folder 1/diet.osil"  then an argV[i] is assigned folder 1/diet.osil (w/o double quotes). The problem is that in OSSolverService.cpp  all command line arguments are concatenated in one string ( strcat(osss, argV[i]); ) and separated by blanks ( strcat(osss, space);  ). The parser interprets white spaces as separators for the options. Therefore folder 1/diet.osil is interpreted as two different elements and causes an error. A possible workaround in OSSolverService.cpp could be to enclose the file names in double quotes, to execute ossslex and after that to clean up the  double quotes for the relevant options as described above. 

If you are interested then you can download my patch for OSSolverService.cpp. 
www.coliop.org/download/OSSolverService.cpp

I didn't test it for all possible variants. It works with all relevant options in combination with CMPL.  
I hope all of this makes sense. Please take it as a proposal. If you don't like this simple approach then please ignore it.

Cheers 


Mike

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/os/attachments/20120208/7a29159a/attachment.html>


More information about the OS mailing list