GurobiClientΒΆ

class GurobiClientΒΆ

Bases: BaseClient

Client for the Gurobi Optimizer, a mathematical programming solver. The client loads the Gurobi library of the machine, so it sends no request over the network and it needs a license.

Methods

__init__

solve

Send the objective function and the constraints to the solver.

tune

tune

Attributes

acceptable_degrees

Degrees of the polynomial that the solver accepts.

library_path

parameters

Parameters that the client sends with every request.

version

write_request_data

Path of the file that receives a copy of the request, or None to write none.

write_response_data

Path of the file that receives a copy of the response, or None to write none.

class ParametersΒΆ

Parameters that the client sends with every request.

__init__(*args, **kwargs)ΒΆ
__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

property agg_fillΒΆ
property aggregateΒΆ
property bar_conv_tolΒΆ
property bar_correctorsΒΆ
property bar_homogeneousΒΆ
property bar_iter_limitΒΆ
property bar_orderΒΆ
property bar_qcp_conv_tolΒΆ
property best_bd_stopΒΆ
property best_obj_stopΒΆ
property bqp_cutsΒΆ
property branch_dirΒΆ
property clique_cutsΒΆ
property cloud_access_idΒΆ
property cloud_hostΒΆ
property cloud_poolΒΆ
property cloud_secret_keyΒΆ
property compute_serverΒΆ
property concurrent_jobsΒΆ
property concurrent_methodΒΆ
property concurrent_mipΒΆ
property cover_cutsΒΆ
property crossoverΒΆ
property crossover_basisΒΆ
property cs_app_nameΒΆ
property cs_auth_tokenΒΆ
property cs_batch_modeΒΆ
property cs_client_logΒΆ
property cs_groupΒΆ
property cs_idle_timeoutΒΆ
property cs_managerΒΆ
property cs_priorityΒΆ
property cs_queue_timeoutΒΆ
property cs_routerΒΆ
property csapi_access_idΒΆ
property csapi_secretΒΆ
property cstls_insecureΒΆ
property cut_agg_passesΒΆ
property cut_passesΒΆ
property cutoffΒΆ
property cutsΒΆ
property degen_movesΒΆ
property disconnectedΒΆ
property display_intervalΒΆ
property distributed_mip_jobsΒΆ
property dual_implied_cutsΒΆ
property dual_reductionsΒΆ
property feas_relax_big_mΒΆ
property feasibility_tolΒΆ
property flow_cover_cutsΒΆ
property flow_path_cutsΒΆ
property func_max_valΒΆ
property func_nonlinearΒΆ
property func_piece_errorΒΆ
property func_piece_lengthΒΆ
property func_piece_ratioΒΆ
property func_piecesΒΆ
property gomory_passesΒΆ
property gub_cover_cutsΒΆ
property heuristicsΒΆ
property ignore_namesΒΆ
property iis_methodΒΆ
property implied_cutsΒΆ
property improve_start_gapΒΆ
property improve_start_nodesΒΆ
property improve_start_timeΒΆ
property inf_proof_cutsΒΆ
property inf_unbd_infoΒΆ
property int_feas_tolΒΆ
property integrality_focusΒΆ
property iteration_limitΒΆ
property job_idΒΆ
property json_sol_detailΒΆ
property lazy_constraintsΒΆ
property license_idΒΆ
property lift_project_cutsΒΆ
property log_fileΒΆ
property log_to_consoleΒΆ
property lp_warm_startΒΆ
property markowitz_tolΒΆ
property mem_limitΒΆ
property methodΒΆ
property min_rel_nodesΒΆ
property mip_focusΒΆ
property mip_gapΒΆ
property mip_gap_absΒΆ
property mip_sep_cutsΒΆ
property miqcp_methodΒΆ
property mir_cutsΒΆ
property mixing_cutsΒΆ
property mod_k_cutsΒΆ
property multi_obj_methodΒΆ
property multi_obj_preΒΆ
property network_algΒΆ
property network_cutsΒΆ
property nlp_heurΒΆ
property no_rel_heur_timeΒΆ
property no_rel_heur_workΒΆ
property no_rel_heuristicΒΆ
property node_limitΒΆ
property node_methodΒΆ
property nodefile_dirΒΆ
property nodefile_startΒΆ
property non_convexΒΆ
property norm_adjustΒΆ
property numeric_focusΒΆ
property obbtΒΆ
property obj_numberΒΆ
property obj_scaleΒΆ
property optimality_tolΒΆ
property output_flagΒΆ
property partition_placeΒΆ
property perturb_valueΒΆ
property pool_gapΒΆ
property pool_gap_absΒΆ
property pool_search_modeΒΆ
property pool_solutionsΒΆ
property pre_crushΒΆ
property pre_dep_rowΒΆ
property pre_dualΒΆ
property pre_miqcp_formΒΆ
property pre_passesΒΆ
property pre_q_linearizeΒΆ
property pre_sparsifyΒΆ
property presolveΒΆ
property proj_implied_cutsΒΆ
property psd_cutsΒΆ
property psd_tolΒΆ
property pump_passesΒΆ
property qcp_dualΒΆ
property quadΒΆ
property recordΒΆ
property relax_lift_cutsΒΆ
property result_fileΒΆ
property rinsΒΆ
property rlt_cutsΒΆ
property scale_flagΒΆ
property scenario_numberΒΆ
property seedΒΆ
property server_passwordΒΆ
property server_timeoutΒΆ
property sift_methodΒΆ
property siftingΒΆ
property simplex_pricingΒΆ
property soft_mem_limitΒΆ
property sol_filesΒΆ
property solution_limitΒΆ
property solution_numberΒΆ
property solution_targetΒΆ
property start_node_limitΒΆ
property start_numberΒΆ
property strong_cg_cutsΒΆ
property sub_mip_cutsΒΆ
property sub_mip_nodesΒΆ
property symmetryΒΆ
property thread_limitΒΆ
property threadsΒΆ
property time_limitΒΆ
property token_serverΒΆ
property ts_portΒΆ
property tune_cleanupΒΆ
property tune_criterionΒΆ
property tune_dynamic_jobsΒΆ
property tune_jobsΒΆ
property tune_metricΒΆ
property tune_outputΒΆ
property tune_resultsΒΆ
property tune_target_mip_gapΒΆ
property tune_target_timeΒΆ
property tune_time_limitΒΆ
property tune_trialsΒΆ
property update_modeΒΆ
property usernameΒΆ
property var_branchΒΆ
property wls_access_idΒΆ
property wls_configΒΆ
property wls_proxyΒΆ
property wls_secretΒΆ
property wls_tokenΒΆ
property wls_token_durationΒΆ
property wls_token_refreshΒΆ
property work_limitΒΆ
property worker_passwordΒΆ
property worker_poolΒΆ
property zero_half_cutsΒΆ
property zero_obj_nodesΒΆ
class ResultΒΆ

Raw response that the solver returned.

class OptimizationStatusCodeΒΆ

Bases: Enum

classmethod __contains__(value)ΒΆ

Return True if value is in cls.

value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls’s members. 3) value is a pseudo-member (flags)

classmethod __getitem__(name)ΒΆ

Return the member matching name.

classmethod __iter__()ΒΆ

Return members in definition order.

classmethod __len__()ΒΆ

Return the number of members (no aliases)

__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

Cutoff = 6ΒΆ
InfOrUnbd = 4ΒΆ
Infeasible = 3ΒΆ
Inprogress = 14ΒΆ
Interrupted = 11ΒΆ
IterationLimit = 7ΒΆ
Loaded = 1ΒΆ
MemLimit = 17ΒΆ
NodeLimit = 8ΒΆ
Numeric = 12ΒΆ
Optimal = 2ΒΆ
SolutionLimit = 10ΒΆ
Suboptimal = 13ΒΆ
TimeLimit = 9ΒΆ
Unbounded = 5ΒΆ
Unknown = 0ΒΆ
UserObjLimit = 15ΒΆ
WorkLimit = 16ΒΆ
__members__ = mappingproxy({'Unknown': OptimizationStatusCode.Unknown, 'Loaded': OptimizationStatusCode.Loaded, 'Optimal': OptimizationStatusCode.Optimal, 'Infeasible': OptimizationStatusCode.Infeasible, 'InfOrUnbd': OptimizationStatusCode.InfOrUnbd, 'Unbounded': OptimizationStatusCode.Unbounded, 'Cutoff': OptimizationStatusCode.Cutoff, 'IterationLimit': OptimizationStatusCode.IterationLimit, 'NodeLimit': OptimizationStatusCode.NodeLimit, 'TimeLimit': OptimizationStatusCode.TimeLimit, 'SolutionLimit': OptimizationStatusCode.SolutionLimit, 'Interrupted': OptimizationStatusCode.Interrupted, 'Numeric': OptimizationStatusCode.Numeric, 'Suboptimal': OptimizationStatusCode.Suboptimal, 'Inprogress': OptimizationStatusCode.Inprogress, 'UserObjLimit': OptimizationStatusCode.UserObjLimit, 'WorkLimit': OptimizationStatusCode.WorkLimit, 'MemLimit': OptimizationStatusCode.MemLimit})ΒΆ
__name__ = 'OptimizationStatusCode'ΒΆ
__nb_enum__ = <capsule object NULL>ΒΆ
__qualname__ = 'GurobiClient.Result.OptimizationStatusCode'ΒΆ
__init__(*args, **kwargs)ΒΆ
__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

property bar_iter_countΒΆ
property bound_vioΒΆ
property constr_vioΒΆ
property farkas_proofΒΆ
property int_vioΒΆ
property iter_countΒΆ
property mip_gapΒΆ
property node_countΒΆ
property obj_boundΒΆ
property obj_bound_cΒΆ
property obj_valΒΆ
property pool_obj_boundΒΆ
property pool_obj_valΒΆ
property runtimeΒΆ
property sol_countΒΆ
property statusΒΆ
property time_stampsΒΆ
property var_namesΒΆ
property xΒΆ
property xnΒΆ
__init__(self) NoneΒΆ
__init__(self, library_path: str) None
Parameters:

library_path (str)

__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

solve(self, objective: Poly | Matrix, dry_run: Literal[False] = False) ResultΒΆ
solve(
self,
constraint: Constraint | ConstraintList,
dry_run: Literal[False] = False,
) Result
solve(
self,
objective: Poly | Matrix,
constraint: Constraint | ConstraintList,
dry_run: Literal[False] = False,
) Result
solve(self, objective: Poly | Matrix, dry_run: Literal[True]) None
solve(self, constraint: Constraint | ConstraintList, dry_run: Literal[True]) None
solve(
self,
objective: Poly | Matrix,
constraint: Constraint | ConstraintList,
dry_run: Literal[True],
) None

Send the objective function and the constraints to the solver.

This method takes the polynomial that the solver accepts, so it runs no conversion of the model. Use solve() to solve a model that needs a conversion. It returns the raw response of the solver.

Overload 1.

Args:
  • objective (amplify.Poly | amplify.Matrix): The objective function that the solver minimizes.

  • dry_run (typing.Literal[False]): When True, ask the service to check the request, and return None. Defaults to False.

Returns:

amplify.GurobiClient.Result:

Overload 2.

Args:
  • constraint (amplify.Constraint | amplify.ConstraintList): The constraints that the solution must satisfy.

  • dry_run (typing.Literal[False]): When True, ask the service to check the request, and return None. Defaults to False.

Returns:

amplify.GurobiClient.Result:

Overload 3.

Args:
  • objective (amplify.Poly | amplify.Matrix): The objective function that the solver minimizes.

  • constraint (amplify.Constraint | amplify.ConstraintList): The constraints that the solution must satisfy.

  • dry_run (typing.Literal[False]): When True, ask the service to check the request, and return None. Defaults to False.

Returns:

amplify.GurobiClient.Result:

Overload 4.

Args:
  • objective (amplify.Poly | amplify.Matrix): The objective function that the solver minimizes.

  • dry_run (typing.Literal[True]): When True, ask the service to check the request, and return None.

Overload 5.

Args:
  • constraint (amplify.Constraint | amplify.ConstraintList): The constraints that the solution must satisfy.

  • dry_run (typing.Literal[True]): When True, ask the service to check the request, and return None.

Overload 6.

Args:
  • objective (amplify.Poly | amplify.Matrix): The objective function that the solver minimizes.

  • constraint (amplify.Constraint | amplify.ConstraintList): The constraints that the solution must satisfy.

  • dry_run (typing.Literal[True]): When True, ask the service to check the request, and return None.

tune(self, objective: Poly | Matrix) NoneΒΆ
tune(self, constraint: Constraint | ConstraintList) None
tune(self, objective: Poly | Matrix, constraint: Constraint | ConstraintList) None

tune

Overload 1.

Args:
  • objective (amplify.Poly | amplify.Matrix)

Overload 2.

Args:
  • constraint (amplify.Constraint | amplify.ConstraintList)

Overload 3.

Args:
  • objective (amplify.Poly | amplify.Matrix)

  • constraint (amplify.Constraint | amplify.ConstraintList)

property acceptable_degreesΒΆ

Degrees of the polynomial that the solver accepts.

solve() reads it to decide the conversion of the model.

Return type:

AcceptableDegrees

property library_pathΒΆ
property parametersΒΆ

Parameters that the client sends with every request.

Return type:

Parameters

property versionΒΆ
property write_request_dataΒΆ

Path of the file that receives a copy of the request, or None to write none.

Use it to inspect what the client sends.

Return type:

str | None

property write_response_dataΒΆ

Path of the file that receives a copy of the response, or None to write none.

Return type:

str | None