[Trilinos-Users] Moocho constraint inequations

Bartlett, Roscoe A. bartlettra at ornl.gov
Mon Jan 5 08:11:25 MST 2015


> 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.

As explained in Section 2.4 the guide:

    http://web.ornl.gov/~8vt/MoochoOverview.pdf

you have to convert general inequalities:

    hl <= h(x) < hu

into equalities with slags:

    h(x) - s = 0
    hl <= s <= hu

I know this is not directly supported by the NLPInterfacePack::NLPDirectThyraModelEvaluator adapter subclass.  Therefore, you would have to do this formulation yourself in your ModelEvaluator sublass.

However, I have to warn you than the SQP methods in MOOCHO are not going to work very well for solving an LP.  The assumption for SQP methods is that the reduced Hessian is nonsingular but for a LP the reduced Hessian is always singular (it is zero).  If you want to solve an LP, you are better off looking for specialized LP solvers.  I don't know of any high quality open source LP solvers (but I have not been looking in many years).

But if you still want to look at MOOCHO, if you are not going to be using iterative solvers, then you are better off deriving from NLPInterfacePack::NLPSerialPreprocess:

   http://trilinos.org/docs/dev/packages/moocho/src/NLPInterfacePack/doc/html/classNLPInterfacePack_1_1NLPSerialPreprocess.html

as it does all of the translations and transformations for you.

But if you have a large scale parallel problem with general inequalities, you have a challenging problem on your hands.  That type of problem will be difficult to formulate and solve no matter what software you look at using.

> 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.

Can you give an example?

-Ross


> ------------
> 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
> 
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> https://software.sandia.gov/mailman/listinfo/trilinos-users


More information about the Trilinos-Users mailing list