Filter löschen
Filter löschen

How can I write objective function with variable plus constant for solving using intlinprog Ex. X1+4

3 Ansichten (letzte 30 Tage)
How can I write objective function with variable plus constant for solving using intlinprog Ex. X1+4
Thank you for your time

Akzeptierte Antwort

Matt J
Matt J am 16 Sep. 2017
Bearbeitet: Matt J am 16 Sep. 2017
There is no way to include a constant term in the objective function, but it would be meaningless to do so. Adding a constant term does not change the optimal solution, x.
  2 Kommentare
Nurye Hassen
Nurye Hassen am 17 Sep. 2017
The original question is to minimize delay of trains, meaning actual arrival time minus scheduled arrival time. I considered the controlled variable to be actual arrival time and scheduled time table as a constant. Also, Is it acceptable to replace the constant with the variable in the objective and then include it in equality constraint like this.. obj X1+4 ==>x1+x2 Include x2=4; In constraints
Thank you again.
Matt J
Matt J am 7 Okt. 2017
Bearbeitet: Matt J am 7 Okt. 2017
Again, that would complicate things unnecessarily. Using your example of obj X1+4, note that
min{X1+4} = min{X1}+4
In other words, you could just solve the minimization min{X1} without any constant terms and then add 4 to the final result.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Aurele Turnes
Aurele Turnes am 13 Nov. 2017
Bearbeitet: Aurele Turnes am 13 Nov. 2017
If you have R2017b, the new Problem-based approach lets you specify constant terms in the objective of linear and mixed-integer linear problems. Although Matt is correct that the constant term will not change the final solution value, just the objective value.

Kategorien

Mehr zu Linear Programming and Mixed-Integer Linear Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by