For alternate optimization, I used SCA to deal with the non-convex parts of the constraint terms. The final result satisfies the constraint, but does not match the target at all (least squares problem)

Now I have a constrained least squares problem with two variables to be solved, and I adopt the method of alternating optimization. The first subproblem is an unconstrained least squares problem, and I directly solve the pseudo-inverse to get the optimal solution. The second subproblem has a transverse modulus constraint, resulting in non-convex parts in the constraint term, so I conduct SCA for this part. I found that in the process of iteration, the objective function is constantly decreasing, and finally approaches a value, and the obtained solution also satisfies all constraints. But when I brought it in, it was completely different from the shape I wanted it to be.

The second subquestion is this:

and here’s my code:

Here are the results of the last iteration:
Calling Mosek_2 10.0.27: 1784 variables, 736 equality constraints
For improved efficiency, Mosek_2 is solving the dual problem.

MOSEK Version 10.0.27 (Build date: 2022-11-1 14:42:52)
Copyright © MOSEK ApS, Denmark WWW: mosek.com
Platform: Windows/64-X86

Problem
Name :
Objective sense : minimize
Type : CONIC (conic optimization problem)
Constraints : 736
Affine conic cons. : 0
Disjunctive cons. : 0
Cones : 248
Scalar variables : 1784
Matrix variables : 0
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries : 1 time : 0.00
Lin. dep. - tries : 1 time : 0.03
Lin. dep. - number : 0
Presolve terminated. Time: 0.06
Problem
Name :
Objective sense : minimize
Type : CONIC (conic optimization problem)
Constraints : 736
Affine conic cons. : 0
Disjunctive cons. : 0
Cones : 248
Scalar variables : 1784
Matrix variables : 0
Integer variables : 0

Optimizer - threads : 32
Optimizer - solved problem : the primal
Optimizer - Constraints : 724
Optimizer - Cones : 248
Optimizer - Scalar variables : 1776 conic : 1296
Optimizer - Semi-definite variables: 0 scalarized : 0
Factor - setup time : 0.00 dense det. time : 0.00
Factor - ML order time : 0.00 GP order time : 0.00
Factor - nonzeros before factor : 5772 after factor : 5772
Factor - dense dim. : 8 flops : 1.18e+05
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 1.0e+00 2.0e+00 2.5e+02 0.00e+00 2.440000000e+02 -2.000000000e+00 1.0e+00 0.11
1 1.4e-01 2.8e-01 3.7e+01 -4.20e-01 7.388184814e+01 -3.000214458e+00 1.4e-01 0.28
2 1.8e-02 3.6e-02 1.7e+00 1.03e+00 9.418732738e+00 -5.054525739e-01 1.8e-02 0.28
3 3.4e-03 6.8e-03 1.3e-01 9.84e-01 1.633772986e+00 -2.134601838e-01 3.4e-03 0.30
4 5.5e-04 1.1e-03 7.8e-03 1.01e+00 1.577288589e-01 -1.374867191e-01 5.5e-04 0.30
5 1.1e-05 2.1e-05 2.1e-05 1.00e+00 -1.203515961e-01 -1.260844819e-01 1.1e-05 0.31
6 3.8e-07 7.6e-07 1.5e-07 9.97e-01 -1.257085713e-01 -1.259148595e-01 3.8e-07 0.31
7 9.5e-08 1.9e-07 2.3e-08 7.38e-01 -1.258715685e-01 -1.259326471e-01 9.4e-08 0.33
8 9.5e-08 1.9e-07 2.3e-08 5.92e-01 -1.258715692e-01 -1.259326472e-01 9.4e-08 0.34
9 9.5e-08 1.9e-07 2.3e-08 6.78e-01 -1.258716476e-01 -1.259326678e-01 9.4e-08 0.36
10 9.5e-08 1.9e-07 2.3e-08 6.78e-01 -1.258716476e-01 -1.259326678e-01 9.4e-08 0.38
11 9.5e-08 1.9e-07 2.3e-08 6.78e-01 -1.258716476e-01 -1.259326678e-01 9.4e-08 0.39
12 9.5e-08 1.9e-07 2.3e-08 6.68e-01 -1.258716476e-01 -1.259326679e-01 9.4e-08 0.41
13 9.5e-08 1.9e-07 2.3e-08 6.68e-01 -1.258716476e-01 -1.259326679e-01 9.4e-08 0.42
14 9.5e-08 1.9e-07 2.3e-08 6.68e-01 -1.258716476e-01 -1.259326679e-01 9.4e-08 0.44
15 4.6e-08 9.1e-08 7.4e-09 1.00e+00 -1.259129234e-01 -1.259424194e-01 4.6e-08 0.45
16 2.2e-08 3.7e-08 1.9e-09 1.00e+00 -1.259424664e-01 -1.259544292e-01 1.8e-08 0.45
17 2.2e-08 3.7e-08 1.9e-09 1.00e+00 -1.259424704e-01 -1.259544316e-01 1.8e-08 0.47
18 2.0e-08 2.7e-08 1.2e-09 1.00e+00 -1.259506435e-01 -1.259595199e-01 1.4e-08 0.48
19 2.0e-08 2.7e-08 1.2e-09 1.00e+00 -1.259506440e-01 -1.259595203e-01 1.4e-08 0.50
20 2.0e-08 2.7e-08 1.1e-09 1.00e+00 -1.259511582e-01 -1.259598648e-01 1.4e-08 0.52
21 2.0e-08 2.7e-08 1.1e-09 1.00e+00 -1.259512853e-01 -1.259599501e-01 1.4e-08 0.52
22 2.0e-08 2.7e-08 1.1e-09 1.00e+00 -1.259512855e-01 -1.259599503e-01 1.4e-08 0.53
23 2.0e-08 2.7e-08 1.1e-09 1.00e+00 -1.259512861e-01 -1.259599506e-01 1.4e-08 0.55
24 2.0e-08 2.7e-08 1.1e-09 1.00e+00 -1.259512901e-01 -1.259599533e-01 1.4e-08 0.56
25 2.0e-08 2.7e-08 1.1e-09 1.00e+00 -1.259512940e-01 -1.259599560e-01 1.4e-08 0.58
26 2.0e-08 2.7e-08 1.1e-09 1.00e+00 -1.259513019e-01 -1.259599613e-01 1.4e-08 0.59
27 2.0e-08 2.7e-08 1.1e-09 1.00e+00 -1.259513019e-01 -1.259599613e-01 1.4e-08 0.61
28 1.9e-08 2.6e-08 1.1e-09 1.00e+00 -1.259514285e-01 -1.259600464e-01 1.4e-08 0.62
29 1.9e-08 2.6e-08 1.1e-09 1.00e+00 -1.259514287e-01 -1.259600466e-01 1.4e-08 0.64
30 1.9e-08 2.6e-08 1.1e-09 1.00e+00 -1.259514292e-01 -1.259600469e-01 1.4e-08 0.66
31 1.9e-08 2.6e-08 1.1e-09 1.00e+00 -1.259514293e-01 -1.259600470e-01 1.4e-08 0.67
Optimizer terminated. Time: 0.78

Interior-point solution summary
Problem status : PRIMAL_AND_DUAL_FEASIBLE
Solution status : OPTIMAL
Primal. obj: -1.2595142926e-01 nrm: 7e+00 Viol. con: 1e-07 var: 0e+00 cones: 0e+00
Dual. obj: -1.2596004697e-01 nrm: 1e+00 Viol. con: 0e+00 var: 7e-08 cones: 0e+00
Optimizer summary
Optimizer - time: 0.78
Interior-point - iterations : 32 time: 0.69
Basis identification - time: 0.00
Primal - iterations : 0 time: 0.00
Dual - iterations : 0 time: 0.00
Clean primal - iterations : 0 time: 0.00
Clean dual - iterations : 0 time: 0.00
Simplex - time: 0.00
Primal simplex - iterations : 0 time: 0.00
Dual simplex - iterations : 0 time: 0.00
Mixed integer - relaxations: 0 time: 0.00


Status: Solved
Optimal value (cvx_optval): +0.12596