Hi,
in
How to with OPL ? I gave some examples:
How to multiply two binary decision variables ?
How to multiply a decision variable by a boolean decision variable in CPLEX ?
How to multiply an integer decision variable and a second decision variable ?
How to multiply two float decision variables ?
I recommend the 2nd one:
// suppose we want b * x <= 7
dvar int x in 2..10;
dvar boolean b;
dvar int bx;
maximize x;
subject to
{
// Linearization
bx<=7;
2*b<=bx;
bx<=10*b;
bx<=x-2*(1-b);
bx>=x-10*(1-b);
// if we use CP we could write directly
// b*x<=7
// or rely on logical constraints within CPLEX
// (b==1) => (bx==x);
// (b==0) => (bx==0);
}
------------------------------
[Alex] [Fleischer]
[EMEA CPLEX Optimization Technical Sales]
[IBM]
------------------------------
Original Message:
Sent: Sat September 18, 2021 05:44 PM
From: Muhammad Ismail
Subject: CPLEX Error 5002: Q in ''q1'' is not positive semi-definite
Why I'm getting the following error when multiplying two decision arrays elementwise.
sum(g in pr)(P1producedperiody[t][g]*P1produceperiodx[t][g])
P1producedperiody[t][g]: decision array of type integer
P1produceperiodx[t][g]: decision array of type boolean
Is this the proper way to multiply two arrays elementwise?...
Error:
CPLEX Error 5002: Q in ''q1'' is not positive semi-definite
Can anyone help?
------------------------------
Muhammad Ismail
------------------------------
#DecisionOptimization