LSPhase Class¶
- class LSPhase¶
Optimization phase. Since LocalSolver allows lexicographic multiobjective optimization, we allow you to parameterize the time or the number of iterations to spend in optimizing each objective. When multiple objectives are declared, these objectives are optimized in lexicographic order (in the order of their declaration in the model). Thus, if
k
objectives0, ..., k-1
are declared, each objectivei
can be optimized while maintaining the values of objectives0, ..., i-1
previously obtained and ignoring the values of objectivesi+1, ..., k-1
. During such an optimization phase, objectivei
is called the optimized objective.
Summary¶
Fields¶
- LSPhase.optimizedObjective¶
Optimized objective of this phase. When multiple objectives are declared, these objectives are optimized in lexicographic order (in the order of their declaration in the model). Thus, if
k
objectives0, ..., k-1
are declared, each objectivei
can be optimized while maintaining the values of objectives0, ..., i-1
previously obtained and ignoring the values of objectivesi+1, ..., k-1
.By default, the optimized objective corresponds to the last objective declared in the model.
This attribute is read-write but it can only be changed in states
MODELING
orSTOPPED
.- Return type
int (must be positive or zero)
- LSPhase.timeLimit¶
Time limit of this phase in seconds. Note that the “real” time (that is, total time) spent to resolve the model is considered here and not only the CPU time). The default time limit is set to the largest positive integer on 32 bits, that is
2^31-1 = 2,147,483,647 > 10^9
.Note that if the optimal value of an objective is found before the end of the corresponding phase, the remaining time will be transferred to the next phase.
This attribute is read-write but it can only be changed in states
MODELING
orSTOPPED
.- Return type
int
- LSPhase.iterationLimit¶
Number of iterations of this phase. Fixing the seed and the number of iterations of all phases ensures the reproducibility of results over several runs. The default number of iterations is set to the largest positive integer on 64 bits, that is
2^63-1 = 9,223,372,036,854,775,807 > 10^18
.Note that if the optimal value of an objective is found before the end of the corresponding phase, the remaining iterations will be transferred to the next phase.
This attribute is read-write but it can only be changed in states
MODELING
orSTOPPED
.- Return type
int
- LSPhase.enabled¶
Status of this phase. The solver only optimize enabled phases. Disabling a phase can be useful when an objective has been removed from the model. By default, a phase is enabled.
This attribute is read-write but it can only be changed in states
MODELING
orSTOPPED
.- Return type
bool