source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/extras/binvar.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 1002 bytes
Line 
1function sys = binvar(varargin)
2%BINVAR Create symbolic binary variable
3%
4%   BINVAR works exactly as SDPVAR, with the only difference that
5%   the elements in the variable automatically will be constrained
6%   to be binary (0/1) when an optimization problem is solved.
7%
8%   See also INTVAR, SDPVAR, BINARY, INTEGER
9
10% Author Johan Löfberg
11% $Id: binvar.m,v 1.8 2006/05/17 13:22:29 joloef Exp $
12
13all_variable_names = 1;
14i = 1;
15
16% check for command line syntax
17while all_variable_names & i<=nargin
18    all_variable_names = all_variable_names & isvarname(varargin{i});
19    i = i + 1;
20end
21
22if all_variable_names
23    for k = 1:nargin
24        varname = varargin{k};
25        assignin('caller',varname,binvar(1,1));
26    end
27else
28    sys = sdpvar(varargin{:});
29    if isa(sys,'cell')
30        for i = 1:length(sys)
31            yalmip('setbinvariables',[yalmip('binvariables') getvariables(sys{i})]);
32        end
33    else
34        yalmip('setbinvariables',[yalmip('binvariables') getvariables(sys)]);
35    end
36end
Note: See TracBrowser for help on using the repository browser.