# LabVIEW

cancel
Showing results for
Did you mean:

## Constrained nonlinear optimization

Hi there,

I have a constrained nonlinear optimization problem. I've tried to see and use Constrained Nonlinear Optimization.vi, but I got stuck with defining the constrained. When I looked for some help, it only shows a template (labview\vi.lib\gmath\NumericalOptimization\cno_objective function template.vit) which not giving much and real example.

I have some experiences using 'fmincon' in Matlab. Although I know that we can use it in MathScript, but I want to get the result purely from LabView, not connecting and using Matlab 'fmincon' algorithm.

A simple example I took from Matlab; If I have function f(x) = –x1*x2*x3 and the constraint is 0 <= x1 + 2*x2 + 2*x3 <= 72. How to write the constraint function to be connected into Constrained Nonlinear Optimization.vi ? Can someone help me ?

PS: Those equestions (function and constrained) are just examples for my case. If someone already have another example which involving defining the constraints function, I would like to know it.

Thank you.

Cah_londo

Message 1 of 6
(3,653 Views)

## Re: Constrained nonlinear optimization

cah_londo wrote:

Hi there,

If someone already have another example which involving defining the constraints function, I would like to know it.

Thank you.

Cah_londo

Hi,

Try ..\labview\examples\math\curvefit.llb for an example of using the Constrained Nonlinear Optimization VI.

---

While evaluating my code please have in mind that I am a LV novice. Therefore sometimes my code might violate some coding rules that I have to learn about myself. But how else could I do that... 🙂

Chart zoom with "Mouse Over" effect
Message 2 of 6
(3,649 Views)

## Re: Constrained nonlinear optimization

Hi Giedrius,

Thanks for your advice. Yes indeed, it has an example of how to use Constraint Nonlinear Optimization.vi. However, when I opened the Static VI Reference as the input for objective and constraint function, I saw a text block stated that there are "no equality and inequality constraints for this problem". On the other hand, an example of how to implement both equality and inequality constraints is the one I'm looking for.To be more precise, how to write my constraints, 0 <= x1 + 2*x2 + 2*x3 <= 72 ?

Regards,

Cah Londo

Message 3 of 6
(3,608 Views)

## 回复： Constrained nonlinear optimization

Hello,cah_londo.I meet the same question with you--Constrained nonlinear optimization. Have you solved your problem?

Message 4 of 6
(3,307 Views)

## 回复： Constrained nonlinear optimization

Hi enotsss,

Yes, I also found difficulties to apply boundaries in LabView. In fact, I gave up on this.

Fortunately, I still can solve the problem with Matlab. If you still need to use LabView, probably you can use SIT connection after you finish with your nonlinear optimization process.

Good luck !

Message 5 of 6
(3,278 Views)

## 回复： Constrained nonlinear optimization

Thank you, cah_londo! In fact, I intended to write a paper about the vi's application in engineering . So, I have no choise except I give up my plan. Yesterday, I called to the expert work in NI for help, but he didn't know how to use that vi either. I felt very disappointed and helpless. I solved the problem by C++ program, but you know , it's too long and not convenient. I deside to resarch that example and wait for help. Can somebody help me?

Message 6 of 6
(3,258 Views)