[Cbc] Pass model and/or data to the executable via standard input

Pietro Scionti pietro.scionti at archinet.it
Wed Apr 17 04:15:25 EDT 2013


John,
"import" was exactly the command I was toying around, but no variation of it seems to work.

I find "type" to be the windows equivalent of "cat", so I can list file contents on the standard output, and the pipe "|" seems to work identically on windows ("Reads the output from one command and writes it to the input of another command").
Indeed "type model.mod | glpsol -m /dev/stdin" works for GLPK; obviously this is not how I would use it since the whole point is to avoid the phsysical file, but what you write (ie the part from the pipe onwards :) ) replicates my need exactly.

You say you committed such a fix in the trunk; does this mean I only have to wait till the next release, then I can call my System.Diagnostics.Process with "cbc import stdin_lp solve solution output.out" and my lp model as an input stream?



Ted,
If i try to call "type model.lp | cbc -import -", this is the output i get:

command line - cbc -import - (default strategy 1)
Current default (if $ as parameter) for import is
Switching to line mode
Coin:No match for \* - ? for list of commands
No match for Problem: - ? for list of commands
No match for model - ? for list of commands
No match for *\ - ? for list of commands
Coin:Coin:Coin:No match for a: - ? for list of commands
No match for + - ? for list of commands
No match for x - ? for list of commands
Coin:Coin:No match for Subject - ? for list of commands
No match for To - ? for list of commands
Coin:No match for c: - ? for list of commands
No match for + - ? for list of commands
No match for x - ? for list of commands
No match for > - ? for list of commands
No match for -0 - ? for list of commands
Coin:Coin:No match for Bounds - ? for list of commands
Coin:No match for x - ? for list of commands
No match for free - ? for list of commands
Coin:Coin:Total time (CPU seconds):       0.07   (Wallclock seconds):       0.07

so it is trying to match every word in the file (!) to a cbc command.

If I try to call "type model.lp | cbc -import stdin", it says "Unable to open file .\stdin", so it's treating it a regular filename.

As for building GMPL into CBC, you correctly pointed out the licensing issues I want to avoid, but if/when you're able to replicate it under current compilers, it would be great, at least for future reference.


Thank you all very much,
Pietro



>Pietro,
>
>If you can do something like this (in linux) would that work?
>
>cat test.lp |bin/cbc -import stdin_lp -solve
>Welcome to the CBC MILP Solver
>
>command line - bin/cbc -import stdin_lp -solve (default strategy 1)
>Continuous objective value is 3.23684 - 0.00 seconds
>Cgl0004I processed model has 1 rows, 3 columns (0 integer) and 3 elements
>Cbc3007W No integer variables - nothing to do
>
>I have committed fixes to trunk - key thing is to import from stdin_lp
>(exact spelling needed)
>
>Does anyone know how to get GMPL working on Windows?
>
>John Forrest


________________________________

Archimede S.r.l.
Sede Legale:
Via Manzoni, 82
Ponte S. Giovanni

P.IVA: 01992020543

Tel. 075 515 22 11
Fax. 075 515 22 99
www.archinet.it

**********************************************************************************************************************************************************************************************************************
La presente comunicazione, con le informazioni in essa contenute e ogni documento o file allegato, e' rivolta unicamente alla/e persona/e cui e' indirizzata ed alle altre da questa autorizzata/e a riceverla. Se non siete i destinatari/autorizzati siete avvisati che qualsiasi azione, copia, comunicazione, divulgazione o simili basate sul contenuto di tali informazioni e' vietata e potrebbe essere contro la legge (art. 616 C.P., D.Lgs n. 196/2003 Codice in materia di protezione dei dati personali). Se avete ricevuto questa comunicazione per errore, vi preghiamo di darne immediata notizia al mittente e di distruggere il messaggio originale e ogni file allegato senza farne copia alcuna o riprodurne in alcun modo il contenuto.

This e-mail and its attachments are intended for the addressee(s) only and are confidential and/or may contain legally privileged information. If you have received this message by mistake or are not one of the addressees above, you may take no action based on it, and you may not copy or show it to anyone; please reply to this e-mail and point out the error which has occurred.
**********************************************************************************************************************************************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20130417/6dd2e0fb/attachment.html>


More information about the Cbc mailing list