Skip to content

Documentation erratum set new objective #4027

Closed
@CasBex

Description

@CasBex

Documentation is not completely correct in the section about modifying an objective here. The first listed example produces the model below

julia> model = Model();
julia> @variable(model, x);
julia> @objective(model, Min, 2x)
2 x
julia> @objective(model, Max, -2x)
-2 x
julia> print(model)
Max -2 x
Subject to

The second listed example produces

julia> model = Model();
julia> @variable(model, x);
julia> @objective(model, Min, 2x)
2 x
julia> new_objective = @expression(model, -2 * x)
-2 x
julia> set_objective_function(model, new_objective)
julia> print(model)
Min -2 x
Subject to

Both are stated to be equivalent, but clearly they aren't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions