Hi, what do you mean ? With CPOptimizer within CPLEX you can use log and as an example I wrote
Hi,
I am trying to optimize for the Shannon entropy of a system. This would mean the objective function is (summing over i) Σx
i
*log(x
i
). The problem is linearly constrained.
I am not sure if there is anyway to get CPLEX to solve for this directly? Preferably using the C API as that is what I have a decent amount of experience using. Any help would be appreciated!
Thanks in advance
------------------------------
Patrick
------------------------------
#DecisionOptimization
Hi,
you can either use CPO
using CP;
int scale=1000;
dvar int scalex in 1..1000000;
dexpr float x=scalex/scale;
maximize x;
subject to
{
log(x)<=2.5;
}
execute
{
writeln("x=",x);
}
works fine and you can do that in C++ too
or you can
linearize
and then use CPLEX MIP
------------------------------
ALEX FLEISCHER
------------------------------
Original Message
Original Message:
Sent: Wed November 04, 2020 05:09 PM
From: Patrick Kreitzber
Subject: Can CPLEX solve a problem with a logarithm in the objective function (e.g. optimize entropy)
Hi,
I am trying to optimize for the Shannon entropy of a system. This would mean the objective function is (summing over i) Σx
i
*log(x
i
). The problem is linearly constrained.
I am not sure if there is anyway to get CPLEX to solve for this directly? Preferably using the C API as that is what I have a decent amount of experience using. Any help would be appreciated!
Thanks in advance
------------------------------
Patrick
------------------------------
#DecisionOptimization
You could linearize the function x -> xlog(x), that is approximate it with a piecewise linear function F.
then you define new variables yj == F(xj) and minimize the sum of yj.
As Alex mentioned, this will introduce binary variables and change the nature of your problem to MILP.
------------------------------
Philippe Couronne
------------------------------
Original Message
Original Message:
Sent: Thu November 05, 2020 10:32 AM
From: ALEX FLEISCHER
Subject: Can CPLEX solve a problem with a logarithm in the objective function (e.g. optimize entropy)
Hi,
you can either use CPO
using CP;
int scale=1000;
dvar int scalex in 1..1000000;
dexpr float x=scalex/scale;
maximize x;
subject to
{
log(x)<=2.5;
}
execute
{
writeln("x=",x);
}
works fine and you can do that in C++ too
or you can
linearize
and then use CPLEX MIP
------------------------------
ALEX FLEISCHER
Original Message:
Sent: Wed November 04, 2020 05:09 PM
From: Patrick Kreitzber
Subject: Can CPLEX solve a problem with a logarithm in the objective function (e.g. optimize entropy)
Hi,
I am trying to optimize for the Shannon entropy of a system. This would mean the objective function is (summing over i) Σx
i
*log(x
i
). The problem is linearly constrained.
I am not sure if there is anyway to get CPLEX to solve for this directly? Preferably using the C API as that is what I have a decent amount of experience using. Any help would be appreciated!
Thanks in advance
------------------------------
Patrick
------------------------------
#DecisionOptimization
Original Message
Original Message:
Sent: Thu November 05, 2020 10:32 AM
From: ALEX FLEISCHER
Subject: Can CPLEX solve a problem with a logarithm in the objective function (e.g. optimize entropy)
Hi,
you can either use CPO
using CP;
int scale=1000;
dvar int scalex in 1..1000000;
dexpr float x=scalex/scale;
maximize x;
subject to
{
log(x)<=2.5;
}
execute
{
writeln("x=",x);
}
works fine and you can do that in C++ too
or you can
linearize
and then use CPLEX MIP
------------------------------
ALEX FLEISCHER
Original Message:
Sent: Wed November 04, 2020 05:09 PM
From: Patrick Kreitzber
Subject: Can CPLEX solve a problem with a logarithm in the objective function (e.g. optimize entropy)
Hi,
I am trying to optimize for the Shannon entropy of a system. This would mean the objective function is (summing over i) Σx
i
*log(x
i
). The problem is linearly constrained.
I am not sure if there is anyway to get CPLEX to solve for this directly? Preferably using the C API as that is what I have a decent amount of experience using. Any help would be appreciated!
Thanks in advance
------------------------------
Patrick
------------------------------
#DecisionOptimization
Hi,
what do you mean ? With CPOptimizer within CPLEX you can use log and as an example I wrote
log(x)<=2.5;
------------------------------
[Alex] [Fleischer]
[EMEA CPLEX Optimization Technical Sales]
[IBM]
------------------------------
Original Message
Original Message:
Sent: Thu November 19, 2020 08:36 AM
From: Farahanim Misni
Subject: Can CPLEX solve a problem with a logarithm in the objective function (e.g. optimize entropy)
May I know, why the constraint become log(x)<=2.5?
------------------------------
Farahanim Misni
Original Message:
Sent: Thu November 05, 2020 10:32 AM
From: ALEX FLEISCHER
Subject: Can CPLEX solve a problem with a logarithm in the objective function (e.g. optimize entropy)
Hi,
you can either use CPO
using CP;
int scale=1000;
dvar int scalex in 1..1000000;
dexpr float x=scalex/scale;
maximize x;
subject to
{
log(x)<=2.5;
}
execute
{
writeln("x=",x);
}
works fine and you can do that in C++ too
or you can
linearize
and then use CPLEX MIP
------------------------------
ALEX FLEISCHER
Original Message:
Sent: Wed November 04, 2020 05:09 PM
From: Patrick Kreitzber
Subject: Can CPLEX solve a problem with a logarithm in the objective function (e.g. optimize entropy)
Hi,
I am trying to optimize for the Shannon entropy of a system. This would mean the objective function is (summing over i) Σx
i
*log(x
i
). The problem is linearly constrained.
I am not sure if there is anyway to get CPLEX to solve for this directly? Preferably using the C API as that is what I have a decent amount of experience using. Any help would be appreciated!
Thanks in advance
------------------------------
Patrick
------------------------------
#DecisionOptimization
Additional
Resources
Discover these carefully selected resources to dive deeper into your journey and unlock fresh insights
Office
If you need immediate assistance please contact the Community Management team
support@communitysite.ibm.com
Monday - Friday: 8AM - 5 PM MT
Quick Links
About Us
Terms of Use
Community Netiquette
Sitemap
Marketplace
Marketplace