- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 100
 
Added a new Subpackage for Augmented Lagrangian #984
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 9 commits
      Commits
    
    
            Show all changes
          
          
            10 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      3eccd18
              
                Added a new Subpackage for Augmented Lagrangian
              
              
                ParamThakkar123 7637140
              
                Added OptimizationAuglag tests
              
              
                ParamThakkar123 1c8caba
              
                Added tests to OptimizationAuglag
              
              
                ParamThakkar123 2446a2f
              
                Updates
              
              
                ParamThakkar123 482dcf7
              
                OptimizationBase switch
              
              
                ParamThakkar123 49efbab
              
                Updates
              
              
                ParamThakkar123 a4adf19
              
                Updates
              
              
                ParamThakkar123 247ccdd
              
                add test runner
              
              
                ChrisRackauckas 9932311
              
                Update Project.toml
              
              
                ChrisRackauckas fc48f5e
              
                Update lib/OptimizationAuglag/Project.toml
              
              
                ChrisRackauckas 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
    
  
  
    
              
  
    
      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,25 @@ | ||
| name = "OptimizationAuglag" | ||
| uuid = "2ea93f80-9333-43a1-a68d-1f53b957a421" | ||
| authors = ["paramthakkar123 <paramthakkar864@gmail.com>"] | ||
| version = "0.1.0" | ||
| 
     | 
||
| [deps] | ||
| ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" | ||
| MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54" | ||
| Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba" | ||
| OptimizationBase = "bca83a33-5cc9-4baa-983d-23429ab6bcbb" | ||
| OptimizationOptimisers = "42dfb2eb-d2b4-4451-abcd-913932933ac1" | ||
| 
     | 
||
| [extras] | ||
| Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
| 
     | 
||
| [compat] | ||
| ForwardDiff = "1.0.1" | ||
| MLUtils = "0.4.8" | ||
| Optimization = "4.4.0" | ||
| OptimizationBase = "2.10.0" | ||
| OptimizationOptimisers = "0.3.8" | ||
| Test = "1.11.0" | ||
                
      
                  ChrisRackauckas marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| [targets] | ||
| test = ["Test"] | ||
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| using OptimizationBase | ||
| using MLUtils | ||
| using OptimizationOptimisers | ||
| using OptimizationAuglag | ||
| using ForwardDiff | ||
| using OptimizationBase: OptimizationCache | ||
| using OptimizationBase.SciMLBase: OptimizationFunction | ||
| using Test | ||
| 
     | 
||
| @testset "OptimizationAuglag.jl" begin | ||
| x0 = (-pi):0.001:pi | ||
| y0 = sin.(x0) | ||
| data = MLUtils.DataLoader((x0, y0), batchsize = 126) | ||
| 
     | 
||
| function loss(coeffs, data) | ||
| ypred = [evalpoly(data[1][i], coeffs) for i in eachindex(data[1])] | ||
| return sum(abs2, ypred .- data[2]) | ||
| end | ||
| 
     | 
||
| function cons1(res, coeffs, p = nothing) | ||
| res[1] = coeffs[1] * coeffs[5] - 1 | ||
| return nothing | ||
| end | ||
| 
     | 
||
| optf = OptimizationFunction(loss, OptimizationBase.AutoSparseForwardDiff(), cons = cons1) | ||
| callback = (st, l) -> (@show l; return false) | ||
| 
     | 
||
| initpars = rand(5) | ||
| l0 = optf(initpars, (x0, y0)) | ||
| 
     | 
||
| prob = OptimizationProblem(optf, initpars, data, lcons = [-Inf], ucons = [1], | ||
| lb = [-10.0, -10.0, -10.0, -10.0, -10.0], ub = [10.0, 10.0, 10.0, 10.0, 10.0]) | ||
| opt = solve( | ||
| prob, OptimizationAuglag.AugLag(; inner = Adam()), maxiters = 10000, callback = callback) | ||
| @test opt.objective < l0 | ||
| end | 
  
    
      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.
  
    
  
    
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 be able to just need optimizationbase?
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.
Okay will replace with that one