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

Feature/ant 1267 #22

Merged
merged 9 commits into from
Mar 13, 2024
Merged

Feature/ant 1267 #22

merged 9 commits into from
Mar 13, 2024

Conversation

ianmnz
Copy link
Contributor

@ianmnz ianmnz commented Mar 1, 2024

No description provided.

@ianmnz ianmnz requested review from sylvlecl and tbittar March 1, 2024 13:14
@ianmnz ianmnz self-assigned this Mar 1, 2024
@ianmnz ianmnz marked this pull request as ready for review March 8, 2024 15:32
master: OptimizationProblem,
subproblems: List[OptimizationProblem],
emplacement: str = "outputs/lp",
output_path: str = "output/xpansion",
Copy link
Contributor

Choose a reason for hiding this comment

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

outputs ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That depends on what tree you would like. For now it is like this:

outputs/
└── lp
    ├── master.mps
    ├── options.json
    ├── structure.txt
    ├── subproblem_1.mps
    ├── subproblem_2.mps
    └── output
    │   └── xpansion
    │       ├── last_iteration.json
    │       └── out.json

So output is inside outputs, but we could change it if you prefer

Copy link
Contributor

Choose a reason for hiding this comment

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

I do not know if it is best to replicate the actual Xpansion tree or if it does not matter. The actual tree is :

outputs/
└── lp
    ├── master.mps
    ├── options.json
    ├── structure.txt
    ├── subproblem_1.mps
    ├── subproblem_2.mps
    ├── expansion
    │       ├── last_iteration.json
    │       └── out.json

Copy link

Choose a reason for hiding this comment

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

The ‘expansion’ dir is at same level as lp ❤️

self.read_solution()
return True
else:
return False
Copy link
Contributor

Choose a reason for hiding this comment

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

Raise an error message ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. For now I would leave like this and would raise an error in the PR with the CI integration

return self.data["solution"]["problem_status"]

@property
def optimality_gap(self) -> float:
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename function to absolute_gap (closer to the mathematical meaning of the data)

Copy link
Member

@sylvlecl sylvlecl left a comment

Choose a reason for hiding this comment

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

Minor technical stuff to fix before merge (class-level field on non-dataclass)



class CommandRunner:
current_dir: pathlib.Path
Copy link
Member

Choose a reason for hiding this comment

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

If not a dataclass, those class-level fields are not used --> they must be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I will change it, but as I said here, if they don't have default values, they are just annotations and not actuel class-fields

Copy link
Member

Choose a reason for hiding this comment

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

Sorry I missed your previous comment, I've been wrong the whole time :)
My python knowledge is not up to date ! Thanks for sharing the reference.


@dataclass(frozen=True)
class BendersSolution:
data: Dict[str, Any]
Copy link
Member

Choose a reason for hiding this comment

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

Note that we could use pydantic to perform parsing + validation of the JSON content, while having a more typed class (with usual named fields etc).

Can be a future improvement, it's an implementation detail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't know that, I will have a look later :)

@sylvlecl sylvlecl self-requested a review March 13, 2024 09:15
@tbittar tbittar merged commit 423ed14 into main Mar 13, 2024
1 check passed
@tbittar tbittar deleted the feature/ANT-1267 branch March 13, 2024 10:25
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.

4 participants