Skip to main content

G-FOLD: Fuel Optimal Large Divert Guidance Algorithm

Project description

G-FOLD Python Generator

This is the Python implementation of the G-FOLD algorithm with code generation capabilities. The problem is described using CVXPY/Python and C/C++ code is generated using CVXPYGen.

Installation

Option 1: Install from source

Prerequisites

You need to install Rust and Eigen for the code generation feature.

Clone the repository:

git clone https://github.com/samutoljamo/g-fold.git
cd g-fold/generator

Install the package in development mode:

pip install -e .

On WSL, make sure you've installed Tkinter (version depends on the python version you're using):

sudo apt-get install python3.12-tk

Option 2: Install from PyPI (coming soon)

pip install gfold

Usage

As a command-line tool

After installation, you can run G-FOLD from the command line:

# Solve the example problem with 100 steps and display graphs
gfold -n 100

# Generate C++ code
gfold -g -n 100 -o output_directory

# Save the plot to a file without displaying it
gfold -n 100 --save-plot --no-plot

As a Python library

from gfold import GFoldSolver
from gfold.visualization import plot_results

# Create a solver with 100 steps
solver = GFoldSolver()

# Solve the problem
solution = solver.solve(verbose=True)
print(f"Final mass: {solution['final_mass']:.2f} kg")

# Plot the results
plot_results(solution, save_path="gfold_plot.png")

# Generate C++ code
solver.generate_code(code_dir="generated_code")

Example scripts

Check the examples directory for more usage examples:

  • simple_example.py: Basic usage of the solver and visualization

Development

To set up the development environment:

cd g-fold/generator
pip install -e .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gfold-0.1.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gfold-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file gfold-0.1.0.tar.gz.

File metadata

  • Download URL: gfold-0.1.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for gfold-0.1.0.tar.gz
Algorithm Hash digest
SHA256 af17d15c715cf69ad5aa4c1cad5cd43c16cb5e5965a7c4673b814d3bc5d0e825
MD5 a7c85d0f54cf3b34a6d365182f49e86c
BLAKE2b-256 3594ffa3a19a5838b50945f6b0f1802904ff2df83314e64317018ca9b40a4c7a

See more details on using hashes here.

File details

Details for the file gfold-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gfold-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for gfold-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8eb379d987242d86a6b015b3551d9eeba2b48990a5c85c39c5359ac340b80f8c
MD5 4b7df3a99d4522fd160ca01f1f2a7874
BLAKE2b-256 aaee63f4f52289ee632ba03e34253d7dfeecf9c87ab63b60a01402df66d9fb48

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page