Originally posted by: sandeepsinghchauhan
I have this sparsity model and here i include one boolean variable which makes my objective quadratic. so what are the changes i need to do to handle this Z variable
{string} Cities = ...;
{string} Products = ...;
float Capacity = ...;
tuple route {
string p;
string o;
string d;
}
{route} Routes = ...;
tuple supply {
string p;
string o;
}
{supply} Supplies = { <p,o> | <p,o,d> in Routes };
float Supply[Supplies] = ...;
tuple customer {
string p;
string d;
}
{customer} Customers = { <p,d> | <p,o,d> in Routes };
float Demand[Customers] = ...;
float Cost[Routes] = ...;
{string} Orig[p in Products] = { o | <p,o,d> in Routes };
{string} Dest[p in Products] = { d | <p,o,d> in Routes };
assert forall(p in Products)
sum(o in Orig[p])
Supply[<p,o>] == sum( d in Dest[p] ) Demand[<p,d>];
dvar float+ Trans[Routes];
dvar boolean Z[Routes];
constraint ctSupply[Products][Cities];
constraint ctDemand[Products][Cities];
minimize
sum(l in Routes) Cost[l] * Trans[l] * Z[l];
subject to {
forall( p in Products , o in Orig[p] )
ctSupply[p][o]:
sum( d in Dest[p] )
Trans[< p,o,d >] == Supply[<p,o>];
forall( p in Products , d in Dest[p] )
ctDemand[p][d]:
sum( o in Orig[p] )
Trans[< p,o,d >] == Demand[<p,d>];
ctCapacity: forall( o , d in Cities )
sum( <p,o,d> in Routes )
Trans[<p,o,d>] <= Capacity;
active:
forall( l in Routes)
Z[l] == minl(1,Trans[l]);
}
Error
CPLEX Error 5002: Q in objective is not positive semi-definite.
please help
#DecisionOptimization#OPLusingCPLEXOptimizer