考虑阶梯式碳交易机制与电制氢的综合能源系统热电优化附Matlab代码

本文涉及的产品
传统型负载均衡 CLB,每月750个小时 15LCU
EMR Serverless StarRocks,5000CU*H 48000GB*H
网络型负载均衡 NLB,每月750个小时 15LCU
简介: 考虑阶梯式碳交易机制与电制氢的综合能源系统热电优化附Matlab代码

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法  神经网络预测雷达通信 无线传感器

信号处理图像处理路径规划元胞自动机无人机

⛄ 内容介绍


"双碳"背景下,为提高能源利用率,优化设备的运行灵活性,进一步降低综合能源系统(IES)的碳排放水平,提出一种IES低碳经济运行策略.首先考虑IES参与到碳交易市场,引入阶梯式碳交易机制引导IES控制碳排放;接着细化电转气(P2G)的两阶段运行过程,引入电解槽、甲烷反应器、氢燃料电池(HFC)替换传统的P2G,研究氢能的多方面效益;最后提出热电比可调的热电联产、HFC运行策略,进一步提高IES的低碳性与经济性.基于此,构建以购能成本、碳排放成本、弃风成本最小的低碳经济运行目标,将原问题转化为混合整数线性问题,运用CPLEX商业求解器进行求解,通过设置多个运行情景,对比验证了所提策略的有效性.

⛄ 部分代码

classdef Cplex < dynamicprops

  % Cplex The math programming solver.

  %   This class stores MP models and provides methods for its solution

  %   analysis and manipulation.

  %   Cplex properties:

  %     Model          The Model

  %     Param          The Parameters to solve the Model

  %     DisplayFunc    The display function handle of the Model

  %     Conflict       A dynamic property of the Cplex class that

  %                    represents the Conflict of the model,

  %                    it will be generated after refineConflict.

  %                    If the Model is MIP, refineMipStartConflict can

  %                    generate Conflict as well.

  %                    use cplex.findprop('Conflict').delete to remove

  %                    this property

  %     InfoCallback   A dynamic property, an informational callback is

  %                    a user-written routine that enables your

  %                    application to access

  %                    information about the current mixed integer

  %                    programming (MIP) optimization without sacrificing

  %                    performance and without interfering in the

  %                    search of the solution space.

  %                    use cplex.findprop('InfoCallback').delete to remove

  %                    this property

  %     Start          A dynamic property of the Cplex class that

  %                    represents the Start of the LP or QP model,

  %                    it will be generated after solving.

  %                    It also can be given before

  %                    solving to help CPLEX(R) get a Solution. It is

  %                    optional.

  %                    use cplex.findprop('Start').delete to remove

  %                    this property

  %     MipStart       A dynamic property of the Cplex class that

  %                    represents the MipStart of the MIP model;

  %                    it will be generated after solving

  %                    or populating. It also can be given before

  %                    solving to help CPLEX get a Solution. It is

  %                    optional.

  %                    use cplex.findprop('MipStart').delete to remove

  %                    this property

  %     Solution       A dynamic property of the Cplex class that

  %                    represents the solution of the model,

  %                    it will be generated after solving or feasopting.

  %                    If the Model is MIP, populate can generate

  %                    Solution as well.

  %                    use cplex.findprop('Solution').delete to remove

  %                    this property

  %      Order         A dynamic property of the Cplex class that

  %                    represents the priority order.

  %   Cplex methods:

  %     Cplex          The constructor for Cplex objects.

  %     addCols        Adds columns to the problem object.

  %     addIndicators  Adds indicator constraints to the specified problem.

  %     addQCs         Adds a quadratic constraint or quadratic

  %                    constraint set to the problem object.

  %     addRows        Adds constraints to the problem object.

  %     addSOSs        Adds information about special ordered sets (SOS)

  %                    to a problem object of type MILP, MIQP, or MIQCP.

  %     delCols        Removes the specified columns from the problem

  %                    object.

  %     delRows        Removes the specified rows from the problem

  %                    object.

  %     feasOpt        Computes a minimum-cost relaxation of the righthand

  %                    side values of constraints or bounds on variables

  %                    in order to make an infeasible problem feasible.

  %     getChgParam    Returns a struct of parameters which are not set at

  %                    their default values.

  %     getProbType    Accesses the problem type.

  %     getVersion     Returns the version of CPLEX.

  %     populate       Generates multiple Solutions to a mixed integer

  %                    programming (MIP) problem.

  %     readBasis      Reads a basis from a BAS file and copies that basis

  %                    into the Start property of the Model.

  %     readMipStart   Reads a MST file and copies the information of all

  %                    the MIP starts contained in this file into the

  %                    problem object.

  %     readModel      Reads a CPLEX Model from a file and copies it into

  %                    the problem object.

  %     readOrder      Reads a priority order file.

  %     readParam      Reads parameter names and settings from the file

  %                    specified by filename and copies them into the

  %                    problem object.

  %     refineConflict Identifies a minimal conflict for the infeasibility

  %                    of the linear constraints and the variable bounds in

  %                    the current linear problem.

  %     refineMipStartConflict

  %                    Refines a conflict in order to determine why a

  %                    given MIP start is not feasible in linear

  %                    problem.

  %     setDefault     Resets all CPLEX parameters and settings to default

  %                    values.

  %     solve          Solves the current model in the problem object.

  %     terminate      Interrupts an ongoing solve() method invocation.

  %     tuneParam      Tunes the Parameters of the environment for improved

  %                    optimizer performance on the problem object.

  %     writeBasis     Writes the most current basis associated with the

  %                    problem object to a file.

  %     writeConflict  Writes a conflict file.

  %     writeMipStart  Writes a range of MIP starts of the problem

  %                    object to a file in MST format.

  %     writeModel     Writes the model of the invoking object to a

  %                    file.

  %     writeOrder     Writes a priority order file.

  %     writeParam     Writes the parameter names and their current settings

  %                    into the file specified by name for all the CPLEX

  %                    parameters that are not currently set at their

  %                    default.

  %

  %   See also

  %   Properties:

  %      Model, Param, DisplayFunc

  %   Methods:

  %      Cplex

  %      getVersion     getProbType     getChgParam

  %      readBasis      writeBasis      readMipStart     writeMipStart

  %      readModel      writeModel      writeConflict

  %      readParam      writeParam      tuneParam        setDefault

  %      addCols        addRows         delRows          delCols

  %      addIndicators  addQCs          addSOSs          readOrder

  %      solve          feasOpt         populate         writeOrder

  %      refineConflict terminate       refineMipStartConflict

 

% ---------------------------------------------------------------------------

% File: Cplex.m

% ---------------------------------------------------------------------------

% Licensed Materials - Property of IBM

% 5725-A06 5725-A29 5724-Y48 5724-Y49 5724-Y54 5724-Y55

% Copyright IBM Corporation 2008, 2011. All Rights Reserved.

%

% US Government Users Restricted Rights - Use, duplication or

% disclosure restricted by GSA ADP Schedule Contract with

% IBM Corp.

% ---------------------------------------------------------------------------

  properties

     

     

     % Model The Model used by the math programming solver.

     %   Model fields:

     %     name     String Name of the Model.

     %     sense    String that specifies whether the problem is a

     %              minimization or maximization problem.

     %     obj      Double column vector

     %              representing objective function coefficients.

     %     lb       Double column vector

     %              representing lower bound on each of the variables.

     %     ub       Double column vector

     %              representing upper bound on each of the variables.

     %     A        Constraint matrix.

     %     lhs      Double column vector

     %              representing lefthand side value for each constraint

     %              in the constraint matrix.

     %     rhs      Double column vector

     %              representing righthand side value for each constraint

     %              in the constraint matrix.

     %

     %   Optional fields of cplex.Model:

     %     objname   String representing the name of the objective.

     %     colname   Char matrix representing the names of the matrix

     %               columns or, equivalently, the variable names.

     %               Set colname by cplex.Model.colname(1,:) = 'mycolname'

     %     rowname   Char matrix representing the names of the matrix

     %               rows or, equivalently, the constraint names.

     %               Set colname by cplex.Model.rowname(1,:) = 'myrowname'

     %     ctype     String containing the type of each column in the

     %               constraint matrix, specifying whether a variable

     %               is continuous, integer, binary, semi-continuous or

     %               semi-integer. The possible char vales are

     %               'B','I','C','S','N'. Set ctype(j) to 'B', 'I','C',

     %               'S', or 'N' to indicate that x(j) should be binary,

     %               general integer, continuous, semi-continuous or

     %               semi-integer (respectively).

     %

     %     sos     Struct vector representing the SOSs.

     %     sos(i).name   (Optional) String representing the name of sos(i).

     %     sos(i).type   Type of sos(i), char '1' or '2'.

     %     sos(i).ind    Double column vector representing

     %                   the index of SOS to be added.

     %     sos(i).wt     Double column vector representing

     %                   the weights of the SOS to be added.

     %     Q      Quadratic objective matrix.

     %     qc     Struct vector representing the quadratic constraints.

     %     qc(i).name   (Optional) String representing the name of qc(i).

     %     qc(i).sense   Sense of quadratic constraint, char 'L' or 'G'.

     %     qc(i).a       Double column vector representing

     %                   the linear part of the quadratic constraint.

     %     qc(i).rhs     Righthand side term for the constraint.

     %     qc(i).Q       matrix representing the

     %                   Quadratic part of the quadratic constraint.

     %

     %     indicator Struct vector representing the indicator constraints.

     %     indicator(i).name       (Optional) String representing the name

     %                             of indicator(i).

     %     indicator(i).variable   Binary variable that acts as the

     %                             indicator for the constraint.

     %     indicator(i).complement Boolean value that specifies whether the

     %                             indicator variable is complemented.

     %     indicator(i).a      Double column representing

     %                         the linear portion of the indicator constraint.

     %     indicator(i).rhs    Righthand side value for the linear portion

     %                         of the indicator constraint.

     %     indicator(i).sense  char 'L','G' or 'E'.

     %     See also addIndicators, addSOSs, addQCs.

     Model;

     

     % Param Parameters for the math programming solver.

     %   The behavior of CPLEX is controlled by a variety of parameters that

     %   can be accessed and modified by the user. Each parameter is a field

     %   of the Cplex.Param structure.

     %

     %   Example:

     %     set Parameter:

     %       cplex.Param.lpmethod.Cur = 5

     %     get Parameter:

     %       cplex.Param.lpmethod.Cur

     %

     %   For the usage of each parameter please refer to the IBM ILOG CPLEX

     %   Parameters Reference Manual

     Param;

     

     % DisplayFunc   The Display Function of the Model

     %   The default value of this property is @disp, the function handle

     %   of the display function in MATLAB. With the default, all of the

     %   log information from CPLEX will be displayed. If the

     %   Cplex.DisplayFunc property is set to empty, then the log

     %   information from CPLEX will not be displayed. In addition,

     %   users can write a custom DisplayFunc to control the output

     DisplayFunc;

  end%end of properties

  properties (Hidden = true)

     Handle;

     Version;

  end%end of properties

  properties (Constant = true, Hidden = true)

     % Default is a struct contain the hierarchy of Params and Quality

     % And it is a Constant property in Cplex class, which mean it is a

     % property belong to Cplex class, not belong to any Cplex object,

     % then we can reuse Default in each Cplex object, which like the

     % static property in C++ class

     Default = cplexlink124 ([], 'getParamHierarchy');

  end%end of properties

     function out = display(cpx)

        % Overwrite  build-in display function

        % See also Cplex.

     end %end of function

     function out = terminate(cpx)

        % Cplex.terminate  Interrupts an ongoing solve() method invocation.

        %   Use this method to implement stop buttons for a GUI.

        % See also Cplex.

     end %end of function

     function out = Cplex(modelname, varargin)

        % Cplex  The constructor for Cplex objects.  The constructor takes one

        % optional argument to specify the problem name or a

        % problem structure of one of the forms described in each toolbox

        % function. Note that if the problem structure contains information

        % for a least squares problem (C and d) it may not contain a quadratic

        % or linear objective (H and f).

        %

        %     Example:

        %       prob.f = 1

        %       prob.Aineq = 1;

        %       prob.bineq = 10;

        %       prob.ub    = 5;

        %       cplex = Cplex(prob);

        %

        %   See also Cplex.

     end %end of function

     function out = getVersion(cpx)

        % Cplex.getVersion  Returns the Version of CPLEX

        %

        %   Example:

        %     cplex.getVersion()

        %

        %   See also Cplex.

     end %end of function

     function out = getChgParam(cpx)

        % Cplex.getChgParam  Returns a struct of parameters which are not

        % set at their default values.

        %

        %   Example:

        %     cplex.getChgParam()

        %

        %   See also Cplex.

     end %end of function

     function out = readModel(cpx, filename)

        % Cplex.readModel  Reads a CPLEX Model from a file and copies it into

        %   the invoking object.

        %

        %   Example:

        %     cplex.readModel('myprob.lp')

        %

        %   See also the example lpex2.m in the examples directory.

        %

        %   Parameters:

        %     filename    string

        %            The filename must end in one of these suffixes: .lp,

        %            .mps, .sav and .gz.

        %

        %   See also Cplex.

     end %end of function

     function out = writeModel(cpx, filename)

        % Cplex.writeModel  Writes the CPLEX Model of the invoking object to a

        %   file.

        %

        %   Example:

        %     cplex.writeModel('myprob.lp')

        %

        %   See also the example lpex2.m in the examples directory.

        %

        %   Parameters:

        %     filename    string

        %            A file with one of the formats

        %              MPS     MPS format

        %              LP     CPLEX LP format with names modified to

        %                   conform to LP format

        %              REW     MPS format with all names changed to

        %                   generic names

        %              RMP     MPS format, with all names changed to

        %                   generic names

        %              RLP     LP format, with all names changed to

        %                   generic names

        %

        %   See also Cplex.

     end %end of function

     function out = writeConflict(cpx, filename)

        % Cplex.writeConflict  Writes a Conflict file named filename.

        %

        %   Example:

        %     cplex.writeConflict('Conflict.lp')

        %

        %   Parameters:

        %     filename    string

        %            A file in the .lp format.

        %

        %   See also Cplex.

     end %end of function

     function out = readOrder(cpx, filename)

        % Cplex.readOrder  Reads a priority order file from the file

        % specified by filename.

        %

        %   Example:

        %     cplex.readOrder('Order.ord')

        %

        %   Parameters:

        %     filename    string

        %            A file in the .ord format.

        %

        %   See also Cplex.

     end %end of function

     function out = writeOrder(cpx, filename)

        % Cplex.writeOrder  Writes a priority order into the file specified

        % by filename

        %

        %   Example:

        %     cplex.writeOrder('Order.ord')

        %

        %   Parameters:

        %     filename    string

        %            A file in the .ord format.

        %

        % See also Cplex.

     end %end of function

     function out = readParam(cpx, filename)

        % Cplex.readParam   Reads parameters names and settings from the file

        %   specified by filename and copies them into the Cplex object.

        %

        %   This routine reads and copies files in the PRM format, as

        %   created by writeParam.

        %   The PRM format is documented in the IBM ILOG CPLEX File Formats

        %   manual.

        %

        %   Example:

        %     cplex.readParam('myprob.prm')

        %

        %   Parameters:

        %     filename    string

        %            A file in the .prm format.

        %

        %   See also Cplex.

     end %end of function

     function out = writeParam(cpx, filename)

        % Cplex.writeParam   Writes the Parameter names and their current

        %   settingsinto the file specified by filename for all the CPLEX

        %   parameters that are not currently set at their default.

        %

        %   Example:

        %     cplex.writeParam('myprob.prm')

        %

        %   Parameters:

        %     filename    string

        %            A file in the .prm format.

        %

        %   See also Cplex.

     end %end of function

     function out = readBasis(cpx, filename)

         % Cplex.readBasis   Reads a basis from a BAS file and copies that basis

        %   into a Cplex problem object.

        %

        %   The Parameter advance must be set to 1 (one), its default value,

        %   or 2(two)in order for the basis to be used for starting a

        %   subsequent optimization.

        %

        %   Example:

        %     cplex.readBasis('myprob.bas')

        %

        %   Parameters:

        %     filename    string

        %            A file in the .bas format.

        %

        %   See also Cplex.

     end %end of function

     function out = writeBasis(cpx, filename)

        % Cplex.writeBasis

        %   Writes the most current basis associated with a Cplex

        %   problem object to a file.

        %

        %   The file is saved in BAS format which corresponds to the industry

        %   standard MPS insert format for bases.

        %

        %   When writeBasis is invoked, the current basis is written

        %   to a file.

        %   This routine does not remove the basis from the problem

        %   object.

        %

        %   Example:

        %     cplex.writeBasis('myprob.bas')

        %

        %   Parameters:

        %     filename    string

        %            A file in the .bas format.

        %

        %   See also Cplex.

     end %end of function

     function out = readMipStart(cpx, filename)

        % Cplex.readMipStart  Reads a MST file and copies the information of

        % all the MIP starts contained in this file into a Cplex problem

        % object.

        %

        %   The parameter advance must be set to 1 (one), its default value,

        %   or 2(two) in order for the MIP starts to be used.

        %

        %   Example:

        %     cplex.readMipStart('myprob.mst')

        %

        %   Parameters:

        %     filename    string

        %            A file in the .mst format.

        %

        %   See also Cplex.

     end %end of function

     function out = writeMipStart(cpx, filename)

        % Cplex.writeMipStart  Writes a range of MIP starts of a Cplex

        %   problem object to a file in MST format.

        %

        %   The MST format is an XML format and is documented in the

        %   stylesheet solution.xsl and schema solution.xsd in the

        %   include directory of the CPLEX distribution. IBM ILOG CPLEX

        %   File Formats also documents this format briefly.

        %

        %   Example:

        %     cplex.writeMipStart('myprob.mst')

        %

        %   Parameters:

        %     filename    string

        %            A file in the .mst format.

        %

        %   See also Cplex.

     end %end of function

     function out = solve(cpx)

        % Cplex.solve  Solves the current model in the invoking object.

        %

        % After a call to solve, the field Solution of the invoking

        % object will be populated as well as the field Start for an LP

        % or MipStart for a MIP.

        %

        %   Example:

        %     cplex.solve()

        %

        %   See also the example lpex1.m in the examples directory.

        %

        %   See also Cplex.

     end %end of function

     function out = setDefault(cpx)

        % Cplex.setDefault  Resets all CPLEX parameters and settings to

        %   default values

        %

        %   Example:

        %     cplex.setDefault()

        %

        %   See also Cplex.

     end %end of function

     function out = populate(cpx)

        % Cplex.populate  Generates multiple solutions to a mixed integer

        %   programming (MIP) problem.

        %

        % After a call to solve, the field Solution of the invoking

        % object will be populated as well as the field Start for an LP

        % or MipStart for a MIP.

        %

        %   Example:

        %     cplex.populate()

        %

        %   See also Cplex.

     end %end of function

     function out = feasOpt(cpx, preflhs, prefrhs, preflb, prefub)

        % Cplex.feasOpt  Computes a minimum-cost relaxation of the righthand

        %   side values of constraints or bounds on variables in order

        %   to make an infeasible problem feasible.

        %

        %   Example:

        %     cplex.feasOpt(preflhs, prefrhs, preflb, prefub)

        %     If one parameter is empty, set it to [].

        %     prefrhs=[]

        %     cplex.feasOpt(preflhs, prefrhs, preflb, prefub)

        %

        %   Parameters:

        %     preflhs    double column vector

        %                The length must be at least equal to the

        %                number of rows in the problem. An empty

        %                vector may be specified if no range values

        %                are allowed to be relaxed or none are

        %                present in the active problem.

        %                When not empty, the vector specifies the

        %                preference values that determine the cost

        %                of relaxing each range.

        %     prefrhs    double column vector

        %                The length must be at least equal to the

        %                number of rows in the problem. An empty

        %                vector may be specified if no rhs values

        %                are allowed to be relaxed.

        %                When not empty, the vector specifies the

        %                preference values that determine the cost

        %                of relaxing each constraint.

        %     preflb     double column vector

        %                The length must be at least equal to the

        %                number of columns in the problem. An empty

        %                vector may be passed if no lower bound of

        %                any variable is allowed to be relaxed.

        %                When not NULL, the vector specifies the

        %                preference values that determine the cost

        %                of relaxing each lower bound.

        %     prefub     double column vector

        %                The length must be at least equal to the

        %                number of columns in the problem. An empty

        %                vector may be passed if no upper bound of

        %                any variable is allowed to be relaxed.

        %                When not empty, the vector specifies the

        %                preference values that determine the cost

        %                of relaxing each upper bound.

        %

        %   Parameter FeasOptMode values:

        %   0   Minimize the sum of all required relaxations in first

        %       phase only; default

        %   1   Minimize the sum of all required relaxations in first

        %       phase and execute second phase to find optimum among

        %       minimal relaxations

        %   2   Minimize the number of constraints and bounds requiring

        %       relaxation in first phase only

        %   3   Minimize the number of constraints and bounds requiring

        %       relaxation in first phase and execute second phase to

        %       find optimum among minimal relaxations

        %   4   Minimize the sum of squares of required relaxations in

        %       first phase only

        %   5   Minimize the sum of squares

        %       of required relaxations in first phase and execute

        %       second phase to find optimum among minimal relaxations

        %

        %    It can minimize the weighted sum of the penalties for relaxations

        %    (denoted by SUM).

        %    It can minimize the weighted number of relaxed bounds and

        %    constraints (denoted by INF).

        %    It can minimize the weighted sum of the squared penalties of the

        %    relaxations (denoted by QUAD).

        %

        %   See also Cplex.

     end %end of function

     function out = refineMipStartConflict(cpx,index)

        % Cplex.refineMipStartConflict  Refines a Conflict in order to

        %   determine why a given MIP start is not feasible in linear

        %   problem.

        %   In other words, this routine identifies a minimal conflict for the

        %   infeasibility of the linear constraints and bounds in a MIP start.

        %

        %   Example:

        %     cplex.refineMipStartConflict(index)

        %

        %   Parameters:

        %     index     Index of the MIP start among all the MIP starts

        %               associated with the problem.

        %   Returns:

        %     Cplex.Conflict  A struct vector with the fields:

        %           colind    Vector to receive the list of the

        %                     indices of the variables that

        %                     participate in the Conflict.

        %                     The length of the vector must not be

        %                     less than the number of columns in the

        %                     conflict.

        %                     If that number is not known, use the

        %                     number of columns in the problem

        %                     object instead.

        %         colbdstat   Vector to receive the Conflict

        %                     status of the columns.

        %                     Entry colbdstat(i) gives the status of

        %                     column colind(i).

        %                     The length of the vector must not be

        %                     less than the number of columns

        %                     in the Conflict.

        %                     If that number is not known, use the

        %                     number of columns in the problem

        %                     object instead.

        %          rowind     Vector to receive the list of the

        %                     indices of the constraints that

        %                     participate in the Conflict.

        %                     The length of the vector must not be

        %                     less than the number of rows in the

        %                     conflict.

        %                     If that number is not known, use the

        %                     total number of rows in the probem

        %                     object instead.

        %        rowbdstat    Vector to receive the Conflict

        %                     status of the rows.

        %                     Entry rowbdstat(i) gives the status of

        %                     row rowind(i).

        %                     The length of the vector must not be

        %                     less than the number of rows in the

        %                     conflict.

        %                     If that number is not known, use the

        %                     number of rows in the problem object

        %                     instead.

        %           status    Status of the Conflict

        %

        %   See also Cplex.

     end %end of function

     function out = refineConflict(cpx)

        % Cplex.refineConflict  Identifies a minimal Conflict for the

        %   infeasibility of the linear constraints and the variable bounds

        %   in the current

        %   linear problem.

        %

        %   Example:

        %     cplex.refineConflict()

        %

        %   Returns:

        %     Cplex.Conflict  A struct vector with the fields:

        %           colind    Vector to receive the list of the

        %                     indices of the variables that

        %                     participate in the Conflict.

        %                     The length of the vector must not be

        %                     less than the number of columns in the

        %                     Conflict.

        %                     If that number is not known, use the

        %                     number of columns in the problem

        %                     object instead.

        %         colbdstat   Vector to receive the Conflict

        %                     status of the columns.

        %                     Entry colbdstat[i] gives the status of

        %                     column colind[i].

        %                     The length of the vector must not be

        %                     less than the number of columns

        %                     in the Conflict.

        %                     If that number is not known, use the

        %                     number of columns in the problem

        %                     object instead.

        %          rowind     Vector to receive the list of the

        %                     indices of the constraints that

        %                     participate in the Conflict.

        %                     The length of the vector must not be

        %                     less than the number of rows in the

        %                     Conflict.

        %                     If that number is not known, use the

        %                     total number of rows in the problem

        %                     object instead.

        %         rowbdstat   Vector to receive the Conflict

        %                     status of the rows.

        %                     Entry rowbdstat[i] gives the status of

        %                     row rowind[i].

        %                     The length of the vector must not be

        %                     less than the number of rows in the

        %                     Conflict.

        %                     If that number is not known, use the

        %                     number of rows in the problem object

        %                     instead.

        %           status    Status of the Conflict.

        %

        %   See also Cplex.

     end %end of function

     function out = getProbType(cpx)

        % Cplex.getProbType  Accesses the problem type

        %

        %    Probtype     Meaning

        %     -1       Error: no problem or environment.

        %      0       Linear program; no quadratic data or ctype

        %              information stored.

        %      1       Problem with ctype information.

        %      3       Problem with ctype information, integer variables

        %              fixed.

        %      5       Problem with quadratic data stored.

        %      7       Problem with quadratic data and ctype information.

        %      8       Problem with quadratic data and ctype

        %              information, integer variables fixed.

        %     10       Problem with quadratic constraints.

        %     11       Problem with quadratic constraints and ctype

        %              information.

        %

        %   See also Cplex.

     end %end of function

     function out  = tuneParam(cpx,varargin)

        % Cplex.tuneParam  Tunes the Parameters of the environment for

        % improved optimizer performance on the specified problem object.

        %

        %   Example:

        %    cplex.tuneParam();

        %    cplex.tuneParam({cplex.Param.mip.strategy.heuristicfreq,...

        %                    cplex.Param.mip.strategy.branch)

        %    cplex.tuneParam(cplex.Param.mip.cuts)

        %

        %   See also Cplex

     end %end of function

     function out = addRows(cpx, lhs, A, rhs, rowname)

        % Cplex.addRows  Adds constraints to a specified Cplex problem object.

        %

        %   Example:

        %     cplex.addRows(lhs, A, rhs)

        %     cplex.addRows(lhs, A, rhs, rowname)

        %

        %   See also the example lpex1.m in examples directory

        %

        %   Parameters:

        %    lhs     double column vector

        %            Lefthand side term for each constraint to be

        %            added to the Cplex problem object.

        %    A       double matrix

        %            The constraint matrix to be added to the Cplex problem

        %            object by rows, it is optional.

        %    rhs     double column vector

        %            Righthand side term for each constraint to be added

        %            to the CPLEX problem object, it is a column vector.

        %    rowname char matrix

        %            Names of the new rows, it is optional.

        %

        %   See also Cplex

     end %end of function

     function out = addCols(cpx, obj, A, lb, ub, ctype, colname)

        % Cplex.addCols  Adds columns to a specified CPLEX problem object.

        %

        %   Example:

        %    cplex.addCols(obj)

        %    cplex.addCols(obj,A)

        %    cplex.addCols(obj,A,lb)

        %    cplex.addCols(obj,A,lb,ub)

        %    cplex.addCols(obj,A,lb,ub,ctype)

        %    cplex.addCols(obj,A,lb,ub,ctype,name)

        %

        %   See also the example lpex1.m in examples directory

        %

        %   Parameters:

        %    obj     double column vector

        %            Objective function coefficients of the new

        %            variables.

        %    A       double matrix

        %            Constraint matrix to be added to the Cplex problem

        %            object by columns.

        %            Optional.

        %    lb      double column vector

        %            Lower bound on each of the new variables.

        %            Optional.

        %            if lb is not provided,

        %            lb defaults to zeros(length(obj),1)

        %    ub      double column vector

        %            Upper bound on each of the new variables.

        %            Optional.

        %            if ub is not provided ub defaults to

        %            ones(length(obj),1)*Inf

        %    ctype   String

        %            Type of each column in the constraint matrix,

        %            specifying whether a variable is continuous,

        %            integer, binary, semi-continuous, or

        %            semi-integer.

        %            Optional.

        %            if ctype is not provided ctype defaults to

        %            char(ones([1 length(obj)])*('C'))

        %    name    char matrix

        %            Names of the new columns.

        %            Optional.

        %   See also Cplex.

     end %end of function

     function out = delRows(cpx, which)

        % Cplex.delRows  Removes rows with indices listed in 'which' from the

        %   Model.

        %

        %   Example:

        %     cplex.delRows (which)

        %     cplex.delRows ([1 2 5])

        %       deletes the constraints in positions 1, 2 and 5

        %     cplex.delRows ([1:100])

        %       deletes the first 100 constraints

        %

        %   Parameters:

        %     which   double vector

        %          Indices of the constraints (rows) to be

        %          removed.

        %

        %   See also Cplex.

     end %end of function

     function out = delCols(cpx, which)

        % Cplex.delCols  Removes columns with indices listed in

        % 'which' from the Model.

        %

        %   Example:

        %     cplex.delCols (which)

        %     cplex.delCols ([1 2 5])

        %       deletes the variables in positions 1, 2 and 5

        %     cplex.delCols ([1:100])

        %       deletes the first 100 variables

        %    Parameters:

        %     which   double vector

        %          Indices of the constraints (rows) to be

        %          removed.

        %

        %   See also Cplex.

     end %end of function

     function out = addSOSs(cpx, type, ind, wt, varargin)

        % Cplex.addSOSs  Adds information about a special ordered set

        % (SOS) to a problem object of type MILP, MIQP, or MIQCP.

        %  The problem may already contain SOS information.

        %

        % Example

        %   cplex.addSOSs (type, ind, wt, name);

        %   Add single SOS:

        %   cplex.addSOSs ('1', [1 2 3]', [1 2 3]', {'sos1(1)'});

        %   Add set of 2 SOSs:

        %   cplex.addSOSs ...

        %   ('12', {[1 2 3]' [4 5 6]'}, {[2 3 4]' [5 6 7]'}, {'s1' 's2'})

        %   Add SOS structure or structure vector:

        %   cplex.addSOSs(sos);

        %   where sos is structure or structure vector with the fields

        %   type, ind, wt and an optional name.

        %   See also the example mipex3.m in examples directory

        %

        %   Parameters:

        %    type   char '1' or '2' or string

        %         SOS type information for the sets to be added.

        %    ind    double column vector or cell vector

        %         Indices for the sets to be added.

        %    wt     double column vector or cell vector

        %         Weights for the sets to be added.

        %    name   cell vector

        %         Names of the new SOSs. Optional.

        %

        %   See also Cplex.

     end %end of function

     function out = addQCs(cpx, a, Q, sense, rhs, varargin)

        % Cplex.addQCs  Adds a quadratic constraint or quadratic constraint

        % set to a specified CPLEX problem object.

        %

        %   Example:

        %     cplex.addQCs(a, Q, sense, rhs, name);

        %     Add single qc

        %     cplex.addQCs([0 0 0]',[1 0 0;0 1 0;0 0 1],'L',1,{'qc1'});

        %     Add qc set(3 qcs)

        %     cplex.addQCs(

        %        [0 0 0;1 0 0;0 1 0]',

        %        {[1 0 0;0 1 0;0 0 1]

        %         [1 0 0;0 1 0;0 0 1]

        %         [1 0 0;0 1 0;0 0 1]},

        %        'LLG',

        %        [1.0 2.0 3.0],

        %        {'qc1' 'qc2' 'qc3'});

        %   Add qc structure or qc structure vector

        %   cplex.addQCs(qc);

        %   qc is structure or structure vector with a, Q, sense,

        %   rhs,and optional name fields.

        %

        %   See also the example qcpex1.m in examples directory.

        %

        %   Parameters:

        %    a     double column vector or matrix

        %         Linear part of the quadratic constraint to be added by

        %         column.

        %    Q     double matrix or cell vector

        %         Quadratic part of the quadratic constraint to be added.

        %    sense   char 'L' or 'G' or string

        %         Sense of the constraint to be added. Note that

        %         quadratic constraints may only be less-than-or-equal-to

        %         greater-than-or-equal-to constraints.

        %    rhs    double or double row vector

        %         Righthand side term for the constraint to be added.

        %    name   cell vector

        %         The name of the constraint to be added. Optional.

        %

        %   See also Cplex.

     end %end of function

     function out = addIndicators(cpx, variable, complemented, a, sense, rhs, varargin)

        % Cplex.addIndicators  Adds indicator constraints to

        % the specified problem.

        %

        %   Example:

        %     cplex.addIndicators(variable, complemented,

        %                a, sense, rhs, name)

        %   Add one indicator with a name

        %     cplex.addIndicators(5, 1,

        %               [1 2 3 4 5 6]', 'E', 100, {'indc3'});

        %   Add two indicators with names

        %     cplex.addIndicators ([5 6], [0 0],

        %                {[1 1 2 2]' [1 2 3 4 5]'}, 'EE', [10 100],

        %                {'indc3' 'indc4'});

        %   Add indicator structure or structure vector

        %     cplex.addIndicators(indicator);

        %   where indicator is structure or structure vector which has

        %   the fields variable, complemented, a, sense, rhs and

        %   an optional name.

        %

        %   Parameters:

        %    variable double or vector

        %         Binary variable that acts as the indicator for this

        %         constraint.

        %    complemented   double or vector

        %         Boolean value that specifies whether the indicator

        %         variable is complemented.

        %         The linear constraint must be satisfied when the indicator

        %         takes a value of 1 (one) if the indicator is not

        %         complemented, and similarly, the linear constraint must be

        %         satisfied when the indicator takes a value of 0 (zero) if

        %         the indicator is complemented.

        %    a     double column vector or cell vector

        %         Linear portion of the indicator constraint.

        %    sense   char 'L','G' or 'E' or string

        %         Sense of the linear portion of the indicator

        %         constraint. Specify 'L' for <= or 'G' for >= or 'E' for

        %         ==.

        %    rhs    double or double row vector

        %         Righthand side value for the linear portion of the

        %         indicator constraint.

        %    name   optional parameter cell vector

        %         Name of the constraint to be added.

        %         May be empty, in which case the new constraint is assigned a

        %         default name if the indicator constraints already resident

        %         in the Cplex problem object have names; otherwise, no name

        %         is associated with the constraint.

        %

        %   See also Cplex.

     end% end of function

     function out = subsref(cpx, s)

        % Cplex.subsref  Overwrites built-in subsref from MATLAB

        %   See also Cplex.

     function out = subsasgn(cpx,index,val)

        % Cplex.subsasgn  Overwrites built-in subsasgn from MATLAB

        %   See also Cplex.

     end% end of function

  end %end of methods

      function out = loadobj(cpx)

         %   See also Cplex.

      end % end of function

  end %end of methods

     function out = saveobj(cpx)

         %   See also Cplex.

     end % end of function

     function out = defaultNames(cpx, start, num, prefix) %#ok<MANU>

        % The routine defaultNames get the default names used for

        % addCols and addRows.

        %   See also Cplex.

     end % end of function

     function out = isConsistent(cpx)

        % The routine isConsistent check verifies consistency of the

        % Model data and throws exceptions.

        %   See also Cplex.

     end%end of function

     function out = checkOrder(cpx)

        % The routine checkOrder: checks Cplex.Order property.

        %   See also Cplex.

     end%end of function

     function out = checkStart(cpx)

        % The routine checkStart: checks the Start and MipStart for

        % optimization. There are two kinds of Start, one for continous,

        % another for discrete.  Please refer to the CPLEX User's Manual.

        % Note: the indices here is MipStart from 1 to n.

        %   See also Cplex.

     end%end of function

     function out = isFeasOptConsistent(cpx, preflhs, prefrhs, preflb, prefub)

        % The routine isFeasOptConsistent check the parameters of feasOpt:

        % at least one component of input

        % should be provided.

        %   See also Cplex.

     end %end of function

     function out = getCallbackX(cpx, cbhandle)

        %   See also Cplex.

     end %end of function

     function out = clearSolution(cpx)

        %   See also Cplex.

     end%end of function

     function out = runDisplayFunc(cpx,func_handle,string)

        %   See also Cplex.

     end%end of function

  end%end of methods

end%end of class


⛄ 运行结果

⛄ 参考文献

[1]陈锦鹏, 胡志坚, 陈颖光,等. 考虑阶梯式碳交易机制与电制氢的综合能源系统热电优化[J]. 电力自动化设备, 2021.

❤️ 关注我领取海量matlab电子书和数学建模资料
❤️部分理论引用网络文献,若有侵权联系博主删除


相关实践学习
SLB负载均衡实践
本场景通过使用阿里云负载均衡 SLB 以及对负载均衡 SLB 后端服务器 ECS 的权重进行修改,快速解决服务器响应速度慢的问题
负载均衡入门与产品使用指南
负载均衡(Server Load Balancer)是对多台云服务器进行流量分发的负载均衡服务,可以通过流量分发扩展应用系统对外的服务能力,通过消除单点故障提升应用系统的可用性。 本课程主要介绍负载均衡的相关技术以及阿里云负载均衡产品的使用方法。
相关文章
|
10天前
|
算法 调度
基于遗传模拟退火混合优化算法的车间作业最优调度matlab仿真,输出甘特图
车间作业调度问题(JSSP)通过遗传算法(GA)和模拟退火算法(SA)优化多个作业在并行工作中心上的加工顺序和时间,以最小化总完成时间和机器闲置时间。MATLAB2022a版本运行测试,展示了有效性和可行性。核心程序采用作业列表表示法,结合遗传操作和模拟退火过程,提高算法性能。
|
10天前
|
机器学习/深度学习 算法 5G
基于MIMO系统的SDR-AltMin混合预编码算法matlab性能仿真
基于MIMO系统的SDR-AltMin混合预编码算法通过结合半定松弛和交替最小化技术,优化大规模MIMO系统的预编码矩阵,提高信号质量。Matlab 2022a仿真结果显示,该算法能有效提升系统性能并降低计算复杂度。核心程序包括预编码和接收矩阵的设计,以及不同信噪比下的性能评估。
27 3
|
15天前
|
机器学习/深度学习 算法 调度
基于ACO蚁群优化的VRPSD问题求解matlab仿真,输出规划路径结果和满载率
基于ACO蚁群优化的VRPSD问题求解MATLAB仿真,输出ACO优化的收敛曲线、规划路径结果及每条路径的满载率。在MATLAB2022a版本中运行,展示了优化过程和最终路径规划结果。核心程序通过迭代搜索最优路径,更新信息素矩阵,确保找到满足客户需求且总行程成本最小的车辆调度方案。
|
21天前
|
人工智能 算法 数据安全/隐私保护
基于遗传优化的SVD水印嵌入提取算法matlab仿真
该算法基于遗传优化的SVD水印嵌入与提取技术,通过遗传算法优化水印嵌入参数,提高水印的鲁棒性和隐蔽性。在MATLAB2022a环境下测试,展示了优化前后的性能对比及不同干扰下的水印提取效果。核心程序实现了SVD分解、遗传算法流程及其参数优化,有效提升了水印技术的应用价值。
|
24天前
|
机器学习/深度学习 算法 调度
基于ACO蚁群优化的VRPSD问题求解matlab仿真,输出规划路径结果和满载率
该程序基于ACO蚁群优化算法解决VRPSD问题,使用MATLAB2022a实现,输出优化收敛曲线及路径规划结果。ACO通过模拟蚂蚁寻找食物的行为,利用信息素和启发式信息指导搜索,有效求解带时间窗约束的车辆路径问题,最小化总行程成本。
|
23天前
|
机器学习/深度学习 算法 数据安全/隐私保护
基于贝叶斯优化CNN-LSTM网络的数据分类识别算法matlab仿真
本项目展示了基于贝叶斯优化(BO)的CNN-LSTM网络在数据分类中的应用。通过MATLAB 2022a实现,优化前后效果对比明显。核心代码附带中文注释和操作视频,涵盖BO、CNN、LSTM理论,特别是BO优化CNN-LSTM网络的batchsize和学习率,显著提升模型性能。
|
3月前
|
安全
【2023高教社杯】D题 圈养湖羊的空间利用率 问题分析、数学模型及MATLAB代码
本文介绍了2023年高教社杯数学建模竞赛D题的圈养湖羊空间利用率问题,包括问题分析、数学模型建立和MATLAB代码实现,旨在优化养殖场的生产计划和空间利用效率。
199 6
【2023高教社杯】D题 圈养湖羊的空间利用率 问题分析、数学模型及MATLAB代码
|
3月前
|
存储 算法 搜索推荐
【2022年华为杯数学建模】B题 方形件组批优化问题 方案及MATLAB代码实现
本文提供了2022年华为杯数学建模竞赛B题的详细方案和MATLAB代码实现,包括方形件组批优化问题和排样优化问题,以及相关数学模型的建立和求解方法。
128 3
【2022年华为杯数学建模】B题 方形件组批优化问题 方案及MATLAB代码实现
|
3月前
|
数据采集 存储 移动开发
【2023五一杯数学建模】 B题 快递需求分析问题 建模方案及MATLAB实现代码
本文介绍了2023年五一杯数学建模竞赛B题的解题方法,详细阐述了如何通过数学建模和MATLAB编程来分析快递需求、预测运输数量、优化运输成本,并估计固定和非固定需求,提供了完整的建模方案和代码实现。
90 0
【2023五一杯数学建模】 B题 快递需求分析问题 建模方案及MATLAB实现代码
|
6月前
|
数据安全/隐私保护
耐震时程曲线,matlab代码,自定义反应谱与地震波,优化源代码,地震波耐震时程曲线
地震波格式转换、时程转换、峰值调整、规范反应谱、计算反应谱、计算持时、生成人工波、时频域转换、数据滤波、基线校正、Arias截波、傅里叶变换、耐震时程曲线、脉冲波合成与提取、三联反应谱、地震动参数、延性反应谱、地震波缩尺、功率谱密度