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

Restore function 'PNE_EcrireJeuDeDonneesMPS_avecNom' #5

Merged
merged 5 commits into from
Nov 16, 2022

Conversation

flomnes
Copy link
Collaborator

@flomnes flomnes commented Feb 15, 2022

No description provided.

@flomnes flomnes linked an issue Apr 12, 2022 that may be closed by this pull request
@flomnes flomnes requested a review from sgatto April 12, 2022 16:40
@klorel
Copy link
Member

klorel commented May 23, 2022

Nothing to say on the code. From a design point of view, how to put the objoffset into the MPS ?

@flomnes
Copy link
Collaborator Author

flomnes commented May 23, 2022

If a row is not mentioned anywhere in the RHS section, that row takes a right-hand side value of 0. You may define an objective offset by setting the negative offset as right-hand side of the objective row. For example, if the linear objective row in the problem is called COST and you want to add an offset of 1000 to your objective function, you can add the following to the RHS section :

RHS
    RHS1      COST      -1000

Sources :
https://www.ibm.com/docs/en/icos/20.1.0?topic=standard-records-in-mps-format
https://www.gurobi.com/documentation/9.5/refman/mps_format.html

@flomnes
Copy link
Collaborator Author

flomnes commented Nov 8, 2022

@klorel Merged the objective offset feature, included it in the MPS write.
Please note that SPX_EcrireProblemeSpxAuFormatMPS, SPX_EcrireProblemeAuFormatMPS and SPX_EcrireJeuDeDonneesLineaireAuFormatMPS are not called in the SRS_PROBLEM API.

@@ -478,7 +480,7 @@ int SRSgetobjval(SRS_PROBLEM * problem_srs, double * objVal) {
if (problem_srs->maximize)
(*objVal) *= -1.;

*objVal += problem_srs->objective_offset;
*objVal += problem_mps->objective_offset;
Copy link
Member

Choose a reason for hiding this comment

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

this line should be before line 480 to take into account the min/max

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As discussed, not really

argmax {a.x + b} = argmax {a.x} + b = -argmin {-a.x} + b

@@ -734,13 +736,13 @@ int SRSchgrangeval(SRS_PROBLEM * problem_srs, size_t nbRowIndexes, const int * r

int SRSsetobjoffset(SRS_PROBLEM* problem_srs, double value)
{
problem_srs->objective_offset = value;
problem_srs->problem_mps->objective_offset = value;
Copy link
Member

Choose a reason for hiding this comment

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

should take into account the maximize attribute value

// see https://www.ibm.com/docs/en/icos/20.1.0?topic=standard-records-in-mps-format
// NOTE: By convention, we write here the negative objective value
if (objective_offset != 0.0) {
fprintf(Flot," RHSVAL OBJECTIF %f\n", -objective_offset);
Copy link
Member

Choose a reason for hiding this comment

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

take into account the maximize attribute value

@flomnes flomnes requested a review from klorel November 16, 2022 10:09
@flomnes flomnes merged commit 64f20d8 into antares_integration Nov 16, 2022
@flomnes flomnes deleted the antares-filename-mps branch November 16, 2022 10:10
flomnes added a commit that referenced this pull request Nov 23, 2022
* Restore function 'PNE_EcrireJeuDeDonneesMPS_avecNom'

* Remove useless printf notice

* Move objective_offset to PROBLEME_MPS, write to MPS

* Fix typo, include SRSsetobjoffset in TEST_API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Function SRSwritempsprob does not write MPS
2 participants