Skip to content

Conversation

@odow
Copy link
Member

@odow odow commented Dec 13, 2020

Closes #1214

See the issue for background, but we have a decision.

Should set_objective_coefficient in the following:

model = Model()
@variable(model, x)
set_objective_coefficient(model, x, 1.0)
  1. Throw an error along the likes of "Unable to modify objective because no objective is set."
  2. Assume an empty ScalarAffineFunction objective exists and modify the linear term?

Currently, this PR does 2, but I would also support the first option.

@joehuchette
Copy link
Contributor

I think behavior 2 makes the most intuitive sense.

@blegat
Copy link
Member

blegat commented Dec 14, 2020

  1. works here as we allow the sense to be FEASIBILITY_SENSE even if the objective function is set. However, if we go in the direction of objective that you defined with set and function given simultaneously as you suggested for multi-objective then 1. would be preferable.

@odow
Copy link
Member Author

odow commented Dec 14, 2020

Seems like we can stick with (2) for now.

@matbesancon
Copy link
Contributor

should this be merged? (maybe after checking that CI still passes?)

@odow odow closed this Jan 28, 2021
@odow odow reopened this Jan 28, 2021
@matbesancon
Copy link
Contributor

Looks good here

@odow odow merged commit 8d8beb3 into master Jan 28, 2021
@odow odow deleted the od/obj_modify branch January 28, 2021 20:14
@blegat blegat added this to the v0.9.20 milestone Feb 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Programmatically defined functions work but the same programmatically defined objective does not

5 participants