-
Notifications
You must be signed in to change notification settings - Fork 3
[Ready for review] Adds problem struct, neg and promote atoms and a lot more tests #5
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
7a09d56
adds problem struct
Transurgeon acdd79e
adds newly added files
Transurgeon d1ae7d5
fix freeing of expressions in problem
Transurgeon e12c752
free expressions recursively in problem
Transurgeon cca4fbc
adds shared variables and freeing them using a visited node tracker
Transurgeon 8ea75ab
adds constraint forward as well
Transurgeon 4c94fb7
begin iterating on conversion of real problem, requires neg and promote
Transurgeon 9a8cb01
adds new files
Transurgeon 279c582
cleanup a bit convert.py
Transurgeon 2721ae8
remove dead code in problem.c
Transurgeon e2bca37
Merge branch 'main' into problem-struct
Transurgeon 4f0fb21
change problem_allocate to init_deriv
Transurgeon 5b27f25
refactor python bindings into atoms/ and problem/ folders
Transurgeon aedaafd
Change gradient, jacobian, constraint_forward to return void
Transurgeon dad7950
run formatting
Transurgeon 643fd2a
run formatting and add venv to gitignore
Transurgeon 25c5497
Move sparsity pattern setup to init functions in neg
Transurgeon 2e7468a
Move sparsity pattern setup to init functions in promote
Transurgeon 3701acf
adds comment for convert
Transurgeon 529c67c
Revert to debug CI failure
Transurgeon 5780b81
Merge remote-tracking branch 'origin/main' into problem-struct
Transurgeon 1c3a1d5
Move sparsity pattern to init functions and fix tests for new memory …
Transurgeon 26c0a1a
Use memcpy for CSR sparsity copies and move allocation to init
Transurgeon 4bb8351
Use memcpy for value copies and simplify row pointer loop
Transurgeon 856ca50
Simplify promote to only handle scalar inputs
Transurgeon 012efc6
Refactor promote: use memcpy and reorganize tests
Transurgeon 40a8262
Merge branch 'main' into problem-struct
Transurgeon 472a4fb
Merge branch 'main' into problem-struct
Transurgeon 40927d5
Fix duplicate eval_jacobian definition in variable.c
Transurgeon 78fd177
Refactor problem tests to use cmp_double_array and cmp_int_array
Transurgeon 55ca55f
Move neg jacobian tests to tests/jacobian_tests/test_neg.h
Transurgeon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #ifndef PROBLEM_H | ||
| #define PROBLEM_H | ||
|
|
||
| #include "expr.h" | ||
| #include "utils/CSR_Matrix.h" | ||
|
|
||
| typedef struct problem | ||
| { | ||
| expr *objective; | ||
| expr **constraints; | ||
| int n_constraints; | ||
| int n_vars; | ||
| int total_constraint_size; | ||
|
|
||
| /* Allocated by problem_allocate */ | ||
| double *constraint_values; | ||
| double *gradient_values; | ||
| CSR_Matrix *stacked_jac; | ||
| } problem; | ||
|
|
||
| /* Takes ownership of objective and constraints - caller should not free them */ | ||
| problem *new_problem(expr *objective, expr **constraints, int n_constraints); | ||
| void problem_allocate(problem *prob, const double *u); | ||
| void free_problem(problem *prob); | ||
|
|
||
| double problem_forward(problem *prob, const double *u); | ||
| double *problem_gradient(problem *prob, const double *u); | ||
| CSR_Matrix *problem_jacobian(problem *prob, const double *u); | ||
|
|
||
| #endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.