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

Update setvar! and setconstr! docstrings #497

Merged
merged 3 commits into from
Apr 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 33 additions & 24 deletions src/MathProg/formulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,26 @@ set_matrix_coeff!(

"""
setvar!(
formulation::Formulation, name::String, duty::Duty{Variable};
cost::Float64 = 0.0,
lb::Float64 = 0.0,
ub::Float64 = Inf,
kind::VarKind = Continuous,
inc_val::Float64 = 0.0,
is_active::Bool = true,
is_explicit::Bool = true,
moi_index::MoiVarIndex = MoiVarIndex(),
formulation, name, duty;
cost = 0.0,
lb = 0.0,
ub = Inf,
kind = Continuous,
is_active = true,
is_explicit = true,
members = nothing,
id = generatevarid(duty, form)
)

Create a new variable in a formulation with given name and duties.
Other arguments are facultative.
Create a new variable that has name `name` and duty `duty` in the formulation `formulation`.

Following keyword arguments allow the user to set additional information about the new variable :
- `cost`: cost of the variable in the objective function
- `lb`: lower bound of the variable
- `ub`: upper bound of the variable
- `kind`: kind which can be `Continuous`, `Binary` or `Integ`
- `is_active`: `true` if the variable is used in the formulation, `false` otherwise
- `is_explicit`: `true` if the variable takes part to the formulation, `false` otherwise (e.g. a variable used as a shortcut for calculation purposes)
- `members`: a dictionary `Dict{ConstrId, Float64}` that contains the coefficients of the new variable in the constraints of the formulation (default coefficient is 0).
"""
function setvar!(
form::Formulation,
Expand Down Expand Up @@ -337,21 +342,25 @@ end

"""
setconstr!(
form::Formulation, name::String, duty::Duty{Constraint};
rhs::Float64 = 0.0,
kind::ConstrKind = Essential,
sense::ConstrSense = Greater,
inc_val::Float64 = 0.0,
is_active::Bool = true,
is_explicit::Bool = true,
moi_index::MoiConstrIndex = MoiConstrIndex(),
formulation, name, duty;
rhs = 0.0,
kind = Essential,
sense = Greater,
is_active = true,
is_explicit = true,
members = nothing,
loc_art_var_abs_cost = 0.0,
id = generateconstrid(duty, form)
)

Create a new constraint in a formulation with given name and duties.
Other arguments are facultative.
Create a new constraint that has name `name` and duty `duty` in the formulation `formulation`.
Following keyword arguments allow the user to set additional information about the new constraint :
- `rhs`: right-hand side of the constraint
- `kind`: kind which can be `Essential` or `Facultative`
- `sense`: sense which can be `Greater`, `Less`, or `Equal`
- `is_active`: `true` if the constraint is used in the formulation, `false` otherwise
- `is_explicit`: `true` if the constraint structures the formulation, `false` otherwise
- `members`: a dictionary `Dict{VarId, Float64}` that contains the coefficients of the variables of the formulation in the new constraint (default coefficient is 0).
- `loc_art_var_abs_cost`: absolute cost of the artificial variables of the constraint
"""
function setconstr!(
form::Formulation,
Expand Down Expand Up @@ -659,4 +668,4 @@ end
# end

# return PrimalSolution(spform, spvars, spvals, cost, FEASIBLE_SOL)
# end
# end