pub trait UserMasterProblem<ProblemInstance: Clone, PricingSolver: UserPricingSolver<ProblemInstance, BranchFilter, ColumnType, DualStore>, ColumnType: PartialEq + 'static, DualStore: UserDualStore, ModelMeta: UserModelMeta<Constr, Var, Env, Model>, BranchFilter: IBranchFilter, BranchGroupType: Clone + Debug, Constr: Clone, Env: LPEnv, Model: LPModel<Constr, Var, Env>, Var: Clone>where
ColumnPool<ColumnType, BranchFilter>: ColumnPoolFilter<ColumnType, BranchFilter>,{
Show 18 methods
// Required methods
fn new(problem_instance: &ProblemInstance, ui: UISender) -> Self;
fn get_ui(&self) -> &UISender;
fn get_lds_settings(&self) -> &LDSSettings;
fn get_stabilization_settings(&self) -> &StabilizationSettings;
fn create_column_forcing_filter(
&self,
column: &Column<ColumnType>,
direction: bool,
) -> BranchFilter;
fn is_column_forcing_filter(
&self,
filter: &BranchFilter,
) -> Option<ColumnId>;
fn add_var_from_column(
&self,
col: &Column<ColumnType>,
master: &mut Model,
model_meta: &ModelMeta,
solver: &PricingSolver,
integer: bool,
) -> Var;
fn initialize_model(
&self,
solver: &PricingSolver,
active_filters: &[BranchFilter],
integer: bool,
master: &mut Model,
) -> ModelMeta;
fn fix_columns_from_filters_in_model(
&self,
solver: &PricingSolver,
active_filters: &[BranchFilter],
master: &mut Model,
model_meta: &mut ModelMeta,
) -> Result<(), ()>;
fn get_duals_from_model(
&self,
solver: &PricingSolver,
master: &Model,
model_meta: &ModelMeta,
) -> DualStore;
fn find_fractional_solutions(
&self,
solver: &PricingSolver,
active_filters: &[BranchFilter],
column_pool: &ColumnPool<ColumnType, BranchFilter>,
patterns: &Vec<(f64, ColumnId)>,
) -> Vec<BranchGroup<BranchFilter, BranchGroupType>>;
// Provided methods
fn is_a_cutoff_by_bound_b(&self, a: &f64, b: &f64) -> bool { ... }
fn get_periodic_integer_solve_interval(&self) -> &Option<usize> { ... }
fn filter_columns_to_add_per_iteration(
&self,
new_paths: Vec<(f64, ColumnType)>,
env: &mut Env,
solver: &PricingSolver,
) -> Box<dyn Iterator<Item = (f64, ColumnType)>> { ... }
fn should_exit_pricing_early(
&self,
model_meta: &ModelMeta,
obj: f64,
total_new_columns: usize,
total_columns: usize,
elapsed: Duration,
branch: &Branch<BranchFilter, DualStore>,
iterations_counter: i32,
) -> bool { ... }
fn run_column_generation(
&self,
env: &mut Env,
branch: &Branch<BranchFilter, DualStore>,
best_known: &RwLock<(f64, Vec<(f64, ColumnId)>)>,
lower_bound: f64,
column_pool: &RwLock<ColumnPool<ColumnType, BranchFilter>>,
solver: &mut PricingSolver,
time_limit: Option<Instant>,
integer: bool,
parent_dual_center: Option<(f64, DualStore)>,
) -> ColGenResult<DualStore> { ... }
fn select_fractional_columns_to_fix_in_lds(
&self,
solver: &PricingSolver,
active_filters: &[BranchFilter],
column_pool: &ColumnPool<ColumnType, BranchFilter>,
patterns: &Vec<(f64, ColumnId)>,
taboo_filters: &HashSet<BranchFilter>,
) -> Vec<BranchFilter> { ... }
fn choose_fractional_solution(
&self,
obj: f64,
fractional_options: Vec<BranchGroup<BranchFilter, BranchGroupType>>,
best: f64,
branch: &Branch<BranchFilter, DualStore>,
solver: &mut PricingSolver,
env: &mut Env,
column_pool: &RwLock<ColumnPool<ColumnType, BranchFilter>>,
patterns: &Vec<(f64, ColumnId)>,
) -> Option<BranchGroup<BranchFilter, BranchGroupType>> { ... }
}
Expand description
Primary trait for the master problem Contains the primary user implementation
Required Methods§
fn new(problem_instance: &ProblemInstance, ui: UISender) -> Self
fn get_ui(&self) -> &UISender
fn get_lds_settings(&self) -> &LDSSettings
fn get_stabilization_settings(&self) -> &StabilizationSettings
Sourcefn create_column_forcing_filter(
&self,
column: &Column<ColumnType>,
direction: bool,
) -> BranchFilter
fn create_column_forcing_filter( &self, column: &Column<ColumnType>, direction: bool, ) -> BranchFilter
Return a custom branching filter that represents forcing a column to be either used or not be used
Sourcefn is_column_forcing_filter(&self, filter: &BranchFilter) -> Option<ColumnId>
fn is_column_forcing_filter(&self, filter: &BranchFilter) -> Option<ColumnId>
Test if a branching filter is a column forcing filter. If so return column id that is forced.
Sourcefn add_var_from_column(
&self,
col: &Column<ColumnType>,
master: &mut Model,
model_meta: &ModelMeta,
solver: &PricingSolver,
integer: bool,
) -> Var
fn add_var_from_column( &self, col: &Column<ColumnType>, master: &mut Model, model_meta: &ModelMeta, solver: &PricingSolver, integer: bool, ) -> Var
Insert the column into the LP model An user implementation must create a variable, insert that variable in the constraint matrix and include it in the model_meta data.
Sourcefn initialize_model(
&self,
solver: &PricingSolver,
active_filters: &[BranchFilter],
integer: bool,
master: &mut Model,
) -> ModelMeta
fn initialize_model( &self, solver: &PricingSolver, active_filters: &[BranchFilter], integer: bool, master: &mut Model, ) -> ModelMeta
Create an initial lp model constraining problem constraints Variables from column will be inserted later
Sourcefn fix_columns_from_filters_in_model(
&self,
solver: &PricingSolver,
active_filters: &[BranchFilter],
master: &mut Model,
model_meta: &mut ModelMeta,
) -> Result<(), ()>
fn fix_columns_from_filters_in_model( &self, solver: &PricingSolver, active_filters: &[BranchFilter], master: &mut Model, model_meta: &mut ModelMeta, ) -> Result<(), ()>
Takes a list of branching filters and based on filters applies column fixing in the master model
Sourcefn get_duals_from_model(
&self,
solver: &PricingSolver,
master: &Model,
model_meta: &ModelMeta,
) -> DualStore
fn get_duals_from_model( &self, solver: &PricingSolver, master: &Model, model_meta: &ModelMeta, ) -> DualStore
Extract dual values from the underlying model and store them in a DualStorage object
Sourcefn find_fractional_solutions(
&self,
solver: &PricingSolver,
active_filters: &[BranchFilter],
column_pool: &ColumnPool<ColumnType, BranchFilter>,
patterns: &Vec<(f64, ColumnId)>,
) -> Vec<BranchGroup<BranchFilter, BranchGroupType>>
fn find_fractional_solutions( &self, solver: &PricingSolver, active_filters: &[BranchFilter], column_pool: &ColumnPool<ColumnType, BranchFilter>, patterns: &Vec<(f64, ColumnId)>, ) -> Vec<BranchGroup<BranchFilter, BranchGroupType>>
Given a LP Solution, return a list of all possible branching options
Provided Methods§
Sourcefn is_a_cutoff_by_bound_b(&self, a: &f64, b: &f64) -> bool
fn is_a_cutoff_by_bound_b(&self, a: &f64, b: &f64) -> bool
Rule to cutoff branches if a primary bound was found.
Basic implementation provided. But can be tighened based on problem Suppose the objective function is known to be integral, the current bound b is 5, and the candidate value a is 4.5: The branch may be cut early
Be careful with rounding issues
fn get_periodic_integer_solve_interval(&self) -> &Option<usize>
Sourcefn filter_columns_to_add_per_iteration(
&self,
new_paths: Vec<(f64, ColumnType)>,
env: &mut Env,
solver: &PricingSolver,
) -> Box<dyn Iterator<Item = (f64, ColumnType)>>
fn filter_columns_to_add_per_iteration( &self, new_paths: Vec<(f64, ColumnType)>, env: &mut Env, solver: &PricingSolver, ) -> Box<dyn Iterator<Item = (f64, ColumnType)>>
Given an ordered list of negative reduced cost columns Return iterator selecting the ones to add to the master problem
Default implementation selecting the first is provided.
Sourcefn should_exit_pricing_early(
&self,
model_meta: &ModelMeta,
obj: f64,
total_new_columns: usize,
total_columns: usize,
elapsed: Duration,
branch: &Branch<BranchFilter, DualStore>,
iterations_counter: i32,
) -> bool
fn should_exit_pricing_early( &self, model_meta: &ModelMeta, obj: f64, total_new_columns: usize, total_columns: usize, elapsed: Duration, branch: &Branch<BranchFilter, DualStore>, iterations_counter: i32, ) -> bool
Callback that can terminate pricing a node early. Such a node is marked, and will be reevaluated before pruning
Sourcefn run_column_generation(
&self,
env: &mut Env,
branch: &Branch<BranchFilter, DualStore>,
best_known: &RwLock<(f64, Vec<(f64, ColumnId)>)>,
lower_bound: f64,
column_pool: &RwLock<ColumnPool<ColumnType, BranchFilter>>,
solver: &mut PricingSolver,
time_limit: Option<Instant>,
integer: bool,
parent_dual_center: Option<(f64, DualStore)>,
) -> ColGenResult<DualStore>
fn run_column_generation( &self, env: &mut Env, branch: &Branch<BranchFilter, DualStore>, best_known: &RwLock<(f64, Vec<(f64, ColumnId)>)>, lower_bound: f64, column_pool: &RwLock<ColumnPool<ColumnType, BranchFilter>>, solver: &mut PricingSolver, time_limit: Option<Instant>, integer: bool, parent_dual_center: Option<(f64, DualStore)>, ) -> ColGenResult<DualStore>
Main function running the column generation. Is provided by the library, should only be overwritten if required.
Sourcefn select_fractional_columns_to_fix_in_lds(
&self,
solver: &PricingSolver,
active_filters: &[BranchFilter],
column_pool: &ColumnPool<ColumnType, BranchFilter>,
patterns: &Vec<(f64, ColumnId)>,
taboo_filters: &HashSet<BranchFilter>,
) -> Vec<BranchFilter>
fn select_fractional_columns_to_fix_in_lds( &self, solver: &PricingSolver, active_filters: &[BranchFilter], column_pool: &ColumnPool<ColumnType, BranchFilter>, patterns: &Vec<(f64, ColumnId)>, taboo_filters: &HashSet<BranchFilter>, ) -> Vec<BranchFilter>
Selects the column to branch on in limted discrepancy search Library provided implementation should only be overriden if required.
Sourcefn choose_fractional_solution(
&self,
obj: f64,
fractional_options: Vec<BranchGroup<BranchFilter, BranchGroupType>>,
best: f64,
branch: &Branch<BranchFilter, DualStore>,
solver: &mut PricingSolver,
env: &mut Env,
column_pool: &RwLock<ColumnPool<ColumnType, BranchFilter>>,
patterns: &Vec<(f64, ColumnId)>,
) -> Option<BranchGroup<BranchFilter, BranchGroupType>>
fn choose_fractional_solution( &self, obj: f64, fractional_options: Vec<BranchGroup<BranchFilter, BranchGroupType>>, best: f64, branch: &Branch<BranchFilter, DualStore>, solver: &mut PricingSolver, env: &mut Env, column_pool: &RwLock<ColumnPool<ColumnType, BranchFilter>>, patterns: &Vec<(f64, ColumnId)>, ) -> Option<BranchGroup<BranchFilter, BranchGroupType>>
Given the list of identified branching groups, select the best Default implementation simply selects first Most fractional or similar might be more appropriate
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.