Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMPL executor #2455

Merged
merged 44 commits into from
Mar 14, 2023
Merged

AMPL executor #2455

merged 44 commits into from
Mar 14, 2023

Conversation

nicolas-pierr
Copy link
Contributor

@nicolas-pierr nicolas-pierr commented Jan 24, 2023

Please check if the PR fulfills these requirements (please use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Does this PR already have an issue describing the problem ? If so, link to this issue using '#XXX' and skip the rest
Not yet, but one might be created.

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
feature

What is the new behavior (if this is a feature change)?
We want to have a flexible way to run a AMPL model on a network and apply the results on the network.

The current interface is :

  1. Implement IAmplModel to tell how the model works and interface itself with the import/export functions of the ampl-converter module
  2. Select the computationManager to use and run with AmplModelRunner
  3. AmplResults could provide some info on the run.

See here for use case.

Nicolas PIERRE added 4 commits January 24, 2023 14:27
extract modifications to the network

Signed-off-by: Nicolas PIERRE <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas PIERRE <nicolas.pierre@artelys.com>
basic AmplConfig and AmplResult

Signed-off-by: Nicolas PIERRE <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas PIERRE <nicolas.pierre@artelys.com>
@nicolas-pierr nicolas-pierr self-assigned this Jan 24, 2023
Nicolas PIERRE and others added 24 commits January 24, 2023 15:58
Signed-off-by: Nicolas PIERRE <nicolas.pierre@artelys.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Nicolas PIERRE <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas PIERRE <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas PIERRE <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
…ustomization

Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
annetill and others added 5 commits March 8, 2023 09:35
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
* @param networkAmplMapper Mapper to convert {@link com.powsybl.iidm.network.Network} IDs to Ampl IDs
* and vice versa
*/
void read(Path outputPath, StringToIntMapper<AmplSubset> networkAmplMapper) throws IOException;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure we need to known the file name here? why not just
void read(Path workingDir, StringToIntMapper<AmplSubset> networkAmplMapper) throws IOException

Nicolas Pierre and others added 6 commits March 14, 2023 11:00
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
@nicolas-pierr
Copy link
Contributor Author

nicolas-pierr commented Mar 14, 2023

PR can be checked again for merge. @geofjamg

@@ -0,0 +1,9 @@
package com.powsybl.ampl.converter;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

licence + author

*/
public interface AmplNetworkUpdater {

void applyGenerators(Generator g, int busNum, boolean vregul, double targetV, double targetP, double targetQ,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to updateGenerators?

@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2017, RTE (http://www.rte-france.com)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Year to update

moduleConfig.setStringProperty("homeDir", "/home/test/ampl");
AmplConfig cfg = AmplConfig.load(platformConfig);
assertEquals("/home/test/ampl", cfg.getAmplHome(), "Error parsing Ampl Home");
fs.close();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you close it with try(...) ?

assertTrue(amplState.isSuccess(), "AmplResult must be OK.");
}
// Test cleaning
fs.close();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you close it with try(...) ?

Nicolas Pierre and others added 4 commits March 14, 2023 15:54
…t, try with ressources

Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

84.5% 84.5% Coverage
0.0% 0.0% Duplication

@annetill annetill merged commit 827e69f into main Mar 14, 2023
@annetill annetill deleted the ampl-solver branch March 14, 2023 16:09
@annetill annetill changed the title AMPL solver AMPL executor Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants