modules.applications.optimization.acl.acl.ACL
- class ACL
Bases:
OptimizationThe distribution of passenger vehicles is a complex task and a high cost factor for automotive original equipment manufacturers (OEMs). Vehicles travel long distance on different carriers, such as ships, trains, and trucks, from the production plant to the customer.
To save costs, OEMs and logistics service providers aim to maximize their loading capacities. Modern auto carriers are flexible, allowing individual platforms to be rotated, extended, or combined to accommodate vehicles of different shapes and weights in a space-efficient manner.
In practice, finding feasible combinations is often based on heuristics or personal experience. We formulate the problem as a mixed integer quadratically constrained assignment problem.
- __init__()
Constructor method.
Methods
__init__()Constructor method.
diffset(p1, p2)Computes the difference between two lists.
evaluate(solution)Checks how good the solution is.
generate_problem(config)This function includes three models: Full, small and tiny.
Gets the application.
Gets the list of available options.
get_available_submodules(option)If the module has submodules depending on certain options, this method should adjust the submodule_options accordingly.
get_default_submodule(option)Returns the default submodule based on the provided option.
get_depending_parameters(option, config)If the module has parameters depending on certain options, this method should return the parameters for the given option.
Returns parameter options for selecting different models.
Returns the list of module requirements.
Provides the unit of measure for solution quality.
get_submodule(option)Submodule is instantiated according to the information given in self.sub_options.
intersectset(p1, p2)Computes the intersection of two lists.
postprocess(input_data, config, **kwargs)For optimization problems, we process the solution here, then validate and evaluate it.
preprocess(input_data, config, **kwargs)For optimization problems, we generate the actual problem instance in the preprocess function.
process_solution(solution)Most of the time the solution has to be processed before it can be validated and evaluated.
save(path, iter_count)Saves the problem instance to a JSON file.
validate(solution)Checks if the solution is a valid solution.
visualize_solution(processed_solution, path)Creates visualizations of a processed and validated solution and writes them to disk.
- class Config
Bases:
TypedDict- clear() None. Remove all items from D.
- copy() a shallow copy of D
- fromkeys(value=None, /)
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)
Return the value for key if key is in the dictionary, else default.
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- pop(k[, d]) v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update([E, ]**F) None. Update D from mapping/iterable E and F.
If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values() an object providing a view on D's values
- static diffset(p1: list, p2: list) list
Computes the difference between two lists.
- Parameters:
p1 -- First list
p2 -- Second list
- Returns:
List containing elements in p1 that are not in p2
- evaluate(solution: any) tuple[float, float]
Checks how good the solution is.
- Parameters:
solution -- Provided solution
- Returns:
Tuple containing the objective value and the time it took to evaluate the solution
- generate_problem(config: Config) dict
This function includes three models: Full, small and tiny. Full refers to the original model with all of its constraints. Small refers to the simplified model suitable for solving it with QC methods. The simplified model does not consider the possibility that vehicles can be angled or that they can be oriented forwards or backwards in relation to the auto carrier. For the tiny version we do not consider split platforms and consider only weight constraints.
- Parameters:
config -- Config containing the selected scenario
- Returns:
Dictionary with scenario-dependent model formulated as linear problem
- get_application() any
Gets the application.
- Returns:
self.application
- get_available_submodule_options() list
Gets the list of available options.
- Returns:
List of module options
- get_available_submodules(option: list) list
If the module has submodules depending on certain options, this method should adjust the submodule_options accordingly.
- Parameters:
option -- List of chosen options
- Returns:
List of available submodules
- get_default_submodule(option: str) Core
Returns the default submodule based on the provided option.
- Parameters:
option -- Option specifying the submodule
- Returns:
Instance of the corresponding submodule
- Raises:
NotImplementedError -- If the option is not recognized
- get_depending_parameters(option: str, config: dict) dict
If the module has parameters depending on certain options, this method should return the parameters for the given option.
- Parameters:
option -- The chosen option
config -- Current config dictionary
- Returns:
The parameters for the given option
- get_parameter_options() dict
Returns parameter options for selecting different models.
- Returns:
Dictionary containing model selection options
- static get_requirements() list[dict]
Returns the list of module requirements.
- Returns:
List of dictionaries containing module requirements
- get_solution_quality_unit() str
Provides the unit of measure for solution quality.
- Returns:
The unit of measure fro solution quality
- get_submodule(option: str) Core
Submodule is instantiated according to the information given in self.sub_options. If self.sub_options is None, get_default_submodule is called as a fallback.
- Parameters:
option -- String with the options
- Returns:
Instance of a module
- static intersectset(p1: list, p2: list) list
Computes the intersection of two lists.
- Parameters:
p1 -- First list
p2 -- Second list
- Returns:
List containing elements common to both p1 and p2
- postprocess(input_data: any, config: dict, **kwargs) tuple[any, float]
For optimization problems, we process the solution here, then validate and evaluate it.
- Parameters:
input_data -- Data which should be evaluated for this optimization problem
config -- Config for the problem creation
kwargs -- Optional additional arguments
- Returns:
Tuple with results and the postprocessing time
- preprocess(input_data: any, config: dict, **kwargs) tuple[any, float]
For optimization problems, we generate the actual problem instance in the preprocess function.
- Parameters:
input_data -- Input data (usually not used in this method)
config -- Config for the problem creation
kwargs -- Optional additional arguments
- Returns:
Tuple with output and the preprocessing time
- process_solution(solution: any) tuple[any, float]
Most of the time the solution has to be processed before it can be validated and evaluated. This might not be necessary in all cases, so the default is to return the original solution.
- Parameters:
solution -- Proposed solution
- Returns:
Tuple with processed solution and the execution time to process it
- save(path: str, iter_count: int) None
Saves the problem instance to a JSON file.
- Parameters:
path -- Directory path where the instance should be saved
iter_count -- Iteration count (unused)
- validate(solution: any) tuple[bool, float]
Checks if the solution is a valid solution.
- :
- param solution:
Proposed solution
- return:
Tuple containing a boolean indicating if the solution is valid and the time it took to validate the solution
- visualize_solution(processed_solution: any, path: str) None
Creates visualizations of a processed and validated solution and writes them to disk. Override if applicable. Default is to do nothing.
- Parameters:
processed_solution -- A solution that was already processed by
process_solution()path -- File path for the plot
- Returns:
None