-
Notifications
You must be signed in to change notification settings - Fork 0
New cones: DD, SDD, DSOS, SDSOS. #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
1. Current implementation only allows a single DD cone in the free variables, not the constraints 2. Due to the creation of new variables and a change of cones, two additional properties in options class were added: they inherit the upper and lower bounds of the new linear cones that are not requested for the user to define
1. Fix bug related to DD cone of size 1. 2. Ensure that only SX is leveraged
The cones description added were DD, SDD and for the polynomial cones DSOS and SDSOS
Add to sdpopt the cones used at the sdp level, namely, the 'lin', 'psd' and 'dd'
Due to the additional decision variables created from building the DD and constraints, a mapping is defined and is used aposteriori to extract the solution of the original problem formulation from the solved sdp
Make both problems use the same solver for a coherent comparison
1. add comments; 2. add SDD feasible region; 3. add SDD program
This file in this commit is similar to the one related to the DD. currently this file performs SDD to linear as if the constraint was DD.
The function sdd_reduced is added in the file to call the re-building to LP/SOCP.
Check instead if the variable args which is only nonempty if either DD/SDD was present in the original problem formulation.
The solutions obtained are from solving the SDP by either using PSD, DD or SDD cones.
This versio works for a single SDD constraint on the SDP level.
@@ -61,19 +119,18 @@ | |||
% constraint function (vectorized) | |||
sdp_g = sdp.g(:); | |||
|
|||
if isfield(sdp,'derivatives') | |||
if isfield(sdp,'derivatives') && isempty(fieldnames(args)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the second clause works as intended, for even if there are no DD/SDD constraints, the struct args
has the fields dd_lbx
etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see commit (f245d36) for the requested changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it looks, but there are a few critical issues with the interface of the SDP solver and its embedding into the SOS solver that must be addressed.
if Nsds~=0 || Msds~=0 | ||
sdpopt.Kx.sdd = [Ksdp_x_s(Nds+Ns+1:end); Ksdp_g_s(Mds+Ms+1:end)]; | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't you also have to reorder the SDP variables and constraints to ensure PSD < DD < SDD?
…ous computed derivatives. The flag is one if there was some reduction/relaxation to DD/SDD.
instead of verifying the existence of the field, it verifies if the field is empty.
… the SOS level. 1. The output of the SDP is equal to the original setting and not from the generated SDP after DD/SDD reduction/relaxation.
@@ -61,19 +118,18 @@ | |||
% constraint function (vectorized) | |||
sdp_g = sdp.g(:); | |||
|
|||
if isfield(sdp,'derivatives') | |||
if isfield(sdp,'derivatives') && ~flag_reduced |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use the map above to update pre-computed derivatives?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about A
? Why can't we do the same here?
% output function | ||
obj.ghan = casadi.Function('g', ... | ||
{p x cost lam_a lam_x}, ... | ||
{x fx gx lam_x lam_a nan(size(p))}, ... | ||
{obj.map.x*x fx obj.map.g*gx obj.map.x*lam_x obj.map.g*lam_a nan(size(p))}, ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check whether the dual variables can simply be mapped by the same mapping as the primal variables/constraints.
opts.Kc = setfield(opts.Kc,'psd', [Mpsd, repmat(2, 1, length(vertcat(M_g{:}))/3+length(vertcat(M_x{:}))/3)]); | ||
|
||
% map from new sdp.x to old | ||
map.x = jacobian(x_original, sdp.x); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given the structure of sdp.x
, isn't that map simply blkdiag(speye(Nlin), sparse(0,m), speye(n-Nlin)
, where m
is the number of elements in vertcat(M_g{:}, M_x{:})
and n
is the number of elements in the original sdp.x
.
opts.Kc = setfield(opts.Kc,'lin',Mlin); | ||
|
||
% map from new sdp.x to old | ||
map.x = jacobian(x_original, sdp.x); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given the structure of sdp.x, isn't that map simply blkdiag(speye(Nlin), sparse(0,m), speye(n-Nlin), where m is the number of elements in vertcat(M_g{:}, M_x{:}) and n is the number of elements in the original sdp.x.
It appears that |
I was referring to the construction of
vs. (for SDD):
It appears that the maps in both cases are equal, which seems counterintuitive. |
This pull request introduces and implements NEW cone options:
dd
sdd
dsos
sdsos
Pseudo example of cones definition while using
casos.sdpsol
:In the case of relaxing a SOS program using
casos.sossol
:Note: This pull request answers issue #74
Key contributions include:
(see the attached file debug_dd_sdd.zip that contains additional programs to verify the correct performance of the new cones)
Example of new cones:
dsos
orsdsos
:dd
) or SDD (sdd
):