getObjectives method

List<OptimizeObjective> getObjectives()

Implementation

List<OptimizeObjective> getObjectives() {
  final objectives = _c._unpackAstVector(
    _c._z3.optimize_get_objectives(_optimize),
  );
  final result = <OptimizeObjective>[];
  for (var i = 0; i < objectives.length; i++) {
    final objective = objectives[i];
    final lower = _c
        ._unpackAstVector(_c._z3.optimize_get_lower_as_vector(_optimize, i))
        .cast<Numeral>();
    final upper = _c
        ._unpackAstVector(_c._z3.optimize_get_upper_as_vector(_optimize, i))
        .cast<Numeral>();
    final lowerValue = _c._getAST(_c._z3.optimize_get_lower(_optimize, i));
    final upperValue = _c._getAST(_c._z3.optimize_get_upper(_optimize, i));
    result.add(
      OptimizeObjective(
        lowerBound: Bound(
          infinity: lower[0].toRat(),
          rational: lower[1].toRat(),
          infinitesimal: lower[2].toRat(),
        ),
        lowerValue: lowerValue,
        upperBound: Bound(
          infinity: upper[0].toRat(),
          rational: upper[1].toRat(),
          infinitesimal: upper[2].toRat(),
        ),
        upperValue: upperValue,
        objective: objective,
      ),
    );
  }
  return result;
}