-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Currently, performance indicators in the generated AMPL file are defined separately from their formulas. This results in a multi-step definition process, as seen below:
# Performance indicators = composite metrics that have at least one variable in their formula
var mean_cpu_consumption_all;
var mean_requests_per_second;
# Performance indicator formulas
subject to define_mean_cpu_consumption_all : mean_cpu_consumption_all = sum_cpu_consumption_all/spec_components_1_traits_0_properties_replicas;
subject to define_mean_requests_per_second : mean_requests_per_second = sum_requests_per_second/spec_components_0_traits_0_properties_replicas;
This formulation is inefficient from the solver perspective, because solver will treat the performance indicators as variables. Therefore, performance indicators should be defined directly within the formula:
var mean_cpu_consumption_all = sum_cpu_consumption_all/spec_components_1_traits_0_properties_replicas;
var mean_requests_per_second = sum_requests_per_second/spec_components_0_traits_0_properties_replicas;
It is important to note that AMPL loads the file line by line. If a performance indicator is used in a formula, it must be defined before its usage to avoid reference errors. This necessitates an approach to ensure the correct order of variable declarations through topological sorting of dependencies.