Documentation for ClpSimplex::createPiecewiseLinearCosts() API function? #213
Unanswered
Antarctic-Fox
asked this question in
Q&A
Replies: 2 comments
-
Piecewise linear seems to work - but can print incorrect objective value.
Should be able to fix soon in master.
Will put up a better example.
John Forrest
…On 08/11/2021 00:48, Antarctic-Fox wrote:
I want to reformulate my LP problem in CLP solver using a convex
piecewise linear objective (really just need an absolute value without
creating extra linear constraints for it). API function
createPiecewiseLinearCosts looks like a good fit but it is very poorly
documented. I have checked the headers [1], the user guide [2],
googled for examples online [3]. None describe the parameters of the
function. *If the original developer is still on the team, is there
any hope to get a clear description of the parameters expected by the
function?*
--Thanks.
[1] Description from the ClpSimplex header does not describe parameters:
/** Constructs a non linear cost from list of non-linearities (columns
only)
First lower of each column is taken as real lower
Last lower is taken as real upper and cost ignored
|Returns nonzero if bad data e.g. lowers not monotonic */ int
createPiecewiseLinearCosts(const int * starts, const double * lower,
const double * gradient); |
Description from ClpNonLinearCost.hpp makes no sense either:
/** Constructor from simplex and list of non-linearities (columns only)
First lower of each column has to match real lower
Last lower has to be <= upper (if == then cost ignored)
This could obviously be changed to make more user friendly
*/
ClpNonLinearCost(ClpSimplex * model, const int * starts,
const double * lower, const double * cost);
[2] The user guide only mentions it in passing:
The primal can also use a non linear cost which should work for
piecewise linear convex functions.
[3] Best online example I've found is on this website:
https://cpp.hotexamples.com/examples/-/ClpSimplex/-/cpp-clpsimplex-class-examples.html
<https://cpp.hotexamples.com/examples/-/ClpSimplex/-/cpp-clpsimplex-class-examples.html>
The code is very convoluted with no comments and no explanations, it
mingles a bunch of unrelated stuff into the usage of
createPiecewiseLinearCosts().
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#213>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABWJYHFIOWYM3TGLRSN2CKLUK4M4BANCNFSM5HROGZCQ>.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you, John. A simple example to demo this feature would be great. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to reformulate my LP problem in CLP solver using a convex piecewise linear objective (really just need an absolute value without creating extra linear constraints for it). API function createPiecewiseLinearCosts looks like a good fit but it is very poorly documented. I have checked the headers [1], the user guide [2], googled for examples online [3]. None describe the parameters of the function. If the original developer is still on the team, is there any hope to get a clear description of the parameters expected by the function?
--Thanks.
[1] Description from the ClpSimplex header does not describe parameters:
/** Constructs a non linear cost from list of non-linearities (columns only)
First lower of each column is taken as real lower
Last lower is taken as real upper and cost ignored
Description from ClpNonLinearCost.hpp makes no sense either:
/** Constructor from simplex and list of non-linearities (columns only)
First lower of each column has to match real lower
Last lower has to be <= upper (if == then cost ignored)
This could obviously be changed to make more user friendly
*/
ClpNonLinearCost(ClpSimplex * model, const int * starts,
const double * lower, const double * cost);
[2] The user guide only mentions it in passing:
The primal can also use a non linear cost which should work for piecewise linear convex functions.
[3] Best online example I've found is on this website:
https://cpp.hotexamples.com/examples/-/ClpSimplex/-/cpp-clpsimplex-class-examples.html
The code is very convoluted with no comments and no explanations, it mingles a bunch of unrelated stuff into the usage of createPiecewiseLinearCosts().
Beta Was this translation helpful? Give feedback.
All reactions