Showing results for 
Search instead 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, 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 ? 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.





0 Kudos
Message 1 of 6

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.







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
0 Kudos
Message 2 of 6

Hi Giedrius,


Thanks for your advice. Yes indeed, it has an example of how to use Constraint Nonlinear 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 ?



Cah Londo



0 Kudos
Message 3 of 6

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


0 Kudos
Message 4 of 6

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 ! Smiley Happy

0 Kudos
Message 5 of 6

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?

0 Kudos
Message 6 of 6