Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
linearProblem.h
1/*
2 * Copyright 2007-2024, RTE (https://www.rte-france.com)
3 * See AUTHORS.txt
4 * SPDX-License-Identifier: MPL-2.0
5 * This file is part of Antares-Simulator,
6 * Adequacy and Performance assessment for interconnected energy networks.
7 *
8 * Antares_Simulator is free software: you can redistribute it and/or modify
9 * it under the terms of the Mozilla Public Licence 2.0 as published by
10 * the Mozilla Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * Antares_Simulator is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * Mozilla Public Licence 2.0 for more details.
17 *
18 * You should have received a copy of the Mozilla Public Licence 2.0
19 * along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20 */
21
22#pragma once
23
24#include <map>
25#include <string>
26
27#include "mipConstraint.h"
28#include "mipSolution.h"
29#include "mipVariable.h"
30
33{
34
41{
42public:
43 virtual ~ILinearProblem() = default;
44
46 virtual IMipVariable* addNumVariable(double lb, double ub, const std::string& name) = 0;
47
49 virtual IMipVariable* addIntVariable(double lb, double ub, const std::string& name) = 0;
50
52 virtual IMipVariable* addVariable(double lb, double ub, bool integer, const std::string& name)
53 = 0;
54
55 virtual IMipVariable* getVariable(const std::string& name) const = 0;
56 virtual int variableCount() const = 0;
57
59 virtual IMipConstraint* addConstraint(double lb, double ub, const std::string& name) = 0;
60
61 virtual IMipConstraint* getConstraint(const std::string& name) const = 0;
62 virtual int constraintCount() const = 0;
63
65 virtual void setObjectiveCoefficient(IMipVariable* var, double coefficient) = 0;
66 virtual double getObjectiveCoefficient(const IMipVariable* var) const = 0;
67
69 virtual void setMinimization() = 0;
71 virtual void setMaximization() = 0;
72
73 virtual bool isMinimization() const = 0;
74 virtual bool isMaximization() const = 0;
75
77 virtual IMipSolution* solve(bool verboseSolver) = 0;
78
79 virtual void WriteLP(const std::string& filename) = 0;
80
81 // Definition of infinity
82 virtual double infinity() const = 0;
83};
84
85} // namespace Antares::Optimisation::LinearProblemApi
virtual void setObjectiveCoefficient(IMipVariable *var, double coefficient)=0
Set the objective coefficient for a given variable.
virtual IMipVariable * addNumVariable(double lb, double ub, const std::string &name)=0
Create a continuous variable.
virtual void setMaximization()=0
Sets the optimization direction to maximize.
virtual void setMinimization()=0
Sets the optimization direction to minimize.
virtual IMipVariable * addVariable(double lb, double ub, bool integer, const std::string &name)=0
Create a continuous or integer variable.
virtual IMipConstraint * addConstraint(double lb, double ub, const std::string &name)=0
Add a bounded constraint to the problem.
virtual IMipSolution * solve(bool verboseSolver)=0
Solve the problem, returns a IMipSolution.
virtual IMipVariable * addIntVariable(double lb, double ub, const std::string &name)=0
Create a integer variable.
Namespace for the classes related to the linear problem API.
Definition EvaluationContext.h:9