Loading picos/modeling/options.py +4 −0 Original line number Diff line number Diff line Loading @@ -443,6 +443,10 @@ OPTIONS = [ This option affects both MOSEK (Optimizer) and MOSEK (Fusion). """, None), ("mosek_basic_sol", bool, False, """ Return a basic solution when solving LPs with MOSEK (Optimizer). """), ("mskfsn_params", dict, {}, """ A dictionary of MOSEK (Fusion) parameters to be set after general options are passed and before the search is started. Loading picos/solvers/solver_mosek.py +17 −11 Original line number Diff line number Diff line Loading @@ -700,6 +700,13 @@ class MOSEKSolver(Solver): def _solve(self): import mosek # Determine whether an LP is being solved. # TODO: Give Problem an interface for checks like this. _affine = (AffineConstraint, DummyConstraint) _is_lp = isinstance(self.ext.no.function, AffineExpression) \ and all(isinstance(constraint, _affine) for constraint in self.ext.constraints.values()) # Reset all solver options to default. self.int.setdefaults() self.int.putoptserverhost("") Loading Loading @@ -780,12 +787,6 @@ class MOSEKSolver(Solver): self.int.putintparam(mosek.iparam.sim_max_iterations, value) # Prepare lp_node_method and lp_root_method. if self.ext.options.lp_node_method is not None \ or self.ext.options.lp_root_method is not None: _affine = (AffineConstraint, DummyConstraint) _is_lp = isinstance(self.ext.no.function, AffineExpression) \ and all(isinstance(constraint, _affine) for constraint in self.ext.constraints.values()) _lpm = { "interior": (mosek.optimizertype.intpnt if _is_lp else mosek.optimizertype.conic), Loading Loading @@ -822,6 +823,13 @@ class MOSEKSolver(Solver): except mosek.Error as error: self._handle_bad_solver_specific_option(key, value, error) # Handle 'mosek_basic_sol' option. if self.ext.options.mosek_basic_sol and _is_lp: _intpnt_basis = mosek.basindtype.always else: _intpnt_basis = mosek.basindtype.never self.int.putintparam(mosek.iparam.intpnt_basis, _intpnt_basis) # Handle 'mosek_server' option. if self.ext.options.mosek_server: self.int.putoptserverhost(self.ext.options.mosek_server) Loading @@ -830,11 +838,6 @@ class MOSEKSolver(Solver): # TODO: Handle "hotstart" option (via mio_construct_sol). self._handle_unsupported_option("hotstart", "treememory") # Disable basis identification as this can be a performance bottleneck. # TODO: Consider adding an option to enable LP basis identification. # (For this to work, retrieve mosek.soltype.bas below.) self.int.putintparam(mosek.iparam.intpnt_basis, mosek.basindtype.never) # Attempt to solve the problem. with self._header(), self._stopwatch(): try: Loading @@ -853,6 +856,9 @@ class MOSEKSolver(Solver): # Set the solution to be retrieved. if self.ext.is_continuous(): if _intpnt_basis == mosek.basindtype.always: solType = mosek.soltype.bas else: solType = mosek.soltype.itr else: solType = mosek.soltype.itg Loading Loading
picos/modeling/options.py +4 −0 Original line number Diff line number Diff line Loading @@ -443,6 +443,10 @@ OPTIONS = [ This option affects both MOSEK (Optimizer) and MOSEK (Fusion). """, None), ("mosek_basic_sol", bool, False, """ Return a basic solution when solving LPs with MOSEK (Optimizer). """), ("mskfsn_params", dict, {}, """ A dictionary of MOSEK (Fusion) parameters to be set after general options are passed and before the search is started. Loading
picos/solvers/solver_mosek.py +17 −11 Original line number Diff line number Diff line Loading @@ -700,6 +700,13 @@ class MOSEKSolver(Solver): def _solve(self): import mosek # Determine whether an LP is being solved. # TODO: Give Problem an interface for checks like this. _affine = (AffineConstraint, DummyConstraint) _is_lp = isinstance(self.ext.no.function, AffineExpression) \ and all(isinstance(constraint, _affine) for constraint in self.ext.constraints.values()) # Reset all solver options to default. self.int.setdefaults() self.int.putoptserverhost("") Loading Loading @@ -780,12 +787,6 @@ class MOSEKSolver(Solver): self.int.putintparam(mosek.iparam.sim_max_iterations, value) # Prepare lp_node_method and lp_root_method. if self.ext.options.lp_node_method is not None \ or self.ext.options.lp_root_method is not None: _affine = (AffineConstraint, DummyConstraint) _is_lp = isinstance(self.ext.no.function, AffineExpression) \ and all(isinstance(constraint, _affine) for constraint in self.ext.constraints.values()) _lpm = { "interior": (mosek.optimizertype.intpnt if _is_lp else mosek.optimizertype.conic), Loading Loading @@ -822,6 +823,13 @@ class MOSEKSolver(Solver): except mosek.Error as error: self._handle_bad_solver_specific_option(key, value, error) # Handle 'mosek_basic_sol' option. if self.ext.options.mosek_basic_sol and _is_lp: _intpnt_basis = mosek.basindtype.always else: _intpnt_basis = mosek.basindtype.never self.int.putintparam(mosek.iparam.intpnt_basis, _intpnt_basis) # Handle 'mosek_server' option. if self.ext.options.mosek_server: self.int.putoptserverhost(self.ext.options.mosek_server) Loading @@ -830,11 +838,6 @@ class MOSEKSolver(Solver): # TODO: Handle "hotstart" option (via mio_construct_sol). self._handle_unsupported_option("hotstart", "treememory") # Disable basis identification as this can be a performance bottleneck. # TODO: Consider adding an option to enable LP basis identification. # (For this to work, retrieve mosek.soltype.bas below.) self.int.putintparam(mosek.iparam.intpnt_basis, mosek.basindtype.never) # Attempt to solve the problem. with self._header(), self._stopwatch(): try: Loading @@ -853,6 +856,9 @@ class MOSEKSolver(Solver): # Set the solution to be retrieved. if self.ext.is_continuous(): if _intpnt_basis == mosek.basindtype.always: solType = mosek.soltype.bas else: solType = mosek.soltype.itr else: solType = mosek.soltype.itg Loading