You can use the Quasidegrees package to generate toric ideals.
Macaulay2, version 1.21
with packages: ConwayPolynomials, Elimination, IntegralClosure, InverseSystems, Isomorphism, LLLBases,
MinimalPrimes, OnlineLookup, PrimaryDecomposition, ReesAlgebra, Saturation, TangentCone
i1 : loadPackage "Quasidegrees"
o1 = Quasidegrees
o1 : Package
i2 : h = vector {1, 1, 1, 2, 2, 2}
o2 = | 1 |
| 1 |
| 1 |
| 2 |
| 2 |
| 2 |
6
o2 : ZZ
i3 : A = matrix {{2,0,0,1,1,0},{0,2,0,1,0,1},{0,0,2,0,1,1}}
o3 = | 2 0 0 1 1 0 |
| 0 2 0 1 0 1 |
| 0 0 2 0 1 1 |
3 6
o3 : Matrix ZZ <--- ZZ
i4 : R = QQ[x_1, x_2, x_3, x_4, x_5, x_6]
o4 = R
o4 : PolynomialRing
i5 : IA = toricIdeal(A, R)
2 2 2
o5 = ideal (x x - x x , x x - x x , x x - x x , x x - x , x x - x , x x - x )
4 5 1 6 2 5 4 6 3 4 5 6 2 3 6 1 3 5 1 2 4
o5 : Ideal of R
For the second part, look at the Algebraic Optimization Degree package, maybe it will work for you or get an idea from it. For example with the toricMLIdeal function, you can compute the toric Maximum likelihood ideal.