1#ifndef POTENTIALS_POTENTIAL_OPTIMIZER_H
2#define POTENTIALS_POTENTIAL_OPTIMIZER_H
4#include "downward/task_proxy.h"
6#include "downward/lp/lp_solver.h"
12class PotentialFunction;
40class PotentialOptimizer {
41 std::shared_ptr<AbstractTask> task;
43 lp::LPSolver lp_solver;
44 const double max_potential;
46 std::vector<std::vector<int>> lp_var_ids;
47 std::vector<std::vector<double>> fact_potentials;
49 int get_lp_var_id(
const FactProxy& fact)
const;
52 void solve_and_extract();
53 void extract_lp_solution();
57 const std::shared_ptr<AbstractTask>& transform,
58 lp::LPSolverType lpsolver,
59 double max_potential);
60 ~PotentialOptimizer() =
default;
62 std::shared_ptr<AbstractTask> get_task()
const;
63 bool potentials_are_bounded()
const;
65 void optimize_for_state(
const State& state);
66 void optimize_for_all_states();
67 void optimize_for_samples(
const std::vector<State>& samples);
69 bool has_optimal_solution()
const;
71 std::unique_ptr<PotentialFunction> get_potential_function()
const;