-
Notifications
You must be signed in to change notification settings - Fork 42
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
Update Formulation docstring #484
Conversation
Codecov Report
@@ Coverage Diff @@
## master #484 +/- ##
==========================================
- Coverage 83.06% 82.98% -0.08%
==========================================
Files 48 48
Lines 4700 4697 -3
==========================================
- Hits 3904 3898 -6
- Misses 796 799 +3
Continue to review full report at Codecov.
|
Do you think we can improve this method ? Something like : create_formulation!(problem::Problem, duty::Type{<:AbstractFormDuty};
obj_sense = MinSense, parent_formulation = nothing) |
Yes, that makes sense to me. Should the method be kept in "formulation.jl" even with the |
Good question because we'll have cross-dep issue . Besides I would like to move problem outside MathProg (cf #439) so it's definitely not a good idea. It's also does not look good to have Reformulation as first parameter. Do you think we can move the formulation counter into the environment and then have : create_formulation!(env::Env, duty::Type{<:AbstractFormDuty};
obj_sense = MinSense, parent_formulation = nothing) ? It fits with the def of Env
|
I see, I tried to do that just now. Env is defined after including MathProg in "Coluna.jl". I tried to include it after Env definition, but |
It's ok to move |
By the way, do we really need a Counter to maintain the number of formulations in the Coluna environment ? It looks like we did overengineering. |
Could the Counter be a way of passing the argument as a mutable value? |
|
Sorry, I meant in the |
Yes you can pass Env as argument.
Guillaume Marques
Sent from ProtonMail
Le sam., mars 27, 2021 à 15:59, Lara di Cavalcanti Pontes ***@***.***> a écrit :
…> Env is a mutable struct, so I think you can replace the counter by creating a field nb_formulations of type Int in Env.
Sorry, I meant in the getnewuid function, used in the Formulation constructor, the argument passed is only form_counter. If it is an Int, I think its value cannot be changed. But I can put the operation made in that function outside or pass Env instead of Env.form_counter as the argument.
—
You are receiving this because your review was requested.
Reply to this email directly, [view it on GitHub](#484 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ABNM5B3KMJFEDUMDYZM6DUTTFXXGNANCNFSM4Z3T3PYA).
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
You have to update the documentation (you can add the reference here : https://github.com/atoptima/Coluna.jl/blob/master/docs/src/dev/todo.md) to fix the error :
┌ Error: 1 docstring not included in the manual:
│
│ Coluna.MathProg.create_formulation! :: Tuple{Env, Type{var"#s2"} where var"#s2"<:Coluna.MathProg.AbstractFormDuty}
│
│
│ These are docstrings in the checked modules (configured with the modules keyword)
│ that are not included in @docs or @autodocs blocks.
└ @ Documenter.DocChecks ~/.julia/packages/Documenter/6vUwN/src/DocChecks.jl:69
[ Info: Populate: populating indices.
ERROR: LoadError: `makedocs` encountered an error. Terminating build
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] runner(#unused#::Type{Documenter.Builder.RenderDocument}, doc::Documenter.Documents.Document)
@ Documenter.Builder ~/.julia/packages/Documenter/6vUwN/src/Builder.jl:255
[3] dispatch(#unused#::Type{Documenter.Builder.DocumentPipeline}, x::Documenter.Documents.Document)
@ Documenter.Utilities.Selectors ~/.julia/packages/Documenter/6vUwN/src/Utilities/Selectors.jl:170
[4] #2
@ ~/.julia/packages/Documenter/6vUwN/src/Documenter.jl:247 [inlined]
[5] cd(f::Documenter.var"#2#3"{Documenter.Documents.Document}, dir::String)
@ Base.Filesystem ./file.jl:106
[6] #makedocs#1
@ ~/.julia/packages/Documenter/6vUwN/src/Documenter.jl:246 [inlined]
[7] top-level scope
@ ~/work/Coluna.jl/Coluna.jl/docs/make.jl:3
in expression starting at /home/runner/work/Coluna.jl/Coluna.jl/docs/make.jl:3
Error: Process completed with exit code 1.
Construct a `Formulation` of duty `Duty` with objective sense `obj_sense` and parent formulation | ||
`parent_formulation`. | ||
Construct a `Formulation` of duty `duty` in the environment `env`, with | ||
parent formulation `parent_formulation` and objective sense `obj_sense`. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say "Create a new formulation in the Coluna's environment env
with duty duty
, parent formulation parent_formulation
, and objective sense obj_sense
.
src/MathProg/formulation.jl
Outdated
@@ -85,6 +98,8 @@ getprimalsolcosts(form::Formulation) = form.manager.primal_sol_costs | |||
getdualsolmatrix(form::Formulation) = form.manager.dual_sols | |||
getdualsolrhss(form::Formulation) = form.manager.dual_sol_rhss | |||
|
|||
"Generates a new `uid` to a formulation in `Env` env." | |||
getnewuid(env::Coluna.Env) = env.form_counter += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can delete this method and do the operation in create_formulation
.
src/MathProg/formulation.jl
Outdated
nothing, NoOptimizer(), FormulationManager(), | ||
MinSense, FormulationBuffer() | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should not exist. Do we create the original formulation before instanciating the Env
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. Isn't Env
instantiated in optimize!
("optimize.jl")?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can instanciate it when we create Optimizer
, what do you think ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that makes sense.
src/optimize.jl
Outdated
@@ -54,7 +54,9 @@ function optimize!(prob::MathProg.Problem, annotations::Annotations, params::Par | |||
env = Env(params) | |||
|
|||
# Apply decomposition | |||
reformulate!(prob, annotations, env) | |||
if(prob.re_formulation == nothing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Style : no parenthesis for if statement.
- You should use
===
to compare againstnothing
. - Why do you need this condition ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I mixed the if statement with C/C++. I need this condition because there was an error when trying to optimize twice. Maybe because a new environment is instantiated each call for optimize!
, and the same doesn't happen to Problem
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha no problem. Ok makes sense. So if we instanciate the Env
and Optimizer
at the same time, it will fix this issue and you will be able to remove this condition.
task for #486