binvar or sdpvar as an input variable of a function #1330
Unanswered
ellensonny
asked this question in
General discussion
Replies: 1 comment 4 replies
-
I don't see the graph command ever could work on something which involves sdpvars. max/min etc are function which can be modelled using LP representations etc which is what YALMIP derives when you send an sdpvar to it. graph is a functionality which does a lot of manipulations, checks, and stuff, and doesn't just compute something which can be represented directly. you can of course represent the same thing using sdpvars, but you cannot use the high-level command graph to do it (i.e. you most likely use the command sparse with suitable indicies as it sounds like you simply want to create some sparse parameterization) |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The problem occurs when I use binvar or sdpvar variables as input to the graph function. Some other functions that come with matlab, such as sum and max, can allow binvar or sdpvar as input parameters. What is the reason for this? how to solve this kind of problem.
code:
clear;clc;
yalmip('clear');
rng default
mp=case118;
F=randi([0 2],1,118);
% 定义变量
branch=binvar(1,186);
bus=binvar(1,118);
beta=binvar(1,118);
point=1:118;
load_point=beta.*point;
load_point=load_point(load_point~=0);
start=mp.branch(:,1)'.*branch;
start=start(start~=0);
finish=mp.branch(:,2)'.*branch;
finish=finish(finish~=0);
G=graph(start,finish);
%%约束条件
cons=[cons conncomp(G)==1];
cons=[cons ismember(load_point,[start finish])];
Beta Was this translation helpful? Give feedback.
All reactions