Hello Jared,
take a look at glpk-4.47/examples/sample.c
Best regards
Xypron
-------- Original-Nachricht --------
> Datum: Fri, 31 Aug 2012 15:52:11 -0700
> Betreff: [Help-glpk] C API: Setting up a least-absolute-deviation problem
>
> I have an absolute value objective function, minimizing the sum of abs(
> s[i] - x[i] ) for two vectors s and x, with the constraints given by Ax = b
> where A is a large but very sparse matrix.
>
> So I'm using a dummy vector "u" in a MathProg model:
>
> minimize least_abs_dev: sum {i in I} (u[i]);
> s.t. constr1{i in I} : b[i] = sum{j in I} (A[i,j] * x[j]);
> s.t. constr2{i in I} : u[i] >= (s[i] - x[i]);
> s.t. constr3{i in I} : u[i] >= -(s[i] - x[i]);
>
> I also eventually want to incorporate weights into the objective:
>
> minimize least_abs_dev: sum {i in I} (u[i] * w[i]);
>
> I've got this type of model working using MathProg and glpsol, but now I'm
> trying to figure out how to translate it to the strict form required by
> the C API. Has anyone done this? What's the best way to go about it? I'm
> going to need high performance on some large problems.
>
> I am fairly new to optimization and GLPK. Any help would be much
> appreciated.
>
> - JM
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk