Runtime creation of constraints and optimization variable
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
0 votes
Share a link to this question
Accepted Answer
- Kindly define the optimization variable ‘Q’
- Second step is to set up the constraints, since each row of “Q” is “g*P_i” and “P_i” is an “NxN” diagonal matrix, you can express “P_i” as a vector (since it's diagonal) and then multiply by g to get the row of “Q”. The Frobenius norm constraint on “P_i” is equivalent to constraining the 2-norm of the vector since “P_i” is diagonal.
- Then we need to define the objective function, Since you have not specified the objective function, I am considering a placeholder function(“myObjectiveFunction”).
- So we have our problem set up now, we will need to loop over different values of “T” to solve for each scenario.
- https://in.mathworks.com/help/optim/ug/optimvar.html%22
- https://in.mathworks.com/help/optim/ug/optimproblem.html%22
- https://in.mathworks.com/help/optim/examples.html?category=problem-based-basics&s_tid=CRUX_topnav%22
4 Comments
- We loop over the array 'T_values' to solve the optimization problem for different values of 'T'.
- We define 'Q' and 'P_i' variables for each 'T' within the loop.
- We create a structure 'x0' to hold the initial conditions for each 'P_i'.
- We set an example initial condition for each 'P_i' as a vector of ones multiplied by sqrt(N/N). This is a simple starting point, and you might want to choose a more appropriate initial condition based on your specific problem.
- We pass the initial guess 'x0' to the 'solve' function to provide a starting point for the optimization.
More Answers (0)
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Tags
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)