LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to specify equality constraints in constrained nonlinear optimization

Solved!
Go to solution

Thank you Thank you ....thanks a lot.. now i understand the concept of adding constraints to objective function.

Please if you help me regarding my second problem i.e.  variant to data converter is not giving output due to which my objective function is giving zero value, please also spot error in code their, i will be very very thankful.

0 Kudos
Message 21 of 23
(679 Views)

You have two ways to specify parameters of an objective function.

1. Specify in the objective function: This means that in the objective function you specify constants or default values that can only be changed by editing the objective function. It looks like this is what you are trying to do, but you are using a block-diagram constant as the "type" input to the "variant to data" primitive. Any data contained within the type input is ignored as it is used as a type specifier only. So instead of your current code:

 

type input usage 1.png

 

You might have this:

 

type input usage 2.png

 

2. Specify objective function parameters elsewhere in the optimization algorithm:

Method one can be inconvenient because every time the objective function parameters change you must edit the objective function. For example, suppose temperature (T) is a measured quantity in an experiment and is a parameter of your objective function. Suppose you measure temperature 10 times and each time you will perform an optimization with your objective function. Using method 1 you will have to edit your objective function 10 times, making automation of the optimization problem problematic. An alternative is to have a method to pass the objective function parameter into the cost function from a higher level in the VI hierarchy. This data could be anything, so we used a variant as a carrier for this data. This means that at the point in your diagram where you call the global optimization.vi you would pass your model parameters into the "function data" input of "global optimization.vi". The global optimization vi uses call by reference internally to evaluate your specified objective function, and passes the function data variant to your objective function. Inside the objective function you just convert from the variant type back to the actual parameter type. 

 

-Jim

0 Kudos
Message 22 of 23
(666 Views)

oh great Sir, things are getting amazing, as  Now i understand why in ''Non linear spring constant  fit" example variant is used. Let me try to optimize this objective function by taking remaining help from Non linear spring constant example. I will let you know than here.

As i found you here Sir that's why i will solve my all problems here in this post unless i optimize this objective function. Once again thanks again for so much help

0 Kudos
Message 23 of 23
(656 Views)