Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions python/cuopt/cuopt/linear_programming/solver/solver_parameters.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ cdef extern from "cuopt/linear_programming/constants.h": # noqa
cdef const char* c_CUOPT_MIP_RELATIVE_GAP "CUOPT_MIP_RELATIVE_GAP" # noqa
cdef const char* c_CUOPT_MIP_HEURISTICS_ONLY "CUOPT_MIP_HEURISTICS_ONLY" # noqa
cdef const char* c_CUOPT_MIP_SCALING "CUOPT_MIP_SCALING" # noqa
cdef const char* c_CUOPT_MIP_CUT_PASSES "CUOPT_MIP_CUT_PASSES" # noqa
cdef const char* c_CUOPT_MIP_MIXED_INTEGER_ROUNDING_CUTS "CUOPT_MIP_MIXED_INTEGER_ROUNDING_CUTS" # noqa
cdef const char* c_CUOPT_MIP_MIXED_INTEGER_GOMORY_CUTS "CUOPT_MIP_MIXED_INTEGER_GOMORY_CUTS" # noqa
cdef const char* c_CUOPT_MIP_KNAPSACK_CUTS "CUOPT_MIP_KNAPSACK_CUTS" # noqa
cdef const char* c_CUOPT_MIP_STRONG_CHVATAL_GOMORY_CUTS "CUOPT_MIP_STRONG_CHVATAL_GOMORY_CUTS" # noqa
cdef const char* c_CUOPT_MIP_REDUCED_COST_STRENGTHENING "CUOPT_MIP_REDUCED_COST_STRENGTHENING" # noqa
cdef const char* c_CUOPT_MIP_CUT_CHANGE_THRESHOLD "CUOPT_MIP_CUT_CHANGE_THRESHOLD" # noqa
cdef const char* c_CUOPT_MIP_CUT_MIN_ORTHOGONALITY "CUOPT_MIP_CUT_MIN_ORTHOGONALITY" # noqa
cdef const char* c_CUOPT_MIP_BATCH_PDLP_STRONG_BRANCHING "CUOPT_MIP_BATCH_PDLP_STRONG_BRANCHING" # noqa
cdef const char* c_CUOPT_SOLUTION_FILE "CUOPT_SOLUTION_FILE" # noqa
cdef const char* c_CUOPT_NUM_CPU_THREADS "CUOPT_NUM_CPU_THREADS" # noqa
cdef const char* c_CUOPT_USER_PROBLEM_FILE "CUOPT_USER_PROBLEM_FILE" # noqa
Expand Down Expand Up @@ -99,6 +108,15 @@ CUOPT_MIP_ABSOLUTE_GAP = c_CUOPT_MIP_ABSOLUTE_GAP.decode('utf-8') # noqa
CUOPT_MIP_RELATIVE_GAP = c_CUOPT_MIP_RELATIVE_GAP.decode('utf-8') # noqa
CUOPT_MIP_HEURISTICS_ONLY = c_CUOPT_MIP_HEURISTICS_ONLY.decode('utf-8') # noqa
CUOPT_MIP_SCALING = c_CUOPT_MIP_SCALING.decode('utf-8') # noqa
CUOPT_MIP_CUT_PASSES = c_CUOPT_MIP_CUT_PASSES.decode('utf-8') # noqa
CUOPT_MIP_MIXED_INTEGER_ROUNDING_CUTS = c_CUOPT_MIP_MIXED_INTEGER_ROUNDING_CUTS.decode('utf-8') # noqa
CUOPT_MIP_MIXED_INTEGER_GOMORY_CUTS = c_CUOPT_MIP_MIXED_INTEGER_GOMORY_CUTS.decode('utf-8') # noqa
CUOPT_MIP_KNAPSACK_CUTS = c_CUOPT_MIP_KNAPSACK_CUTS.decode('utf-8') # noqa
CUOPT_MIP_STRONG_CHVATAL_GOMORY_CUTS = c_CUOPT_MIP_STRONG_CHVATAL_GOMORY_CUTS.decode('utf-8') # noqa
CUOPT_MIP_REDUCED_COST_STRENGTHENING = c_CUOPT_MIP_REDUCED_COST_STRENGTHENING.decode('utf-8') # noqa
CUOPT_MIP_CUT_CHANGE_THRESHOLD = c_CUOPT_MIP_CUT_CHANGE_THRESHOLD.decode('utf-8') # noqa
CUOPT_MIP_CUT_MIN_ORTHOGONALITY = c_CUOPT_MIP_CUT_MIN_ORTHOGONALITY.decode('utf-8') # noqa
CUOPT_MIP_BATCH_PDLP_STRONG_BRANCHING = c_CUOPT_MIP_BATCH_PDLP_STRONG_BRANCHING.decode('utf-8') # noqa
CUOPT_SOLUTION_FILE = c_CUOPT_SOLUTION_FILE.decode('utf-8') # noqa
CUOPT_NUM_CPU_THREADS = c_CUOPT_NUM_CPU_THREADS.decode('utf-8') # noqa
CUOPT_USER_PROBLEM_FILE = c_CUOPT_USER_PROBLEM_FILE.decode('utf-8') # noqa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,20 @@
CUOPT_METHOD,
CUOPT_MIP_ABSOLUTE_GAP,
CUOPT_MIP_ABSOLUTE_TOLERANCE,
CUOPT_MIP_BATCH_PDLP_STRONG_BRANCHING,
CUOPT_MIP_CUT_CHANGE_THRESHOLD,
CUOPT_MIP_CUT_MIN_ORTHOGONALITY,
CUOPT_MIP_CUT_PASSES,
CUOPT_MIP_HEURISTICS_ONLY,
CUOPT_MIP_INTEGRALITY_TOLERANCE,
CUOPT_MIP_KNAPSACK_CUTS,
CUOPT_MIP_MIXED_INTEGER_GOMORY_CUTS,
CUOPT_MIP_MIXED_INTEGER_ROUNDING_CUTS,
CUOPT_MIP_REDUCED_COST_STRENGTHENING,
CUOPT_MIP_RELATIVE_GAP,
CUOPT_MIP_RELATIVE_TOLERANCE,
CUOPT_MIP_SCALING,
CUOPT_MIP_STRONG_CHVATAL_GOMORY_CUTS,
CUOPT_NUM_CPU_THREADS,
CUOPT_NUM_GPUS,
CUOPT_ORDERING,
Expand Down Expand Up @@ -374,6 +383,29 @@ def toDict(self):
"mip_heuristics_only": self.get_parameter(
CUOPT_MIP_HEURISTICS_ONLY
),
"mip_cut_passes": self.get_parameter(CUOPT_MIP_CUT_PASSES),
"mip_mixed_integer_rounding_cuts": self.get_parameter(
CUOPT_MIP_MIXED_INTEGER_ROUNDING_CUTS
),
"mip_mixed_integer_gomory_cuts": self.get_parameter(
CUOPT_MIP_MIXED_INTEGER_GOMORY_CUTS
),
"mip_knapsack_cuts": self.get_parameter(CUOPT_MIP_KNAPSACK_CUTS),
"mip_strong_chvatal_gomory_cuts": self.get_parameter(
CUOPT_MIP_STRONG_CHVATAL_GOMORY_CUTS
),
"mip_reduced_cost_strengthening": self.get_parameter(
CUOPT_MIP_REDUCED_COST_STRENGTHENING
),
"mip_cut_change_threshold": self.get_parameter(
CUOPT_MIP_CUT_CHANGE_THRESHOLD
),
"mip_cut_min_orthogonality": self.get_parameter(
CUOPT_MIP_CUT_MIN_ORTHOGONALITY
),
"mip_batch_pdlp_strong_branching": self.get_parameter(
CUOPT_MIP_BATCH_PDLP_STRONG_BRANCHING
),
"num_cpu_threads": self.get_parameter(CUOPT_NUM_CPU_THREADS),
"num_gpus": self.get_parameter(CUOPT_NUM_GPUS),
"augmented": self.get_parameter(CUOPT_AUGMENTED),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,51 @@ class SolverConfig(StrictModel):
description="Set True to run heuristics only, False to run "
"heuristics and branch and bound for MILP",
)
mip_cut_passes: Optional[int] = Field(
default=None,
description="Number of cut passes to make at the root node. "
"Set to 0 to disable cuts, -1 for automatic.",
)
mip_mixed_integer_rounding_cuts: Optional[int] = Field(
default=None,
description="Enable/disable Mixed Integer Rounding (MIR) cuts. "
"Set to -1 for automatic, 0 to disable, 1 to enable.",
)
mip_mixed_integer_gomory_cuts: Optional[int] = Field(
default=None,
description="Enable/disable Mixed Integer Gomory cuts. "
"Set to -1 for automatic, 0 to disable, 1 to enable.",
)
mip_knapsack_cuts: Optional[int] = Field(
default=None,
description="Enable/disable Knapsack cuts. "
"Set to -1 for automatic, 0 to disable, 1 to enable.",
)
mip_strong_chvatal_gomory_cuts: Optional[int] = Field(
default=None,
description="Enable/disable Strong Chvatal-Gomory cuts. "
"Set to -1 for automatic, 0 to disable, 1 to enable.",
)
mip_reduced_cost_strengthening: Optional[int] = Field(
default=None,
description="Enable/disable reduced cost strengthening at the root node. "
"Set to -1 for automatic, 0 to disable, otherwise specifies max number of strengthening rounds.",
)
mip_cut_change_threshold: Optional[float] = Field(
default=None,
description="Threshold for cutting plane objective improvement. "
"Cuts are stopped if improvement falls below this threshold.",
)
mip_cut_min_orthogonality: Optional[float] = Field(
default=None,
description="Minimum orthogonality for cut selection. "
"Value between 0.0 and 1.0.",
)
mip_batch_pdlp_strong_branching: Optional[int] = Field(
default=None,
description="Number of candidates to evaluate in parallel using PDLP "
"during strong branching. Set to 0 to disable.",
)
num_cpu_threads: Optional[int] = Field(
default=None,
description="Set the number of CPU threads to use for branch and bound.", # noqa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,20 @@
CUOPT_METHOD,
CUOPT_MIP_ABSOLUTE_GAP,
CUOPT_MIP_ABSOLUTE_TOLERANCE,
CUOPT_MIP_BATCH_PDLP_STRONG_BRANCHING,
CUOPT_MIP_CUT_CHANGE_THRESHOLD,
CUOPT_MIP_CUT_MIN_ORTHOGONALITY,
CUOPT_MIP_CUT_PASSES,
CUOPT_MIP_HEURISTICS_ONLY,
CUOPT_MIP_INTEGRALITY_TOLERANCE,
CUOPT_MIP_KNAPSACK_CUTS,
CUOPT_MIP_MIXED_INTEGER_GOMORY_CUTS,
CUOPT_MIP_MIXED_INTEGER_ROUNDING_CUTS,
CUOPT_MIP_REDUCED_COST_STRENGTHENING,
CUOPT_MIP_RELATIVE_GAP,
CUOPT_MIP_RELATIVE_TOLERANCE,
CUOPT_MIP_SCALING,
CUOPT_MIP_STRONG_CHVATAL_GOMORY_CUTS,
CUOPT_NUM_CPU_THREADS,
CUOPT_NUM_GPUS,
CUOPT_ORDERING,
Expand Down Expand Up @@ -388,6 +397,49 @@ def is_mip(var_types):
solver_settings.set_parameter(
CUOPT_CUDSS_DETERMINISTIC, solver_config.cudss_deterministic
)
if solver_config.mip_cut_passes is not None:
solver_settings.set_parameter(
CUOPT_MIP_CUT_PASSES, solver_config.mip_cut_passes
)
if solver_config.mip_mixed_integer_rounding_cuts is not None:
solver_settings.set_parameter(
CUOPT_MIP_MIXED_INTEGER_ROUNDING_CUTS,
solver_config.mip_mixed_integer_rounding_cuts,
)
if solver_config.mip_mixed_integer_gomory_cuts is not None:
solver_settings.set_parameter(
CUOPT_MIP_MIXED_INTEGER_GOMORY_CUTS,
solver_config.mip_mixed_integer_gomory_cuts,
)
if solver_config.mip_knapsack_cuts is not None:
solver_settings.set_parameter(
CUOPT_MIP_KNAPSACK_CUTS, solver_config.mip_knapsack_cuts
)
if solver_config.mip_strong_chvatal_gomory_cuts is not None:
solver_settings.set_parameter(
CUOPT_MIP_STRONG_CHVATAL_GOMORY_CUTS,
solver_config.mip_strong_chvatal_gomory_cuts,
)
if solver_config.mip_reduced_cost_strengthening is not None:
solver_settings.set_parameter(
CUOPT_MIP_REDUCED_COST_STRENGTHENING,
solver_config.mip_reduced_cost_strengthening,
)
if solver_config.mip_cut_change_threshold is not None:
solver_settings.set_parameter(
CUOPT_MIP_CUT_CHANGE_THRESHOLD,
solver_config.mip_cut_change_threshold,
)
if solver_config.mip_cut_min_orthogonality is not None:
solver_settings.set_parameter(
CUOPT_MIP_CUT_MIN_ORTHOGONALITY,
solver_config.mip_cut_min_orthogonality,
)
if solver_config.mip_batch_pdlp_strong_branching is not None:
solver_settings.set_parameter(
CUOPT_MIP_BATCH_PDLP_STRONG_BRANCHING,
solver_config.mip_batch_pdlp_strong_branching,
)
if solver_config.solution_file != "":
warnings.append(ignored_warning("solution_file"))

Expand Down