Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I want to write a loop to help me solve this problem. I am trying to use Mosek to solve this optimization problem in Julia

I want to write a loop to help me solve this problem.

I am trying to use Mosek to solve this optimization problem in Julia programming language. I have my code which displays the optimal solution of the values of x,y,z and the radius R. I want to insert a loop in my code to test if the absolute of the optimal solutions thus absolute(x^2 + y^2 -z) <= 0.01 then it should stop and maintain the answer for x,y, z, and R but if the absolute value of (X^2 + y^2-z) is not less than or equal to 0.01 it should again find R with the same formula R= max(R,(((a[i]-x)^2 + (b[i]-y)^2)^0.5 + r[i] )) using the current optimal values of x,y and calculate the new optimal value of x,y,z until the condition that the absolute of (x^2 + y^2 -z) <= 0.01 is met. It should stop and display the optimal results for x,y,z and R immediately the absolute(x^2 + y^2 -z) <= 0.01.

Any guidance to get this done will be highly appreciated, please. Attached is my code:

using JuMP using Mosek using MosekTools model= Model(Mosek.Optimizer)

m=15 NumVar=5

a=[0,2.5,-2.5,2,-2.5] b=[0,0.3,0.25,-2.5,-2.25] r=[4, 8, 9, 8, 8]

(x,y)=(0,0) for (i,j) in enumerate(a) R= max(R,(((a[i]-x)^2 + (b[i]-y)^2)^0.5 + r[i] )) end

@variable(model, x>=0) @variable(model, y>=0) @variable(model, z>=0)

@objective(model, Min, x^2 + y^2-z )

#######Declare the constraints for i in 1:NumVar @constraint(model, -2*x*a[i]-2*b[i]*y + z <=(R-r[i])^2-a[i]^2-b[i]^2) end

@show model print(model) optimize!(model) @show termination_status(model) @show primal_status(model) @show dual_status(model) @show objective_value(model)

@show value(x) @show value(y) @show value(R) @show value(z)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting Principles

Authors: Jerry J. Weygandt, Paul D. Kimmel, Donald E. Kieso

9th Edition

978-0470533475

Students also viewed these Accounting questions

Question

Find α and β that solve the following equation: 1 2 2 1

Answered: 1 week ago

Question

Excel caculation on cascade mental health clinic

Answered: 1 week ago