A mobile application for mathematical function optimization using gradient descent method. The app allows users to input custom functions and visualize the optimization process through an interactive chart.
- Custom function input support
- Multiple variable optimization
- Adjustable learning rate and iteration count
- Real-time visualization of optimization progress
- Zero points display for optimized functions
- Interactive line chart showing convergence
- Kotlin
- Android Jetpack Compose
- MPAndroidChart for data visualization
- exp4j for mathematical expression parsing
- Commons Math3 library
- Android Studio Arctic Fox or newer
- JDK 11 or higher
- Android SDK with minimum API level 24
- Clone the repository
git clone https://github.com/yourusername/Optimization-mobile-app.git
- Open the project in Android Studio
- Sync Gradle files
- Build and run the application on an emulator or physical device
app/
├── build.gradle.kts # Project dependencies and configuration
├── src/
│ └── main/
│ ├── java/
│ │ └── com.example.optimizationapp/
│ │ ├── MainActivity.kt # Main application logic
│ │ ├── Function.kt # Function definition class (unused now)
│ │ └── Optimization.kt # Optimization algorithms (unused now)
│ └── res/ # Resource files
└── AndroidManifest.xml # App configuration
- Enter the function: Type the function you want to minimize into the "Function" input field. Use standard mathematical notation (e.g.,
x^2 + y^2
). - Specify Variables: List the variables used in your function, separated by commas (e.g.,
x,y
). - Set Learning Rate: Enter the desired learning rate for the Gradient Descent algorithm. A smaller value will result in slower but potentially more accurate convergence. The default value is 0.1.
- Set Iterations: Enter the maximum number of iterations for the algorithm. A larger value can increase accuracy but also computation time. The default value is 100.
- Tap "Optimize": The app will calculate the optimization path and display the results on the chart and in the "Zeros" text view.
To minimize the function x^2 + y^2
, you would:
- Enter
x^2 + y^2
in the "Function" field. - Enter
x,y
in the "Variables" field. - (Optional) Adjust the learning rate and iterations.
- Tap "Optimize".
The app will then display the optimization path and the calculated minimum point, which should be close to (0, 0).
- Implement additional optimization algorithms (e.g., Newton's method, Conjugate Gradient).
- Allow users to define constraints for the variables.
- Improve the visualization of the optimization process.
- Add input validation and error handling.
- Add support for more complex mathematical functions.