-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autopoint #256
Autopoint #256
Conversation
zhanggiene
commented
Dec 25, 2022
- added Autopoint class which is slimiar to point, but with functionality of calculating the gradient automatically. This PR is an updated version of this PR(Examples of using various automatic differentiation libraries. #243 ). More details can be found here
…/volesti into soc22_autodiffLibrary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I am OK with merging in general. The only real issue is the difficulty to build and run the examples with autodiff. Could you please provide more detailed instructions in the README? Ideally autodiff should be fetched in the correct place by the cmake of volesti just like eigen. Is it possible to do this?
@@ -30,7 +30,7 @@ Polytope generate_cube(const unsigned int& dim, const bool& Vpoly) { | |||
A.resize(2 * dim, dim); | |||
b.resize(2 * dim); | |||
for (unsigned int i = 0; i < dim; ++i) { | |||
b(i) = 1.0; | |||
b(i) = scale; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you assign scale
which is of type const unsigned int
to b(i)
which is of type Polytope::NT
, I think scale
should be of that type too.
examples/Autopoint/MultidimensionalGaussian_mixture_autopoint.cpp
Outdated
Show resolved
Hide resolved
examples/Autopoint/CMakeLists.txt
Outdated
TARGET_LINK_LIBRARIES(Gaussian_mixture_autopoint ${LP_SOLVE} ${BLAS} autodiff::autodiff "-L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl") | ||
|
||
|
||
add_executable (MultidimensionalGaussian_mixture_autopoint MultidimensionalGaussian_mixture_autopoint.cpp readData.cpp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to eliminate whitespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
examples/Autopoint/README.md
Outdated
|
||
|
||
### Background information | ||
Autopoint is implemented using AUtodiff Library , after experiments of comparing various automatic differentiating libraries.Read [here](https://gist.github.com/zhanggiene/8471601fa25ba9db90303661b0e2237b) to find out more! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
capitalization issue
@@ -0,0 +1,15 @@ | |||
import math |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should you have 1 file instead of two files for generating gaussian mixture data?
Also, can you please add flags to the generation script so that the user can define them from the command line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reason for the two separate files is because of the visualization part. I have taken out the visualization for generated data.
examples/Autopoint/readData.cpp
Outdated
} | ||
return result; | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many of the files are missing newlines at the end of the file.
@@ -392,4 +398,105 @@ struct HessianFunctor { | |||
|
|||
}; | |||
|
|||
|
|||
struct AutoDiffFunctor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coding style should be fixed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you talking about the code format or software best practice to write elegant and readable code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both, but primarily the former.
Autodiff library is automatically downloaded in a similar fashion as Boost and Eigen. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #256 +/- ##
===========================================
- Coverage 55.31% 53.94% -1.38%
===========================================
Files 108 105 -3
Lines 6539 6166 -373
Branches 3026 2878 -148
===========================================
- Hits 3617 3326 -291
- Misses 948 964 +16
+ Partials 1974 1876 -98
|
test/CMakeLists.txt
Outdated
@@ -26,6 +26,7 @@ endif() | |||
|
|||
option(DISABLE_NLP_ORACLES "Disable non-linear oracles (used in collocation)" ON) | |||
option(BUILTIN_EIGEN "Use eigen from ../external" OFF) | |||
option(BUILTIN_AUTODIFF "Use eigen from ../external" ON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a typo here
typename NT> | ||
struct FunctionFunctor_internal | ||
{ | ||
typedef autopoint<NT> Autopoint; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can go with using
instead of typedef
Since this is ready to merge as a feature, I will merge it now and fix possible issues in a future PR. |