-
Notifications
You must be signed in to change notification settings - Fork 261
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
Add possibility for nonlinear objective function #781
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #781 +/- ##
==========================================
+ Coverage 51.92% 52.30% +0.37%
==========================================
Files 18 19 +1
Lines 3892 3904 +12
==========================================
+ Hits 2021 2042 +21
+ Misses 1871 1862 -9 ☔ View full report in Codecov by Sentry. |
This is on my to-do list. I remember there was an issue with adding such a function in previous versions, but can't remember what that issue was. |
I have no clue, really. Maybe we were just too scared back then ;-) |
I think we might have thought of 2 things:
I think that was it. Anyway, that was back then. I let you guys decide if any of that makes sense. |
@Joao-Dionisio I added some changes to the branch.
|
@Joao-Dionisio @mmghannam I slept on this, and am now firmly against adding such functionality. It requires keeping track of some hidden overhead, and I think will confuse more users than help. I think we should just add an appropriate error warning when a user tries to add a non-linear objective. |
Hey @Opt-Mucca, fair enough. I think the main point is that the required reformulation isn't obvious for new users, so the modeling tip would be a must, in my opinion, maybe even explicitly saying which constraint to add. I've come across a fair amount of people asking how to have a nonlinear objective: #663, #387, #212, #168, #167, #41, SO1, SO2, ORSE1. For posteriority's sake, I'll leave my counterarguments, but if we elaborate on the warning as you said, then I'm fine with closing.
As for the randomness in the tests, I figured that a less deterministic test would be better, as we would be testing a wider array of problems, and possibly catching an error that we wouldn't otherwise (again, possible lack of experience showing). An additional question. SCIP already handles nonlinear objectives, right? Can we not just pass it over somehow? (I know I need to work on my conciseness, Mark, sorry :( ) |
I think both your arguments/concerns @Joao-Dionisio, @Opt-Mucca & @fserra make sense. This issue is similar to what's happening in #776 too. On the one hand the feature would help new users get things working quickly, but they are also not mapping to a feature in SCIP and could include judgement calls on how they are implemented. Also, including them as an example, or a warning message would be less convenient for users. So I suggest a somewhat middle ground solution, we could add a sub-package called maybe |
…n_linear_objective
…n_linear_objective
0b9adcb
to
7678009
Compare
It's passing all the tests, currently the only issue is that calling
getObjective
isn't as nice as with a linear objective.I deleted an assertion that I'm not sure what its purpose was, hopefully it was only to prevent nonlinear objectives, which should be alright now.
EDIT: just realized that this was on the wrong branch...