All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.powsybl.openrao.searchtreerao.linearoptimisation.algorithms.linearproblem.OpenRaoMPObjective Maven / Gradle / Ivy

/*
 * Copyright (c) 2021, RTE (http://www.rte-france.com)
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package com.powsybl.openrao.searchtreerao.linearoptimisation.algorithms.linearproblem;

import com.google.ortools.linearsolver.MPObjective;

/**
 * @author Philippe Edwards {@literal }
 */
public class OpenRaoMPObjective {
    private final MPObjective mpObjective;

    protected OpenRaoMPObjective(MPObjective mpObjective) {
        this.mpObjective = mpObjective;
    }

    public double getCoefficient(OpenRaoMPVariable variable) {
        return mpObjective.getCoefficient(variable.getMPVariable());
    }

    public void setCoefficient(OpenRaoMPVariable variable, double coeff) {
        mpObjective.setCoefficient(variable.getMPVariable(), OpenRaoMPSolver.roundDouble(coeff));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy