SystemCallSolver
(class from pyomo.opt.solver.shellcmd
)
- class pyomo.opt.solver.shellcmd.SystemCallSolver(**kwargs)[source]
Bases:
OptSolver
A generic command line solver
Methods
__init__
(**kwargs)Constructor
available
([exception_flag])True if the solver is available
config_block
([init])create_command_line
(executable, problem_files)Create the command line that is executed.
default_variable_value
()Returns the executable used by this solver.
has_capability
(cap)Returns a boolean value representing whether a solver supports a specific feature.
True if the solver is present and has a valid license (if applicable)
Returns the current problem format.
Process the logfile for information about the optimization process.
process_output
(rc)Process the output files.
process_soln_file
(results)Process auxiliary data files generated by the optimizer (e.g. solution files).
reset
()Reset the state of the solver
Returns the current results format.
set_callback
(name[, callback_fn])Set the callback function for a named callback.
set_executable
([name, validate])Set the executable for this solver.
set_options
(istr)set_problem_format
(format)Set the current problem format (if it's valid) and update the results format to something valid for this problem format.
set_results_format
(format)Set the current results format (if it's valid for the current problem format).
solve
(*args, **kwds)Solve the problem
version
()Returns a 4-tuple describing the solver executable version.
True is the solver can accept a warm-start solution
Attributes
keepfiles
log_file
soln_file
suffixes
symbolic_solver_labels
tee
warm_start_file_name
warm_start_solve
Member Documentation
- has_capability(cap)
Returns a boolean value representing whether a solver supports a specific feature. Defaults to ‘False’ if the solver is unaware of an option. Expects a string.
Example: # prints True if solver supports sos1 constraints, and False otherwise print(solver.has_capability(‘sos1’)
# prints True is solver supports ‘feature’, and False otherwise print(solver.has_capability(‘feature’)
- license_is_valid()
True if the solver is present and has a valid license (if applicable)
- problem_format()
Returns the current problem format.
- process_soln_file(results)[source]
Process auxiliary data files generated by the optimizer (e.g. solution files)
- reset()
Reset the state of the solver
- results_format()
Returns the current results format.
- set_callback(name, callback_fn=None)
Set the callback function for a named callback.
A call-back function has the form:
- def fn(solver, model):
pass
where ‘solver’ is the native solver interface object and ‘model’ is a Pyomo model instance object.
- set_executable(name=None, validate=True)[source]
Set the executable for this solver.
The ‘name’ keyword can be assigned a relative, absolute, or base filename. If it is unset (None), the executable will be reset to the default value associated with the solver interface.
When ‘validate’ is True (default) extra checks take place that ensure an executable file with that name exists, and then ‘name’ is converted to an absolute path. On Windows platforms, a ‘.exe’ extension will be appended if necessary when validating ‘name’. If a file named ‘name’ does not appear to be a relative or absolute path, the search will be performed within the directories assigned to the PATH environment variable.
- set_problem_format(format)
Set the current problem format (if it’s valid) and update the results format to something valid for this problem format.
- set_results_format(format)
Set the current results format (if it’s valid for the current problem format).
- solve(*args, **kwds)
Solve the problem
- version()
Returns a 4-tuple describing the solver executable version.
- warm_start_capable()
True is the solver can accept a warm-start solution