B _=@sVdZddlZddlZddlZddlZddlZddlm Z e dZ Gddde Z dS))SPSolverShellCommandN)SPSolverz pyomo.pyspcsjeZdZfddZddZddZddZed d Zed d Z dddZ ddZ fddZ Z S)rcs"tt|j||d|_i|_dS)N)superr__init__ _executable_files)selfargskwds) __class__K/tmp/pip-unpacked-wheel-d4p3hk07/pyomo/pysp/solvers/spsolvershellcommand.pyrszSPSolverShellCommand.__init__cOstjjj||}||j|<|S)N)pyutilibservicesTempfileManagerZcreate_tempdirr)rlabelr r dirnamer r r _create_tempdirs z$SPSolverShellCommand._create_tempdircOstjjj||}||j|<|S)N)rrrZcreate_tempfiler)rrr r filenamer r r _create_tempfile$s z%SPSolverShellCommand._create_tempfilecCs tjjj|dd||j|<dS)NF)exists)rrrZ add_tempfiler)rrrr r r _add_tempfile*sz"SPSolverShellCommand._add_tempfilecCs|jS)z#The executable used by this solver.)r)rr r r executable0szSPSolverShellCommand.executablecCs|jS)zA dictionary maintaining the location of various solvers files generated during the most recent solve. All files will be removed before a solve completes unless the keep_solver_files keyword was set to True.)r)rr r r files5szSPSolverShellCommand.filesTcCsL|s ||_ns z#SPSolverShellCommand.set_executablecCsD|j}z0y|j|ddWntk r.dSXdSWd||_XdS)ziReturns whether this solver is available by checking if the currently assigned executable exists.T)r FN)rr"r)rr!r r r availablegszSPSolverShellCommand.availablec s||j|jdk st|dd}tjjzt t |j |f||Stjjj| d|rvt dt|jXdS)a^ Solve a stochastic program. See the 'solve' method on the base class for additional keyword documentation. Args: sp: The stochastic program to solve. keep_solver_files (bool): Retain temporary solver input and output files after the solve completes. *args: Passed to the derived solver class (see the _solve_impl method). **kwds: Passed to the derived solver class (see the _solve_impl method). Returns: A results object with information about the solution. Nkeep_solver_filesF)removez&Retaining the following solver files: )rclearrAssertionErrorpoprrrpushrrsolveloggerinfopprintpformatr)rspr r r$)r r r r*ts    zSPSolverShellCommand.solve)T)__name__ __module__ __qualname__rrrrpropertyrrr"r#r* __classcell__r r )r r rs   ) r) __all__osloggingr-Z pyutilib.miscrZ pyomo.commonrZpyomo.pysp.solvers.spsolverr getLoggerr+rr r r r  s