Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
Expand all | Collapse all

Add ctype that every variable is binary

  • 1.  Add ctype that every variable is binary

    Posted Fri May 10, 2019 06:27 AM

    Originally posted by: Mambo12345


    Hello everyone,

     

    I am new in the world of Cplex and Matlab and I apologize for every easy question I ask or for every mistake I do.
    I have a quadratic program with linear constraints.

    [x,fval] = cplexmiqp(H, f, A, b', Aeq, beq', [], [], [], lb, ub, 'B' ,[],options)

    my matrix H is actually not symmetric but I fixed this with setting H = H+H'.
    Now I would like to say Cplex/matlab that every of my variables x should be binary but I dont know how.
    Actually I dont even need my function f but when I write [] instead of f it always says:

    Error using cplexmiqp
    CPLEX encountered arrays with inconsistent lengths.

    Can please anybody help me ?
    I am thankful for every advice.


    Best regards !
     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Add ctype that every variable is binary

    Posted Fri May 10, 2019 07:43 AM

    Did you take a look at the reference documentation of the function here?

    Or at the many example that ship with CPLEX? The example in cplex/examples/src/matlab/cplexmiqpex.m should tell you exactly what to do.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Add ctype that every variable is binary

    Posted Fri May 10, 2019 07:49 AM

    Originally posted by: Mambo12345


    Thank you very much for your quick answer. I am sorry that I did not find any examples before but now I fixed it and everything is working with this issue.
    But maybe you can help me with my other problems. I can not fix this so far and I hope that my questions there are not so obvious.

    I hope you can help me with my problem where I receive the error that this is not convex. I have no other idea there.


    #CPLEXOptimizers
    #DecisionOptimization