Last active
January 25, 2017 22:04
-
-
Save VincentTam/ab6264d3474e7b2dc76c46c7cf351e99 to your computer and use it in GitHub Desktop.
Octave script for French postal fee with min no. of stamps, run on http://octave-online.net/
This file contains 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
Valeur de timbre (€) | Quantité | |
---------------------+--------- | |
0.71 | 0 | |
0.73 | 0 | |
1.46 | 1 | |
2.92 | 6 | |
0.85 | 0 | |
1.70 | 0 | |
3.40 | 7 | |
1.30 | 0 | |
1.10 | 1 | |
0.01 | 0 | |
0.05 | 0 | |
0.10 | 0 | |
---------------------+--------- | |
Total: 43.88 | 15 |
This file contains 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
# Ce script minimalise le nombre de timbres utilisés | |
A=[.71 .73 1.46 2.92 .85 1.7 3.4 1.3 1.1 .01 .05 .1]; # Personaliser le prix de timbres ici | |
b = 43.88; c=ones(1,12); # Changer la valeur de b ici | |
# Ne pas modifier le reste | |
[x_min z_min] = glpk(c,A,b,zeros(12,1),[],"S","IIIIIIIIIIII"); | |
printf("\n\n") | |
printf("Valeur de timbre (€) | Quantité\n") | |
printf("---------------------+---------\n") | |
printf("%20.2f | %8i\n", [A; x_min']) | |
printf("---------------------+---------\n") | |
printf("Total: %13.2f | %8i\n", b, z_min) | |
printf("\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment