Robust Problem¶
- class lropt.RobustProblem(objective, constraints, eval_exp=None, train_flag=True, cons_data=None, verify_x_parameters: bool = True)¶
Create a Robust Optimization Problem with uncertain variables
- evaluate() float ¶
Evaluates the out-of-sample value of the current solution and cvxpy/context parameters, with respect to the input data-set of uncertain parameters. The dataset is taken from u.eval_data_sol for each uncertain parameter u.
- order_args(z_batch: list[Tensor], x_batch: list[Tensor], u_batch: list[Tensor] | Tensor)¶
This function orders z_batch (decisions), x_batch (context), and u_batch (uncertainty) according to the order in vars_params.
- remove_uncertainty(override=False, solver=None)¶
This function canonizes a problem and saves it to self.problem_no_unc
Args:
- override
If True, will override current problem_no_unc. If False and problem_no_unc exists, does nothing.
Returns:
None
- solve(solver: str = None, warm_start: bool = True, verbose: bool = False, gp: bool = False, qcp: bool = False, requires_grad: bool = False, enforce_dpp: bool = False, ignore_dpp: bool = False, canon_backend: str | None = None, **kwargs)¶
This function solves the robust problem, and dualizes it first if it has not been dualized
Returns: the solution to the original problem
- uncertain_parameters()¶
Find uncertain (u) parameters
- unpack(solution) None ¶
Updates the problem state given a Solution.
Updates problem.status, problem.value and value of primal and dual variables. If solution.status is in cvxpy.settins.ERROR, this method is a no-op.
Arguments¶
- solutioncvxpy.Solution
A Solution object.
Raises¶
- ValueError
If the solution object has an invalid status
- unpack_results_unc(solution, chain, inverse_data, solvername) None ¶
Updates the problem state given the solver results.
Updates problem.status, problem.value and value of primal and dual variables.
Arguments¶
- solutionobject
The solution returned by applying the chain to the problem and invoking the solver on the resulting data.
- chainSolvingChain
A solving chain that was used to solve the problem.
- inverse_datalist
The inverse data returned by applying the chain to the problem.
Raises¶
- cvxpy.error.SolverError
If the solver failed
- verify_x_parameters()¶
This function verifies that x and u are in the correct diemsnions.
- x_parameters()¶
Find context (x) parameters