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

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.1.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.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gfold-0.1.1.tar.gz
Algorithm Hash digest
SHA256 61e132cf7e6b7893002f6469c696683c2648a18a05c5a50755fc7b95d94f92ac
MD5 5fb4fca301b0db1eb59963372a4aa6c7
BLAKE2b-256 1d9fe3de20540f657d1e57a6bc4cb1060790120c15fb0fd6c947234be60dbd08

See more details on using hashes here.

Provenance

The following attestation bundles were made for gfold-0.1.1.tar.gz:

Publisher: python-publish.yml on samutoljamo/g-fold

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

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

File hashes

Hashes for gfold-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3470b4dae058f1b6c908ff77a406b0191156d434fcb55004783d145935a2bce3
MD5 d9fa6ec271c152db1684f8865f876113
BLAKE2b-256 b633f80b4a770c73bd4aa3ac7de29c0530a899ea3c00ee5cf924ae43454edc0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for gfold-0.1.1-py3-none-any.whl:

Publisher: python-publish.yml on samutoljamo/g-fold

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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