[Trilinos-Users] Moocho constraint inequations
GUEDON Stéphane
stephane.guedon at doceapower.com
Mon Jan 5 03:04:21 MST 2015
Hello,
I am trying to enter a linear problem to minimize a function with MOOCHO.
See example following this text. Indeed, the ModelEvaluator class
doesn't seem to allow to define
inequation constraints like: x1 +2x2 + 2x3 ≤ 72. Am I wrong? Is there
a way to define such inequation constraint functions?
Any help is welcome.
By the way, in the examples furnished in Moocho sources, the overwritten
function "imp_report_orig_final_solution" must not be "const" to be called.
------------
Example
------------
Find values of x that minimize f(x) = –x1x2x3, starting at the point x =
[10;10;10], subject to the constraints:
0 ≤ x1 + 2x2 + 2x3 ≤ 72.
Write a file that returns a scalar value f of the objective function
evaluated at x:
function f = myfun(x)
f = -x(1) * x(2) * x(3);
Rewrite the constraints as both less than or equal to a constant,
–x1 –2x2 – 2x3 ≤ 0
x1 +2x2 + 2x3 ≤ 72
Since both constraints are linear, formulate them as the matrix
inequality A·x ≤ b, where
A = [-1 -2 -2; ...
1 2 2];
b = [0;72];
Supply a starting point and invoke an optimization routine:
x0 = [10;10;10];
Solution is:
x =
24.0000
12.0000
12.0000
More information about the Trilinos-Users
mailing list