Home > matpower7.1 > mp-opt-model > lib > @opt_model > is_mixed_integer.m

is_mixed_integer

PURPOSE ^

IS_MIXED_INTEGER Return true if model is mixed integer, false otherwise.

SYNOPSIS ^

function TorF = is_mixed_integer(om)

DESCRIPTION ^

IS_MIXED_INTEGER  Return true if model is mixed integer, false otherwise.
   TorF = OM.IS_MIXED_INTEGER()

   Outputs:
       TorF : 1 or 0, indicating whether any of the variables are
              binary or integer

   See also OPT_MODEL

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function TorF = is_mixed_integer(om)
0002 %IS_MIXED_INTEGER  Return true if model is mixed integer, false otherwise.
0003 %   TorF = OM.IS_MIXED_INTEGER()
0004 %
0005 %   Outputs:
0006 %       TorF : 1 or 0, indicating whether any of the variables are
0007 %              binary or integer
0008 %
0009 %   See also OPT_MODEL
0010 
0011 %   MP-Opt-Model
0012 %   Copyright (c) 2020, Power Systems Engineering Research Center (PSERC)
0013 %   by Ray Zimmerman, PSERC Cornell
0014 %
0015 %   This file is part of MP-Opt-Model.
0016 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0017 %   See https://github.com/MATPOWER/mp-opt-model for more info.
0018 
0019 %   To do: Make this a property that gets set true whenever binary or
0020 %          integer vars are added to the problem.
0021 
0022 TorF = 0;
0023 for k = 1:length(om.var.order)
0024     t = om.var.data.vt.(om.var.order(k).name);
0025     if iscell(t)
0026         for j = 1:length(t(:))
0027             if any(t{j} ~= 'C')
0028                 TorF = 1;
0029                 break;
0030             end
0031         end
0032     else
0033         if any(t ~= 'C')
0034             TorF = 1;
0035             break;
0036         end
0037     end
0038 end

Generated on Fri 09-Oct-2020 11:21:31 by m2html © 2005