help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] How to use loops in Mathprogram


From: ashutosh.natraj
Subject: [Help-glpk] How to use loops in Mathprogram
Date: Fri, 3 Mar 2006 05:53:35 -0800 (PST)

Hello to all
  I had been trying to call "loop with in loop"
I was trying using "for" loop But i get strange problem
either it can not be defined or so
1.Can we call loops in Math program ?
2:If yes then please give me how to use it in math program ?

#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "glpk.h"
#include "glptsp.h"

set I;
set J;
#void main{};
#int i=0;

 #int j=0;

#param int{i=0,j=0};
param d{i in I, j in J};

param f;

param c{i in I, j in J} := f * d[i,j] ;

var x{i in I, j in J} >= 0;

#minimize path: sum{i in I, j in J} c[i,j]* x[i,j]; 
minimize path: 
 for( int i=0; i <=7; i++)
              for(int j=i+1; j<=8; J++)
 
   {sum{i in I, j in J} c[i,j]* x[i,j]; };


s.t. Travelled_distance{i in I}: sum{j in J} x[i,j] = 2; 
       

s.t. Distance_remaining{j in J}: sum{i in I} x[i,j] >= 2;
data;
 
end;
If its not this way please give me in syntax for the function
thanks in advance

ashutosh natraj
student
Technical university Dresden
Germany
--
View this message in context: 
http://www.nabble.com/How-to-use-loops-in-Mathprogram-t1217730.html#a3221259
Sent from the Gnu - GLPK - Help forum at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]