著名IT公司ILog的APS高级排产优化引擎

源代码在线查看: inventorycost.java

软件大小: 4097 K
上传用户: a369100057
关键词: ILog APS 引擎
下载地址: 免注册下载 普通下载 VIP

相关代码

				package com.power.pipeengine.Entity;
				
				import java.util.*;
				import com.power.pipeengine.InputData.*;
				
				public class InventoryCost
				{
				    private String _productID;
					private int _facilityID;
					private Vector _effectiveBuckets = new Vector();
					private Vector _holdingCosts = new Vector();
					private Vector _timePhasedHoldingCosts = new Vector();
				
					public InventoryCost( String prodID, int facilityID ) {
						_productID = prodID;
						_facilityID = facilityID;
					}
				
					public void addCostEntry( int bucketID, double cost ) {
						_effectiveBuckets.addElement( new Integer( bucketID ) );
						_holdingCosts.addElement( new Double( cost ) );
					}
				
					public String getProductID() {
						return _productID;
					}
				
					public int getFacilityID() {
						return _facilityID;
					}
				
					public Product getProduct() {
						Products products = DataModel.getInstance().getProducts();
						return products.getProduct( _facilityID, _productID );
					}
				
					public Facility getFacility() {
						Facilities facilities = DataModel.getInstance().getFacilities();
						return facilities.getFacility( _facilityID );
					}
				
					public Vector getTimePhasedHoldingCosts() {
						return _timePhasedHoldingCosts;
					}
				
					public double getHoldingCost( int bucketID ) {
						Double cost = (Double) _timePhasedHoldingCosts.elementAt( bucketID - 1 );
						return cost.doubleValue();
					}
				
				    public double getMaxHoldingCost() {
						int numBuckets = DataModel.getInstance().getCalendar().getTotalNumOfBuckets();
				        double maxCost = 0;
				        for( int i=1; i				            if( maxCost < getHoldingCost( i ) ) {
				                maxCost = getHoldingCost( i );
				            }
				        }
				
				        return maxCost;
				    }
				
					public void buildTimePhasedHoldingCosts() {
						for( int i=0; i							int currentBucket = ((Integer)_effectiveBuckets.elementAt(i)).intValue();
							int nextBucket = ((Integer)_effectiveBuckets.elementAt(i+1) ).intValue();
							for( int j=currentBucket; j								Double cost = (Double) _holdingCosts.elementAt( i );
								_timePhasedHoldingCosts.addElement( cost );
							}
						}
				
						//from last element to the end of horizon
						int currentBucket = ((Integer)_effectiveBuckets.lastElement()).intValue();
						int numBuckets = DataModel.getInstance().getCalendar().getTotalNumOfBuckets();
						for( int i=currentBucket; i							Double cost = (Double) _holdingCosts.lastElement();
							_timePhasedHoldingCosts.addElement( cost );
						}
					}
				
					public void print() {
						System.out.println( _productID + ", " +
											_facilityID + " " +
											_timePhasedHoldingCosts );
					}
				
				
				
				}
							

相关资源