MOSEKDirect
(class from pyomo.solvers.plugins.solvers.mosek_direct
)
- class pyomo.solvers.plugins.solvers.mosek_direct.MOSEKDirect(**kwds)[source]
Bases:
DirectSolver
A class to provide a direct interface between pyomo and MOSEK’s Optimizer API. Direct python bindings eliminate any need for file IO.
Methods
__init__
(**kwds)Constructor
available
([exception_flag])True if the solver is available.
config_block
([init])default_variable_value
()has_capability
(cap)Returns a boolean value representing whether a solver supports a specific feature.
Runs a check for a valid MOSEK license.
load_duals
([cons_to_load])Load the duals into the 'dual' suffix.
load_rc
(vars_to_load)Load the reduced costs into the 'rc' suffix.
load_slacks
([cons_to_load])Load the values of the slack variables into the 'slack' suffix.
load_vars
([vars_to_load])Load the values from the solver's variables into the corresponding pyomo variables.
Returns the current problem format.
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_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
A results object return from the solve method.
Member Documentation
- available(exception_flag=True)
True if the solver is available.
- 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()[source]
Runs a check for a valid MOSEK license. Returns False if MOSEK fails to run on a trivial test case.
- load_duals(cons_to_load=None)[source]
Load the duals into the ‘dual’ suffix. The ‘dual’ suffix must live on the parent model.
- Parameters:
cons_to_load (list of Constraint)
- load_rc(vars_to_load)[source]
Load the reduced costs into the ‘rc’ suffix. The ‘rc’ suffix must live on the parent model.
- load_slacks(cons_to_load=None)[source]
Load the values of the slack variables into the ‘slack’ suffix. The ‘slack’ suffix must live on the parent model.
- Parameters:
cons_to_load (list of Constraint)
- load_vars(vars_to_load=None)
Load the values from the solver’s variables into the corresponding pyomo variables.
- problem_format()
Returns the current problem format.
- 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_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.
- results
A results object return from the solve method.